Package io.ocfl.core.cache
Class CaffeineCache<K,V>
java.lang.Object
io.ocfl.core.cache.CaffeineCache<K,V>
- All Implemented Interfaces:
Cache<K,
V>
In-memory cache implementation that is a wrapper around a Caffeine cache.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if the cache contains the specified keyRetrieves a value from the cache.void
invalidate
(K key) Invalidates the key in the cache.void
Invalidates the entire cachevoid
Inserts a value into the cache.
-
Constructor Details
-
CaffeineCache
public CaffeineCache(com.github.benmanes.caffeine.cache.Cache cache)
-
-
Method Details
-
get
Retrieves a value from the cache. If it doesn't exist, the loader is called to load the object, which is then cached and returned. -
put
Inserts a value into the cache. -
invalidate
Invalidates the key in the cache.- Specified by:
invalidate
in interfaceCache<K,
V> - Parameters:
key
- key
-
invalidateAll
public void invalidateAll()Invalidates the entire cache- Specified by:
invalidateAll
in interfaceCache<K,
V>
-
contains
Returns true if the cache contains the specified key
-