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.voidinvalidate(T key) Invalidate a single cached value.voidInvalidate all values in the cache.voidSet a cached value.
-
Constructor Details
-
CaffeineCache
Wrap an existing caffeineCache.- Parameters:
cache- the caffeine 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>
-