org.tbee.cache.simple
Class LeastRecentlyUsedCache<K,V>
java.lang.Object
org.tbee.cache.simple.LeastRecentlyUsedCache<K,V>
- All Implemented Interfaces:
- Map<K,V>, Cache<K,V>
public class LeastRecentlyUsedCache<K,V>
- extends Object
- implements Cache<K,V>
This cache has a maximum number of items it remembers.
They may be clean out by the garbage collecter.
If the cache is full and a new items is added, the least recently used item is remove from the cache to make room for the new item.
- Version:
- $Revision: 1.4 $
- Author:
- $Author: tom $
| Nested classes/interfaces inherited from interface java.util.Map |
Map.Entry<K,V> |
SOURCECODE_VERSION
public static final String SOURCECODE_VERSION
- Standard variable for determining version of a class file.
- See Also:
- Constant Field Values
MODE_STRONG
public static char MODE_STRONG
MODE_SOFT
public static char MODE_SOFT
MODE_WEAK
public static char MODE_WEAK
LeastRecentlyUsedCache
public LeastRecentlyUsedCache()
- This constructor uses a cache size specified in as a system property,
or a default value (10) if the property is not present.
LeastRecentlyUsedCache
public LeastRecentlyUsedCache(char pMode)
- This constructor uses a cache size specified in as a system property,
or a default value (10) if the property is not present.
LeastRecentlyUsedCache
public LeastRecentlyUsedCache(char pMode,
int pSize)
LeastRecentlyUsedCache
public LeastRecentlyUsedCache(int pSize)
addCacheListener
public void addCacheListener(CacheListener pCacheListener)
- A cache listener listens to both finalize and remove events
- Specified by:
addCacheListener in interface Cache<K,V>
removeCacheListener
public void removeCacheListener(CacheListener pCacheListener)
- Specified by:
removeCacheListener in interface Cache<K,V>
clear
public void clear()
- Specified by:
clear in interface Map<K,V>
clone
public Object clone()
- Overrides:
clone in class Object
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKey in interface Map<K,V>
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue in interface Map<K,V>
entrySet
public Set<Map.Entry<K,V>> entrySet()
- Specified by:
entrySet in interface Map<K,V>
get
public V get(Object key)
- Specified by:
get in interface Map<K,V>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Map<K,V>
keySet
public Set keySet()
- Specified by:
keySet in interface Map<K,V>
put
public V put(K key,
V value)
- Specified by:
put in interface Map<K,V>
putAll
public void putAll(Map<? extends K,? extends V> t)
- Specified by:
putAll in interface Map<K,V>
remove
public V remove(Object key)
- Specified by:
remove in interface Map<K,V>
removeValue
public void removeValue(Object value)
- Specified by:
removeValue in interface Cache<K,V>
size
public int size()
- Specified by:
size in interface Map<K,V>
toString
public String toString()
- Overrides:
toString in class Object
values
public Collection values()
- Specified by:
values in interface Map<K,V>
addAssociation
public void addAssociation(Object association)
getAssociations
public Vector getAssociations()
getName
public String getName()
setName
public void setName(String pName)
Copyright © 2010 KnowledgePlaza. All Rights Reserved.