|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.jca.adapters.jdbc.util.LRUCache<K,V>
K - The keyV - The valueK - The keyV - The valuepublic class LRUCache<K,V>

Implementation of a Least Recently Used cache policy.
| Nested Class Summary | |
|---|---|
class |
LRUCache.LRUCacheEntry<K,V>
Double linked cell used as entry in the cache list. |
class |
LRUCache.LRUList
Double queued list used to store cache entries. |
| Constructor Summary | |
|---|---|
LRUCache(int max)
Creates a LRU cache |
|
| 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 o)
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 listener)
Set the cache listener |
int |
size()
The cache size |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LRUCache(int max)
max - The maximum number of entries| Method Detail |
|---|
public V get(K key)
Cache.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.
get in interface Cache<K,V>key - the key paired with the object
Cache.peek(K)public V peek(K key)
Cache.get(K).
peek in interface Cache<K,V>key - the key paired with the object
Cache.get(K)
public void insert(K key,
V o)
insert in interface Cache<K,V>key - the key paired with the objecto - the object to cacheCache.remove(K)public void remove(K key)
remove in interface Cache<K,V>key - the key paired with the objectCache.insert(K, V)public void flush()
flush in interface Cache<K,V>public int size()
size in interface Cache<K,V>public void setListener(CacheListener listener)
setListener in interface Cache<K,V>listener - The listener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||