|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface that specifies a policy for caches.
Implementation classes can implement a LRU policy, a random one, a MRU one, or any other suitable policy.
Method Summary | |
void |
create()
create the service, do expensive operations etc |
void |
destroy()
destroy the service, tear down |
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()
Get the size of the cache. |
void |
start()
start the service, create is already called |
void |
stop()
stop the service |
Method Detail |
public 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)
public Object peek(Object key)
get(java.lang.Object)
.
key
- the key paired with the objectget(java.lang.Object)
public void insert(Object key, Object object)
key
- the key paired with the objectobject
- the object to cacheremove(java.lang.Object)
public void remove(Object key)
key
- the key paired with the objectinsert(java.lang.Object, java.lang.Object)
public void flush()
public int size()
public void create() throws Exception
Exception
public void start() throws Exception
Exception
public void stop()
public void destroy()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |