Package com._1c.g5.v8.xmdb.impl
Class SLRUCacheMT<K,V>
- java.lang.Object
-
- com._1c.g5.v8.xmdb.impl.SLRUCacheMT<K,V>
-
public class SLRUCacheMT<K,V> extends Object
Multithread SLRU cache implementation
-
-
Constructor Summary
Constructors Constructor Description SLRUCacheMT(int pSize, int tSize, boolean processEvict, boolean threadSafe)
Cache constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear (drop) cacheSet<Map.Entry<K,V>>
entrySet()
Get entry set of all values from cacheprotected void
evict(K key, V value)
Evict process implementation.void
evictAll()
Evict all values from cacheV
get(K key)
Get value by keyV
put(K key, V value)
V
remove(K key)
Remove specified key from cacheMap<K,V>
removeAll()
Remove all values from cache and return itint
size()
Get total number of values in cacheString
toString()
-
-
-
Constructor Detail
-
SLRUCacheMT
public SLRUCacheMT(int pSize, int tSize, boolean processEvict, boolean threadSafe)
Cache constructor- Parameters:
pSize
- size of "protected" buffer of SLRU cachetSize
- size of "test" buffer of SLRU cacheprocessEvict
- need to call external evict methods while evicting values from cachethreadSafe
- need to be a thread save cache
-
-
Method Detail
-
entrySet
public Set<Map.Entry<K,V>> entrySet()
Get entry set of all values from cache- Returns:
- set of all values from cache
-
evictAll
public void evictAll()
Evict all values from cache
-
removeAll
public Map<K,V> removeAll()
Remove all values from cache and return it- Returns:
- all key/value pair, removed from cache
-
clear
public void clear()
Clear (drop) cache
-
size
public int size()
Get total number of values in cache- Returns:
- the number of values in cache
-
remove
public V remove(K key)
Remove specified key from cache- Parameters:
key
- the key to remove- Returns:
- assotiated with removed key value or null (if value == null or specified key wasn't found in cache)
-
evict
protected void evict(K key, V value)
Evict process implementation. Specified key/value pair steel be available in cache untill evict process finished. Evict should be thread save. Evict can't be called from the same key in different threads in same time.- Parameters:
key
- evicting keyvalue
- evicting valut
-
-