CacheBuilder.
This implementation is heavily derived from revision 1.96 of ConcurrentHashMap.java.
com.google.common.collect.MapMaker), Doug Lea (ConcurrentHashMap)
| Modifier and Type | Class and Description |
|---|---|
| pack-priv abstract class | |
| pack-priv abstract static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static enum | LocalCache.EntryFactory
Creates new entries. |
| pack-priv class | |
| pack-priv class | |
| pack-priv abstract class | |
| pack-priv class | |
| pack-priv class | |
| pack-priv static class | LocalCache.LoadingSerializationProxy<K, V>
Serializes the configuration of a LocalCache, reconstituting it as an LoadingCache using CacheBuilder upon deserialization. |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | LocalCache.ManualSerializationProxy<K, V>
Serializes the configuration of a LocalCache, reconstituting it as a Cache using CacheBuilder upon deserialization. |
| private static enum | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static enum | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv class | |
| pack-priv static interface | |
| pack-priv class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv class | LocalCache.WriteThroughEntry
Custom Entry class used by EntryIterator.next(), that relays setValue changes to the underlying map. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final int | concurrencyLevel
The concurrency level. |
| pack-priv static final int | CONTAINS_VALUE_RETRIES
Number of (unsynchronized) retries in the containsValue method. |
| pack-priv final CacheLoader | defaultLoader
The default cache loader to use on loading operations. |
| pack-priv static final Queue | |
| pack-priv static final int | DRAIN_MAX
Maximum number of entries to be drained in a single cleanup run. |
| pack-priv static final int | DRAIN_THRESHOLD
Number of cache access operations that can be buffered per segment before the cache's recency ordering information is updated. |
| pack-priv final LocalCache. | entryFactory
Factory used to create new entries. |
| pack-priv Set | |
| pack-priv final long | expireAfterAccessNanos
How long after the last access to an entry the map will retain that entry. |
| pack-priv final long | expireAfterWriteNanos
How long after the last write to an entry the map will retain that entry. |
| pack-priv final AbstractCache. | globalStatsCounter
Accumulates global cache statistics. |
| pack-priv final Equivalence | keyEquivalence
Strategy for comparing keys. |
| pack-priv Set | |
| pack-priv final LocalCache. | keyStrength
Strategy for referencing keys. |
| pack-priv static final Logger | |
| pack-priv static final int | MAX_SEGMENTS
The maximum number of segments to allow; used to bound constructor arguments. |
| pack-priv static final int | MAXIMUM_CAPACITY
The maximum capacity, used if a higher value is implicitly specified by either of the constructors with arguments. |
| pack-priv final long | maxWeight
The maximum weight of this map. |
| pack-priv final long | refreshNanos
How long after the last write an entry becomes a candidate for refresh. |
| pack-priv final RemovalListener | removalListener
A listener that is invoked when an entry is removed due to expiration or garbage collection of soft/weak entries. |
| pack-priv final Queue | removalNotificationQueue
Entries waiting to be consumed by the removal listener. |
| pack-priv final int | segmentMask
Mask value for indexing into segments. |
| pack-priv final LocalCache. | segments
The segments, each of which is a specialized hash table. |
| pack-priv final int | segmentShift
Shift value for indexing within segments. |
| pack-priv final Ticker | ticker
Measures time in a testable way. |
| pack-priv static final LocalCache. | UNSET
Placeholder. |
| pack-priv final Equivalence | valueEquivalence
Strategy for comparing values. |
| pack-priv Collection | |
| pack-priv final LocalCache. | valueStrength
Strategy for referencing values. |
| pack-priv final Weigher | weigher
Weigher to weigh cache entries. |
| Access | Constructor and Description |
|---|---|
| pack-priv | LocalCache(CacheBuilder<? super K, ? super V> builder, CacheLoader<? super K, V> loader)
Creates a new, empty map with the specified strategy, initial capacity and concurrency level. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | clear()
Overrides java. Implements java. |
| public V | compute(K
key with which the specified value is to be associated key, BiFunction<? super K, ? super @Nullable V, ? extends V> the remapping function to compute a value function)Overrides default java. null if there is no current mapping).
|
| public V | computeIfAbsent(K
key with which the specified value is to be associated key, Function<? super K, ? extends V> the mapping function to compute a value function)Overrides default java. null), attempts to compute its value using the given mapping
function and enters it into this map unless null.
|
| public V | computeIfPresent(K
key with which the specified value is to be associated key, BiFunction<? super K, ? super V, ? extends V> the remapping function to compute a value function)Overrides default java. |
| pack-priv static <K, V> void | |
| pack-priv static <K, V> void | |
| public boolean | containsKey(Object
key whose presence in this map is to be tested key)Overrides java. Implements java. true if this map contains a mapping for the specified
key.
|
| public boolean | containsValue(Object
value whose presence in this map is to be tested value)Overrides java. Implements java. true if this map maps one or more keys to the
specified value.
|
| pack-priv ReferenceEntry | copyEntry(ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext)
This method is a convenience for testing. |
| pack-priv LocalCache. | |
| pack-priv boolean | |
| pack-priv static <E> Queue | |
| public Set | entrySet()
Implements abstract java. Implements java. Set view of the mappings contained in this map.
|
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| public V | get(Object
the key whose associated value is to be returned key)Overrides java. Implements java. null if this map contains no mapping for the key.
|
| pack-priv V | |
| pack-priv ImmutableMap | |
| pack-priv ImmutableMap | |
| pack-priv ReferenceEntry | |
| public V | |
| pack-priv V | |
| public V | getOrDefault(Object
the key whose associated value is to be returned key, V the default mapping of the key defaultValue)Overrides default java. defaultValue if this map contains no mapping for the key.
|
| pack-priv V | |
| pack-priv int | |
| pack-priv void | |
| public boolean | isEmpty()
Overrides java. Implements java. true if this map contains no key-value mappings.
|
| pack-priv boolean | |
| pack-priv boolean | |
| public Set | keySet()
Overrides java. Implements java. Set view of the keys contained in this map.
|
| pack-priv Map | loadAll(Set<? extends K> keys, CacheLoader<? super K, V> loader)
Returns the result of calling |
| pack-priv long | |
| public V | merge(K
key with which the resulting value is to be associated key, V the non-null value to be merged with the existing value
associated with the key or, if no existing value or a null value
is associated with the key, to be associated with the key newValue, BiFunction<? super V, ? super V, ? extends @Nullable V> the remapping function to recompute a value if
present function)Overrides default java. |
| pack-priv ReferenceEntry | |
| pack-priv final LocalCache. | |
| pack-priv LocalCache. | newValueReference(ReferenceEntry<K, V> entry, V value, int weight)
This method is a convenience for testing. |
| pack-priv static <K, V> ReferenceEntry | |
| pack-priv static <K, V> void | |
| pack-priv static <K, V> void | |
| pack-priv void | processPendingNotifications()
Notifies listeners that an entry has been automatically removed due to expiration, eviction, or eligibility for garbage collection. |
| public V | put(K
key with which the specified value is to be associated key, V value to be associated with the specified key value)Overrides java. Implements java. |
| public void | putAll(Map<? extends K, ? extends V>
mappings to be stored in this map m)Overrides java. Implements java. |
| public V | putIfAbsent(K
key with which the specified value is to be associated key, V value to be associated with the specified key value)Overrides default java. Implements java. |
| pack-priv void | |
| pack-priv void | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv void | |
| pack-priv boolean | |
| pack-priv static int | rehash(int
hash code h)Applies a supplemental hash function to a given hash code, which defends against poor quality hash functions. |
| public V | remove(Object
key whose mapping is to be removed from the map key)Overrides java. Implements java. |
| public boolean | remove(Object
key with which the specified value is associated key, Object value expected to be associated with the specified key value)Overrides default java. Implements java. |
| pack-priv boolean | |
| public boolean | replace(K
key with which the specified value is associated key, V value expected to be associated with the specified key oldValue, V value to be associated with the specified key newValue)Overrides default java. Implements java. |
| public V | replace(K
key with which the specified value is associated key, V value to be associated with the specified key value)Overrides default java. Implements java. |
| pack-priv LocalCache. | Returns: the segmentthe hash code for the key hash)Returns the segment that should be used for a key with the given hash. |
| public int | size()
Overrides java. Implements java. |
| private static <E> ArrayList | |
| pack-priv static <K, V> LocalCache. | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| public Collection | values()
Overrides java. Implements java. Collection view of the values contained in this map.
|