Class Cache<K,V extends Cache.Value>
- java.lang.Object
-
- org.apache.jackrabbit.oak.commons.cache.Cache<K,V>
-
public class Cache<K,V extends Cache.Value> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceCache.Backend<K,V>A cache backend that can load objects from persistent storage.static interfaceCache.ValueA cacheable object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Vget(K key)intgetMemoryMax()intgetMemoryUsed()static <K,V extends Cache.Value>
Cache<K,V>newInstance(Cache.Backend<K,V> backend, int maxMemoryBytes)voidput(K key, V value)Vreplace(K key, V value)Get the element in the cache if one exists, or add it to the cache if not.intsize()
-
-
-
Method Detail
-
replace
public V replace(K key, V value)
Get the element in the cache if one exists, or add it to the cache if not.- Parameters:
key- the keyvalue- the value- Returns:
- the cached element
-
newInstance
public static <K,V extends Cache.Value> Cache<K,V> newInstance(Cache.Backend<K,V> backend, int maxMemoryBytes)
-
clear
public void clear()
-
size
public int size()
-
getMemoryUsed
public int getMemoryUsed()
-
getMemoryMax
public int getMemoryMax()
-
-