Package com._1c.g5.v8.xmdb.impl
Class SLRUCacheMT<K,V>
java.lang.Object
com._1c.g5.v8.xmdb.impl.SLRUCacheMT<K,V>
Multithread SLRU cache implementation
-
Constructor Summary
ConstructorsConstructorDescriptionSLRUCacheMT
(int pSize, int tSize, boolean processEvict, boolean threadSafe) Cache constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear (drop) cacheentrySet()
Get entry set of all values from cacheprotected void
Evict process implementation.void
evictAll()
Evict all values from cacheGet value by keyRemove specified key from cacheRemove all values from cache and return itint
size()
Get total number of values in cachetoString()
-
Constructor Details
-
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 Details
-
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
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
-
get
Get value by key- Parameters:
key
- the key- Returns:
- value or null
-
put
-
remove
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
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
-
toString
-