org.apache.stratos.lb.common.cache
Class LRUCache<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.apache.stratos.lb.common.cache.LRUCache<K,V>
- All Implemented Interfaces:
- Serializable, Cloneable, Map<K,V>
public class LRUCache<K,V>
- extends LinkedHashMap<K,V>
A simple, thread-safe LRU cache implementation. This cache allows concurrent reads.
Concurrent write attempts are synchronized using an exclusive lock.
- See Also:
- Serialized Form
|
Constructor Summary |
LRUCache(int maxEntries)
|
LRUCache
public LRUCache(int maxEntries)
get
public V get(Object key)
- Specified by:
get in interface Map<K,V>- Overrides:
get in class LinkedHashMap<K,V>
put
public V put(K key,
V value)
- Specified by:
put in interface Map<K,V>- Overrides:
put in class HashMap<K,V>
remove
public V remove(Object key)
- Specified by:
remove in interface Map<K,V>- Overrides:
remove in class HashMap<K,V>
clear
public void clear()
- Specified by:
clear in interface Map<K,V>- Overrides:
clear in class LinkedHashMap<K,V>
removeEldestEntry
protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
- Overrides:
removeEldestEntry in class LinkedHashMap<K,V>
handleRemovableEntry
protected void handleRemovableEntry(Map.Entry<K,V> entry)
exclusiveLock
public void exclusiveLock()
release
public void release()
Copyright © 2013 The Apache Software Foundation. All Rights Reserved.