Package org.cyclos.impl.utils
Class GuavaStorage<K,V,R extends BiPredicate<K,V>>
- java.lang.Object
-
- org.cyclos.impl.utils.GuavaStorage<K,V,R>
-
- All Implemented Interfaces:
ExpirableStorage<K,V,R>,Storage<K,V>
- Direct Known Subclasses:
GuavaLocalStorage,GuavaSharedStorage
public abstract class GuavaStorage<K,V,R extends BiPredicate<K,V>> extends Object implements ExpirableStorage<K,V,R>
AExpirableStorageimplementation using a Guava cache
-
-
Constructor Summary
Constructors Constructor Description GuavaStorage(StorageType<K,V> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all keysVget(K key)Returns the value associated with the given key, or null if not present.Set<K>keys(R test)Returns all keys that match the given predicateprotected voidonRemove(K key, V value)voidremove(K key)Removes the given key.voidremoveAll(Collection<K> keys)Removes all the given keys.voidremoveIf(R test)Removes all the values that matches against the given predicatevoidset(K key, V value)Adds a value to the store
-
-
-
Field Detail
-
type
protected final StorageType<K,V> type
-
-
Constructor Detail
-
GuavaStorage
public GuavaStorage(StorageType<K,V> type)
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:StorageRemoves all keys
-
get
public V get(K key)
Description copied from interface:StorageReturns the value associated with the given key, or null if not present.
-
keys
public Set<K> keys(R test)
Description copied from interface:ExpirableStorageReturns all keys that match the given predicate- Specified by:
keysin interfaceExpirableStorage<K,V,R extends BiPredicate<K,V>>
-
removeAll
public void removeAll(Collection<K> keys)
Description copied from interface:StorageRemoves all the given keys.
-
removeIf
public void removeIf(R test)
Description copied from interface:ExpirableStorageRemoves all the values that matches against the given predicate- Specified by:
removeIfin interfaceExpirableStorage<K,V,R extends BiPredicate<K,V>>
-
set
public void set(K key, V value)
Description copied from interface:StorageAdds a value to the store
-
-