Package edu.wisc.library.ocfl.core.cache
Class CaffeineCache<K,V>
- java.lang.Object
-
- edu.wisc.library.ocfl.core.cache.CaffeineCache<K,V>
-
-
Constructor Summary
Constructors Constructor Description CaffeineCache(com.github.benmanes.caffeine.cache.Cache cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(K key)Returns true if the cache contains the specified keyVget(K key, Function<K,V> loader)Retrieves a value from the cache.voidinvalidate(K key)Invalidates the key in the cache.voidinvalidateAll()Invalidates the entire cachevoidput(K key, V value)Inserts a value into the cache.
-
-
-
Method Detail
-
get
public V get(K key, Function<K,V> loader)
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.
-
invalidate
public void invalidate(K key)
Invalidates the key in the cache.- Specified by:
invalidatein interfaceCache<K,V>- Parameters:
key- key
-
invalidateAll
public void invalidateAll()
Invalidates the entire cache- Specified by:
invalidateAllin interfaceCache<K,V>
-
-