public class LRUMap<K,V> extends Object implements LookupCache<K,V>, 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.
Snce Jackson 2.14, the implementation
Modifier and Type | Field and Description |
---|---|
protected int |
_initialEntries |
protected PrivateMaxEntriesMap<K,V> |
_map |
protected int |
_maxEntries |
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(BiConsumer<K,V> consumer) |
V |
get(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) |
protected Object |
readResolve() |
int |
size() |
protected final int _initialEntries
protected final int _maxEntries
protected final transient PrivateMaxEntriesMap<K,V> _map
public V putIfAbsent(K key, V value)
putIfAbsent
in interface LookupCache<K,V>
public V get(Object key)
LookupCache
get
in interface LookupCache<K,V>
public void clear()
LookupCache
clear
in interface LookupCache<K,V>
public int size()
size
in interface LookupCache<K,V>
public void contents(BiConsumer<K,V> consumer)
protected Object readResolve()
Copyright © 2008–2023 FasterXML. All rights reserved.