Package org.cyclos.impl.utils
Class GuavaLocalStorage<K,V>
- java.lang.Object
-
- org.cyclos.impl.utils.GuavaStorage<K,V,BiPredicate<K,V>>
-
- org.cyclos.impl.utils.GuavaLocalStorage<K,V>
-
- All Implemented Interfaces:
ExpirableStorage<K,V,BiPredicate<K,V>>,LocalStorage<K,V>,Storage<K,V>
public class GuavaLocalStorage<K,V> extends GuavaStorage<K,V,BiPredicate<K,V>> implements LocalStorage<K,V>
AExpirableStorageimplementation using a Guava cache
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.utils.GuavaStorage
cache, type
-
-
Constructor Summary
Constructors Constructor Description GuavaLocalStorage(LocalStorageType<K,V> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRemoveListener(BiConsumer<K,V> listener)Adds a listener called whenever a value is removedVget(K key, Callable<V> producer)Returns the value associated with the given key, or producing a new one if none exists.protected voidonRemove(K key, V value)-
Methods inherited from class org.cyclos.impl.utils.GuavaStorage
clear, get, keys, remove, removeAll, removeIf, set
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.impl.utils.ExpirableStorage
keys, removeIf
-
-
-
-
Constructor Detail
-
GuavaLocalStorage
public GuavaLocalStorage(LocalStorageType<K,V> type)
-
-
Method Detail
-
addRemoveListener
public void addRemoveListener(BiConsumer<K,V> listener)
Description copied from interface:LocalStorageAdds a listener called whenever a value is removed- Specified by:
addRemoveListenerin interfaceLocalStorage<K,V>
-
get
public V get(K key, Callable<V> producer)
Description copied from interface:LocalStorageReturns the value associated with the given key, or producing a new one if none exists.- Specified by:
getin interfaceLocalStorage<K,V>
-
onRemove
protected void onRemove(K key, V value)
- Overrides:
onRemovein classGuavaStorage<K,V,BiPredicate<K,V>>
-
-