public class LRUMap<K,V> extends java.lang.Object implements LookupCache<K,V>, java.io.Serializable
Note that serialization behavior is such that contents are NOT serialized, on assumption that all use cases are for caching where persistence does not make sense. The only thing serialized is the cache size of Map.
Since Jackson 2.12, there has been pluggable LookupCache interface which
allows users, frameworks, provide their own cache implementations.
Since Jackson 2.14, the implementation
| Constructor and Description |
|---|
LRUMap(int initialEntries,
int maxEntries) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Method for removing all contents this cache has.
|
void |
contents(java.util.function.BiConsumer<K,V> consumer)
Method to apply operation on cache contents without exposing them.
|
LookupCache<K,V> |
emptyCopy()
Method needed for creating clones but without contents.
|
V |
get(java.lang.Object key)
NOTE: key is of type Object only to retain binary backwards-compatibility
|
V |
put(K key,
V value) |
V |
putIfAbsent(K key,
V value) |
int |
size() |
public LookupCache<K,V> emptyCopy()
LookupCache
Default implementation throws UnsupportedOperationException.
Implementations are required to override this method.
emptyCopy in interface LookupCache<K,V>public V putIfAbsent(K key, V value)
putIfAbsent in interface LookupCache<K,V>public V get(java.lang.Object key)
LookupCacheget in interface LookupCache<K,V>public void clear()
LookupCacheclear in interface LookupCache<K,V>public int size()
size in interface LookupCache<K,V>public void contents(java.util.function.BiConsumer<K,V> consumer)
LookupCache
Default implementation throws UnsupportedOperationException.
Implementations are required to override this method.
contents in interface LookupCache<K,V>consumer - Operation to apply on cache contents.Copyright © 2010 - 2024 Adobe. All Rights Reserved