|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sf.swarmcache.LRUCache
Cache implementation that uses the Least Recently Used algorithm. This algorithm provides good cache hit frequency.
Nested Class Summary | |
class |
LRUCache.ListeningLRUMap
|
Field Summary | |
static int |
DEFAULT_CACHE_SIZE
The default cache size (1000). |
static java.lang.String |
LRU_CACHE_SIZE_PROPERTY
The property containing the maximum number of objects to cache. |
Constructor Summary | |
LRUCache()
|
Method Summary | |
java.lang.Object |
clear(java.io.Serializable key)
Clears an object from the cache by key. |
void |
clearAll()
Clears the entire cache. |
java.lang.Object |
get(java.io.Serializable key)
Gets an object from the cache by key, or returns null if that object is not cached. |
java.lang.String |
getType()
Gets the common name of the type of objects to cache. |
void |
put(java.io.Serializable key,
java.lang.Object object)
Adds an object to the cache. |
void |
setListener(LRUCacheListener l)
|
void |
setSize(int newSize)
|
void |
setType(java.lang.String type)
Sets the common name of the type of objects to cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String LRU_CACHE_SIZE_PROPERTY
public static final int DEFAULT_CACHE_SIZE
Constructor Detail |
public LRUCache()
Method Detail |
public void setSize(int newSize)
public java.lang.String getType()
ObjectCache
getType
in interface ObjectCache
public void setType(java.lang.String type)
ObjectCache
setType
in interface ObjectCache
public void put(java.io.Serializable key, java.lang.Object object)
ObjectCache
put
in interface ObjectCache
public java.lang.Object get(java.io.Serializable key)
ObjectCache
get
in interface ObjectCache
public java.lang.Object clear(java.io.Serializable key)
ObjectCache
clear
in interface ObjectCache
public void clearAll()
ObjectCache
clearAll
in interface ObjectCache
public void setListener(LRUCacheListener l)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |