|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.cache.implementation.LRUCache<K,V>
public class LRUCache<K,V>
A cache implementation backed by a LinkedHashMap, in access-order mode, and
restricted maximal size ('Least Recently Used' cache algorithm).
Cache| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
int |
maxSize
|
| Constructor Summary | |
|---|---|
LRUCache()
|
|
LRUCache(int size)
|
|
| Method Summary | |
|---|---|
void |
clear()
|
void |
config(Map<String,String> map)
Configure the implementation with the given configuration values |
boolean |
containsKey(Object key)
|
boolean |
containsValue(Object value)
|
Set<Map.Entry<K,V>> |
entrySet()
|
V |
get(Object key)
|
int |
getCount(K key)
Returns the hit-count on a certain key (if implementable, -1 otherwise). |
Object |
getLock()
The cache implementation must be somehow thread-safe. |
boolean |
isEmpty()
|
Set<K> |
keySet()
|
int |
maxSize()
Gets the (maximal) size of the cache (if implementable) |
V |
put(K key,
V value)
|
void |
putAll(Map<? extends K,? extends V> map)
|
V |
remove(Object key)
|
void |
setMaxSize(int size)
Change the maximum size of the table. |
int |
size()
|
String |
toString()
Returns size, maxSize. |
Collection<V> |
values()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
equals, hashCode |
| Field Detail |
|---|
public int maxSize
| Constructor Detail |
|---|
public LRUCache()
public LRUCache(int size)
| Method Detail |
|---|
public int getCount(K key)
CacheImplementationInterface
getCount in interface CacheImplementationInterface<K,V>public void setMaxSize(int size)
setMaxSize in interface CacheImplementationInterface<K,V>size - the new desired sizepublic final int maxSize()
CacheImplementationInterface
maxSize in interface CacheImplementationInterface<K,V>public String toString()
toString in class Objectpublic void config(Map<String,String> map)
CacheImplementationInterface
config in interface CacheImplementationInterface<K,V>public Object getLock()
CacheImplementationInterface
getLock in interface CacheImplementationInterface<K,V>public int size()
size in interface Map<K,V>public boolean isEmpty()
isEmpty in interface Map<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public V get(Object key)
get in interface Map<K,V>
public V put(K key,
V value)
put in interface Map<K,V>public V remove(Object key)
remove in interface Map<K,V>public void putAll(Map<? extends K,? extends V> map)
putAll in interface Map<K,V>public void clear()
clear in interface Map<K,V>public Set<K> keySet()
keySet in interface Map<K,V>public Set<Map.Entry<K,V>> entrySet()
entrySet in interface Map<K,V>public Collection<V> values()
values in interface Map<K,V>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||