Package org.camunda.commons.utils.cache
Interface Cache<K,V>
- Type Parameters:
K- the type of keysV- the type of mapped values
- All Known Implementing Classes:
ConcurrentLruCache
public interface Cache<K,V>
A Map-like data structure that stores key-value pairs and provides temporary
access to it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the contents of the cache.Gets an entry from the cache.booleanisEmpty()Returnstrueif this cache contains no key-value mappings.keySet()Returns a Set view of the keys contained in this cache.voidAssociates the specified value with the specified key in the cache.voidRemoves an entry from the cache.intsize()
-
Method Details
-
get
Gets an entry from the cache.- Parameters:
key- the key whose associated value is to be returned- Returns:
- the element, or
null, if it does not exist.
-
put
Associates the specified value with the specified key in the cache.- Parameters:
key- key with which the specified value is to be associatedvalue- value to be associated with the specified key- Throws:
NullPointerException- if key isnullor if value isnull
-
clear
void clear()Clears the contents of the cache. -
remove
Removes an entry from the cache.- Parameters:
key- key with which the specified value is to be associated.
-
keySet
Returns a Set view of the keys contained in this cache. -
size
int size()- Returns:
- the current size of the cache
-
isEmpty
boolean isEmpty()Returnstrueif this cache contains no key-value mappings.
-