public interface CachePolicy
Implementation classes can implement a LRU policy, a random one, a MRU one, or any other suitable policy.
Modifier and Type | Method and Description |
---|---|
void |
create() |
void |
destroy() |
void |
flush()
Flushes the cached objects from the cache.
|
Object |
get(Object key)
Returns the object paired with the specified key if it's
present in the cache, otherwise must return null.
|
void |
insert(Object key,
Object object)
Inserts the specified object into the cache following the
implemented policy.
|
Object |
peek(Object key)
Returns the object paired with the specified key if it's
present in the cache, otherwise must return null.
|
void |
remove(Object key)
Remove the cached object paired with the specified key.
|
int |
size() |
void |
start() |
void |
stop() |
Object get(Object key)
peek(java.lang.Object)
this method not only return whether
the object is present in the cache or not, but also
applies the implemented policy that will "refresh" the cached
object in the cache, because this cached object
was really requested.key
- the key paired with the objectpeek(java.lang.Object)
Object peek(Object key)
get(java.lang.Object)
.key
- the key paired with the objectget(java.lang.Object)
void insert(Object key, Object object)
key
- the key paired with the objectobject
- the object to cacheremove(java.lang.Object)
void remove(Object key)
key
- the key paired with the objectinsert(java.lang.Object, java.lang.Object)
void flush()
int size()
void stop()
void destroy()
Copyright © 2018 JBoss by Red Hat. All rights reserved.