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 TypeMethodDescriptionvoid
clear()
Clears the contents of the cache.Gets an entry from the cache.boolean
isEmpty()
Returnstrue
if this cache contains no key-value mappings.keySet()
Returns a Set view of the keys contained in this cache.void
Associates the specified value with the specified key in the cache.void
Removes an entry from the cache.int
size()
-
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 isnull
or 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()Returnstrue
if this cache contains no key-value mappings.
-