|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.eventadmin.impl.util.LeastRecentlyUsedCacheMap
public class LeastRecentlyUsedCacheMap
This class implements a least recently used cache map. It will hold a given size of key-value pairs and drop the least recently used entry once this size is reached. This class is thread safe.
CacheMap
Constructor Summary | |
---|---|
LeastRecentlyUsedCacheMap(int maxSize)
The constructor of the cache. |
Method Summary | |
---|---|
void |
add(java.lang.Object key,
java.lang.Object value)
Add the key-value pair to the cache. |
void |
clear()
Remove all entries from the cache. |
java.lang.Object |
get(java.lang.Object key)
Returns the value for the key in case there is one. |
java.lang.Object |
remove(java.lang.Object key)
Remove the entry denoted by key from the cache and return its value. |
int |
size()
Return the current size of the cache. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LeastRecentlyUsedCacheMap(int maxSize)
maxSize
- The max number of entries in the cacheMethod Detail |
---|
public java.lang.Object get(java.lang.Object key)
get
in interface CacheMap
key
- The key for the value to return
CacheMap.get(java.lang.Object)
public void add(java.lang.Object key, java.lang.Object value)
add
in interface CacheMap
key
- The key for the valuevalue
- The value for the keyCacheMap.add(java.lang.Object, java.lang.Object)
public java.lang.Object remove(java.lang.Object key)
remove
in interface CacheMap
key
- The key of the entry to be removed
CacheMap.remove(java.lang.Object)
public int size()
size
in interface CacheMap
CacheMap.size()
public void clear()
clear
in interface CacheMap
CacheMap.clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |