Package com.strobel.collections
Class SatelliteCache<K,V>
- java.lang.Object
-
- com.strobel.collections.Cache<K,V>
-
- com.strobel.collections.SatelliteCache<K,V>
-
final class SatelliteCache<K,V> extends Cache<K,V>
-
-
Constructor Summary
Constructors Constructor Description SatelliteCache()
SatelliteCache(Cache<K,V> parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
cache(K key, V value)
Places a value in the cache only if no value exists with the same key.V
get(K key)
Gets the value associated with the given key.Cache<K,V>
getSatelliteCache()
Returns a thread-specific satellite cache chained to this cache.boolean
replace(K key, V expectedValue, V updatedValue)
Replaces the value associated with a given key if the current value matches the expected value.-
Methods inherited from class com.strobel.collections.Cache
contains, contains, createSatelliteCache, createSatelliteCache, createSatelliteIdentityCache, createSatelliteIdentityCache, createThreadLocalCache, createThreadLocalCache, createThreadLocalIdentityCache, createThreadLocalIdentityCache, createTopLevelCache
-
-
-
-
Method Detail
-
getSatelliteCache
public Cache<K,V> getSatelliteCache()
Description copied from class:Cache
Returns a thread-specific satellite cache chained to this cache. If the target cache is already a satellite cache, it will simply return itself. Note that the returned cache is completely unsynchronized and is not safe for concurrent access.- Specified by:
getSatelliteCache
in classCache<K,V>
- Returns:
- A thread-specific satellite cache.
-
replace
public boolean replace(K key, V expectedValue, V updatedValue)
Description copied from class:Cache
Replaces the value associated with a given key if the current value matches the expected value.
Note that the replaced value will not be propagated to child caches that already have a value for the same key. As such, this method is of limited usefulness and should only be called on isolated Level 1 caches.
-
cache
public V cache(K key, V value)
Description copied from class:Cache
Places a value in the cache only if no value exists with the same key.
-
-