Package net.sourceforge.jtds.jdbc.cache
Class SimpleLRUCache<K,V>
- java.lang.Object
-
- net.sourceforge.jtds.jdbc.cache.SimpleLRUCache<K,V>
-
public class SimpleLRUCache<K,V> extends java.lang.ObjectSimple LRU cache for any type of object, based on a
LinkedHashMapwith a maximum size.- Author:
- Holger Rehn
-
-
Constructor Summary
Constructors Constructor Description SimpleLRUCache(int limit)Constructs a new LRU cache with a limited capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vget(K key)Get the value associated with the given key, if any.Vput(K key, V value)Updates the LRU cache by adding a new entry.
-
-
-
Method Detail
-
put
public V put(K key, V value)
Updates the LRU cache by adding a new entry.
- Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Returns:
- previous value associated with key or
nullif there was no mapping for key; anullvalue can also indicate that the cache previously associatednullwith the specified key - See Also:
Map.put(Object,Object)
-
-