Package org.eclipse.rdf4j.sail.lmdb
Class ConcurrentCache<K,V>
- java.lang.Object
-
- org.eclipse.rdf4j.sail.lmdb.ConcurrentCache<K,V>
-
public class ConcurrentCache<K,V> extends Object
Limited-size concurrent cache. The actual cleanup to keep the size limited is done once perCLEANUP_INTERVAL
invocations of the protected methodcleanUp
.cleanUp
method is called every time byput
The maximum size is maintained approximately. Cleanup is not done if size is less thancapacity + CLEANUP_INTERVAL / 2
.
-
-
Field Summary
Fields Modifier and Type Field Description protected ConcurrentHashMap<K,V>
cache
-
Constructor Summary
Constructors Constructor Description ConcurrentCache(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
cleanUp()
void
clear()
V
get(Object key)
protected boolean
onEntryRemoval(K key)
V
put(K key, V value)
-
-
-
Field Detail
-
cache
protected final ConcurrentHashMap<K,V> cache
-
-
Method Detail
-
clear
public void clear()
-
onEntryRemoval
protected boolean onEntryRemoval(K key)
- Parameters:
key
- the key of the node to test for removal and do finalization on- Returns:
- true if removal is approved
-
cleanUp
protected void cleanUp()
-
-