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>
-
final class MapRetrievalCache<K,V> extends MapIteratorCache<K,V>
AMapIteratorCache
that 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 class
MapRetrievalCache.CacheEntry<K,V>
-
Field Summary
Fields Modifier and Type Field Description private MapRetrievalCache.CacheEntry<K,V>
cacheEntry1
private 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 void
addToCache(MapRetrievalCache.CacheEntry<K,V> entry)
private void
addToCache(K key, V value)
(package private) void
clearCache()
(package private) V
get(java.lang.Object key)
(package private) V
getIfCached(java.lang.Object key)
-
Methods inherited from class com.google.common.graph.MapIteratorCache
clear, containsKey, getWithoutCaching, put, remove, unmodifiableKeySet
-
-
-
-
Field Detail
-
cacheEntry1
@CheckForNull private transient volatile MapRetrievalCache.CacheEntry<K,V> cacheEntry1
-
cacheEntry2
@CheckForNull private transient volatile MapRetrievalCache.CacheEntry<K,V> cacheEntry2
-
-
Method Detail
-
get
@CheckForNull V get(java.lang.Object key)
- Overrides:
get
in classMapIteratorCache<K,V>
-
getIfCached
@CheckForNull V getIfCached(@CheckForNull java.lang.Object key)
- Overrides:
getIfCached
in classMapIteratorCache<K,V>
-
clearCache
void clearCache()
- Overrides:
clearCache
in classMapIteratorCache<K,V>
-
addToCache
private void addToCache(MapRetrievalCache.CacheEntry<K,V> entry)
-
-