Package com.google.common.graph
Class MapRetrievalCache<K,V>
- java.lang.Object
-
- com.google.common.graph.MapIteratorCache<K,V>
-
- com.google.common.graph.MapRetrievalCache<K,V>
-
class MapRetrievalCache<K,V> extends MapIteratorCache<K,V>
AMapIteratorCachethat adds additional caching. In addition to the caching provided byMapIteratorCache, this structure caches values for the two most recently retrieved keys.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classMapRetrievalCache.CacheEntry<K,V>
-
Field Summary
Fields Modifier and Type Field Description private MapRetrievalCache.CacheEntry<K,V>cacheEntry1private MapRetrievalCache.CacheEntry<K,V>cacheEntry2
-
Constructor Summary
Constructors Constructor Description MapRetrievalCache(java.util.Map<K,V> backingMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddToCache(MapRetrievalCache.CacheEntry<K,V> entry)private voidaddToCache(K key, V value)protected voidclearCache()Vget(java.lang.Object key)protected VgetIfCached(java.lang.Object key)-
Methods inherited from class com.google.common.graph.MapIteratorCache
clear, containsKey, getWithoutCaching, put, remove, unmodifiableKeySet
-
-
-
-
Field Detail
-
cacheEntry1
private transient volatile MapRetrievalCache.CacheEntry<K,V> cacheEntry1
-
cacheEntry2
private transient volatile MapRetrievalCache.CacheEntry<K,V> cacheEntry2
-
-
Method Detail
-
get
public V get(java.lang.Object key)
- Overrides:
getin classMapIteratorCache<K,V>
-
getIfCached
protected V getIfCached(java.lang.Object key)
- Overrides:
getIfCachedin classMapIteratorCache<K,V>
-
clearCache
protected void clearCache()
- Overrides:
clearCachein classMapIteratorCache<K,V>
-
addToCache
private void addToCache(MapRetrievalCache.CacheEntry<K,V> entry)
-
-