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
Modifier and TypeMethodDescriptionRetrieves a value from the cache.voidinvalidate(K key) Invalidates the key in the cache.voidInvalidate the entire cache.voidinvalidateAll(Iterable<K> keys) Invalidates the keys provided in the cache.voidInserts a value into the 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.- 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
-
put
Inserts a value into the cache.- Parameters:
key- keyvalue- value
-
invalidate
Invalidates the key in the cache.- Parameters:
key- key
-
invalidateAll
Invalidates the keys provided in the cache.- Parameters:
keys- the keys.
-
invalidateAll
void invalidateAll()Invalidate the entire cache.
-