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.void
invalidate
(T key) Invalidate a single cached value.void
Invalidate all values in the cache.void
Set a cached value.
-
Constructor Details
-
GuavaCache
Wrap an existing guavaCache
.- Parameters:
cache
- the guava cache
-
-
Method Details
-
get
Description copied from interface:ClientCache
Retrieve a cached value.- Specified by:
get
in interfaceClientCache<T,
U> - Parameters:
key
- the key- Returns:
- the cached value, may be
null
if not present
-
put
Description copied from interface:ClientCache
Set a cached value.- Specified by:
put
in interfaceClientCache<T,
U> - Parameters:
key
- the key, notnull
value
- the value, notnull
-
invalidate
Description copied from interface:ClientCache
Invalidate a single cached value.- Specified by:
invalidate
in interfaceClientCache<T,
U> - Parameters:
key
- the key, notnull
-
invalidateAll
public void invalidateAll()Description copied from interface:ClientCache
Invalidate all values in the cache.- Specified by:
invalidateAll
in interfaceClientCache<T,
U>
-