Package org.keycloak.cache
Interface LocalCache<K,V>
- Type Parameters:
K- the type of the cache Keys used for lookupV- the type of the cache Values to be stored
- All Superinterfaces:
AutoCloseable
A
LocalCache should be used when a local, non-clustered, cache is required to optimise data access.-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes all resources associated with the cache.Returns the value associated with thekey, ornullif there is no cached value for thekey.voidinvalidate(K key) Removes the cached value for the specifiedkey.voidAssociates the value with the key in this cache.
-
Method Details
-
get
Returns the value associated with thekey, ornullif there is no cached value for thekey.- Parameters:
key- the key whose associated value is to be returned- Returns:
- the value associated with the specified key or
nullif no value exists - Throws:
NullPointerException- if the specified key is null
-
put
Associates the value with the key in this cache. If the cache previously contained a value associated with the key, the old value is replaced by the new value.- Parameters:
key- the key with which the specified value is to be associatedvalue- value to be associated with the specified key- Throws:
NullPointerException- if the specified key or value is null
-
invalidate
Removes the cached value for the specifiedkey.- Parameters:
key- the key whose mapping is to be removed from the cache- Throws:
NullPointerException- if the specified key is null
-
close
void close()Closes all resources associated with the cache.- Specified by:
closein interfaceAutoCloseable
-