Package com.inrupt.client.caffeine
Class CaffeineCache<T,U>
java.lang.Object
com.inrupt.client.caffeine.CaffeineCache<T,U>
- Type Parameters:
T
- the key typeU
- the value type
- All Implemented Interfaces:
ClientCache<T,
U>
A cache implementation using Caffeine.
-
Constructor Summary
ConstructorsConstructorDescriptionCaffeineCache
(com.github.benmanes.caffeine.cache.Cache<T, U> cache) Wrap an existing caffeineCache
. -
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
-
CaffeineCache
Wrap an existing caffeineCache
.- Parameters:
cache
- the caffeine 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>
-