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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclear()Clears the contents of the cache.Vget(K key)Gets an entry from the cache.booleanisEmpty()Returnstrueif this cache contains no key-value mappings.java.util.Set<K>keySet()Returns a Set view of the keys contained in this cache.voidput(K key, V value)Associates the specified value with the specified key in the cache.voidremove(K key)Removes an entry from the cache.intsize()
-
-
-
Method Detail
-
get
V get(K key)
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
void put(K key, V value)
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:
java.lang.NullPointerException- if key isnullor if value isnull
-
clear
void clear()
Clears the contents of the cache.
-
remove
void remove(K key)
Removes an entry from the cache.- Parameters:
key- key with which the specified value is to be associated.
-
keySet
java.util.Set<K> 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.
-
-