|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.jca.adapters.jdbc.util.LRUCachePolicy
public class LRUCachePolicy

Implementation of a Least Recently Used cache policy.
| Nested Class Summary | |
|---|---|
class |
LRUCachePolicy.LRUCacheEntry
Double linked cell used as entry in the cache list. |
class |
LRUCachePolicy.LRUList
Double queued list used to store cache entries. |
| Field Summary | |
|---|---|
protected LRUCachePolicy.LRUList |
lruList
The linked list used to implement the LRU algorithm |
protected Map |
map
The map holding the cached objects |
protected int |
maxCapacity
The maximum capacity of this cache |
protected int |
minCapacity
The minimum capacity of this cache |
| Constructor Summary | |
|---|---|
LRUCachePolicy()
Creates a LRU cache policy object with zero cache capacity. |
|
LRUCachePolicy(int min,
int max)
Creates a LRU cache policy object with the specified minimum and maximum capacity. |
|
| Method Summary | |
|---|---|
protected void |
ageOut(LRUCachePolicy.LRUCacheEntry entry)
Callback method called when the cache algorithm ages out of the cache the given entry. |
protected void |
cacheMiss()
Callback method called when a cache miss happens. |
void |
create()
Initializes the cache, creating all required objects and initializing their values. |
protected LRUCachePolicy.LRUCacheEntry |
createCacheEntry(Object key,
Object value)
Factory method for cache entries |
protected LRUCachePolicy.LRUList |
createList()
Factory method for the linked list used by this cache implementation. |
protected Map |
createMap()
Create map holding entries. |
void |
destroy()
Destroys the cache that is now unusable. |
void |
flush()
flush |
Object |
get(Object key)
get method |
void |
insert(Object key,
Object o)
insert |
Object |
peek(Object key)
peek |
void |
remove(Object key)
remove |
int |
size()
size |
void |
start()
Starts this cache that is now ready to be used. |
void |
stop()
Stops this cache thus flush()ing all cached objects. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Map map
protected LRUCachePolicy.LRUList lruList
protected int maxCapacity
protected int minCapacity
| Constructor Detail |
|---|
public LRUCachePolicy()
create()
public LRUCachePolicy(int min,
int max)
min - minmax - maxcreate()| Method Detail |
|---|
protected Map createMap()
public void create()
start(),
destroy()public void start()
create(),
stop()public void stop()
flush()ing all cached objects. start() will restart the cache.
start(),
destroy()public void destroy()
create()ed and
re-start()ed.
create()public Object get(Object key)
key - key
public Object peek(Object key)
key - the key
public void insert(Object key,
Object o)
key - the keyo - valuepublic void remove(Object key)
key - the keypublic void flush()
public int size()
protected LRUCachePolicy.LRUList createList()
protected void ageOut(LRUCachePolicy.LRUCacheEntry entry)
entry - entryprotected void cacheMiss()
protected LRUCachePolicy.LRUCacheEntry createCacheEntry(Object key,
Object value)
key - keyvalue - value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||