Package org.fcrepo.storage.ocfl.cache
Interface Cache<K,V>
-
- Type Parameters:
K- type of cache keyV- type of cache value
- All Known Implementing Classes:
CaffeineCache,NoOpCache
public interface Cache<K,V>Cache interface- Author:
- pwinckles
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Vget(K key, Function<K,V> loader)Retrieves a value from the cache.voidinvalidate(K key)Invalidates the key in the cache.voidput(K key, V value)Inserts a value into the cache.
-
-
-
Method Detail
-
get
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.- Parameters:
key- to lookup in the cacheloader- function to call to load the object if it's not found- Returns:
- the object that maps to the key
-
invalidate
void invalidate(K key)
Invalidates the key in the cache.- Parameters:
key- key
-
-