Package com.inrupt.client.guava
Class GuavaCache<T,U>
java.lang.Object
com.inrupt.client.guava.GuavaCache<T,U>
- Type Parameters:
T- the key typeU- the value type
- All Implemented Interfaces:
ClientCache<T,U>
A cache implementation using Guava.
-
Constructor Summary
ConstructorsConstructorDescriptionGuavaCache(com.google.common.cache.Cache<T, U> cache) Wrap an existing guavaCache. -
Method Summary
Modifier and TypeMethodDescriptionRetrieve a cached value.voidinvalidate(T key) Invalidate a single cached value.voidInvalidate all values in the cache.voidSet a cached value.
-
Constructor Details
-
GuavaCache
Wrap an existing guavaCache.- Parameters:
cache- the guava cache
-
-
Method Details
-
get
Description copied from interface:ClientCacheRetrieve a cached value.- Specified by:
getin interfaceClientCache<T,U> - Parameters:
key- the key- Returns:
- the cached value, may be
nullif not present
-
put
Description copied from interface:ClientCacheSet a cached value.- Specified by:
putin interfaceClientCache<T,U> - Parameters:
key- the key, notnullvalue- the value, notnull
-
invalidate
Description copied from interface:ClientCacheInvalidate a single cached value.- Specified by:
invalidatein interfaceClientCache<T,U> - Parameters:
key- the key, notnull
-
invalidateAll
public void invalidateAll()Description copied from interface:ClientCacheInvalidate all values in the cache.- Specified by:
invalidateAllin interfaceClientCache<T,U>
-