|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
K - The keyV - The valuepublic interface Cache<K,V>

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 |
flush()
Flushes the cached objects from the cache. |
V |
get(K key)
Returns the object paired with the specified key if it's present in the cache, otherwise must return null. |
void |
insert(K key,
V object)
Inserts the specified object into the cache following the implemented policy. |
V |
peek(K key)
Returns the object paired with the specified key if it's present in the cache, otherwise must return null. |
void |
remove(K key)
Remove the cached object paired with the specified key. |
void |
setListener(CacheListener<V> listener)
Set the cache listener |
int |
size()
The cache size |
| Method Detail |
|---|
V get(K key)
peek(K) 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 object
peek(K)V peek(K key)
get(K).
key - the key paired with the object
get(K)
void insert(K key,
V object)
key - the key paired with the objectobject - the object to cacheremove(K)void remove(K key)
key - the key paired with the objectinsert(K, V)void flush()
int size()
void setListener(CacheListener<V> listener)
listener - The listener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||