class MapRetrievalCache<K,V> extends MapIteratorCache<K,V>
MapIteratorCache
that adds additional caching. In addition to the caching provided by
MapIteratorCache
, this structure caches values for the two most recently retrieved keys.Modifier and Type | Class and Description |
---|---|
private static class |
MapRetrievalCache.CacheEntry<K,V> |
Modifier and Type | Field and Description |
---|---|
private MapRetrievalCache.CacheEntry<K,V> |
cacheEntry1 |
private MapRetrievalCache.CacheEntry<K,V> |
cacheEntry2 |
Constructor and Description |
---|
MapRetrievalCache(java.util.Map<K,V> backingMap) |
Modifier and Type | Method and Description |
---|---|
private void |
addToCache(K key,
V value) |
private void |
addToCache(MapRetrievalCache.CacheEntry<K,V> entry) |
protected void |
clearCache() |
V |
get(java.lang.Object key) |
protected V |
getIfCached(java.lang.Object key) |
clear, containsKey, getWithoutCaching, put, remove, unmodifiableKeySet
private transient MapRetrievalCache.CacheEntry<K,V> cacheEntry1
private transient MapRetrievalCache.CacheEntry<K,V> cacheEntry2
public V get(java.lang.Object key)
get
in class MapIteratorCache<K,V>
protected V getIfCached(java.lang.Object key)
getIfCached
in class MapIteratorCache<K,V>
protected void clearCache()
clearCache
in class MapIteratorCache<K,V>
private void addToCache(MapRetrievalCache.CacheEntry<K,V> entry)