V - the value typepublic abstract class AbstractStableReadExternalCache<V> extends AbstractNonDirectExternalCache<V> implements StableReadExternalCache<V>
StableReadExternalCache instances.
Locking is provided to synchronise the local and remote caches. There are two locking strategies - a cache wide read-write lock and a per-key lock. The cache wide lock provides exclusion for multi-key operations such as removeAll and getBulk. The key lock provides locking for single key get and put whilst honouring the cache lock.
metricsRecordername| Modifier | Constructor and Description |
|---|---|
protected |
AbstractStableReadExternalCache(String name,
MetricsRecorder metricsRecorder) |
| Modifier and Type | Method and Description |
|---|---|
protected Map<String,Optional<V>> |
checkValuesRecorded(Iterable<String> internalKeys)
Checks for values recorded for specified internal keys.
|
CompletionStage<Optional<V>> |
get(String internalKey)
Returns a value that is associated with a specified key.
|
CompletionStage<V> |
get(String internalKey,
Supplier<V> supplier)
Returns a value that may be associated with a specified key.
|
CompletionStage<Map<String,V>> |
getBulk(Function<Set<String>,Map<String,V>> factory,
Iterable<String> internalKeys)
Returns the values that are associated with the specified keys.
|
CompletionStage<Map<String,Optional<V>>> |
getBulk(Iterable<String> internalKeys)
Returns the values that are associated with the specified keys.
|
protected abstract CompletionStage<Boolean> |
internalPut(String internalKey,
V value,
PutPolicy policy) |
protected abstract CompletionStage<Void> |
internalRemove(Iterable<String> keys) |
protected abstract CompletionStage<Void> |
internalRemoveAll() |
CompletionStage<Boolean> |
put(String internalKey,
V value,
PutPolicy policy)
Puts the value under the specified key using the specified policy.
|
CompletionStage<Void> |
remove(Iterable<String> keys)
Remove the entries with the specified keys.
|
CompletionStage<Void> |
removeAll()
Remove all entries in the cache.
|
directGet, directGetBulk, handleCreation, handleCreationensureCacheContext, getLogger, getName, mapException, perform, performclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBulk, getBulkremoveprotected AbstractStableReadExternalCache(String name, MetricsRecorder metricsRecorder)
protected final Map<String,Optional<V>> checkValuesRecorded(Iterable<String> internalKeys)
AbstractNonDirectExternalCachecheckValuesRecorded in class AbstractNonDirectExternalCache<V>public final CompletionStage<Optional<V>> get(String internalKey)
ExternalCacheget in interface ExternalCache<V>get in class AbstractNonDirectExternalCache<V>internalKey - the key to check.Optional which may contain the value associated with the key.public final CompletionStage<V> get(String internalKey, Supplier<V> supplier)
ExternalCacheNotes:
get in interface ExternalCache<V>get in class AbstractNonDirectExternalCache<V>internalKey - the key uniquely identifying the value to be retrievedsupplier - used to generate the value, if one does not exist already for the key. The supplier may not
return null.public final CompletionStage<Map<String,Optional<V>>> getBulk(Iterable<String> internalKeys)
ExternalCachegetBulk in interface ExternalCache<V>getBulk in class AbstractNonDirectExternalCache<V>internalKeys - the keys to check.Map that is keyed on the keys specified. Each entry in the Map will have
Optional which may contain the value associated with the key.public final CompletionStage<Map<String,V>> getBulk(Function<Set<String>,Map<String,V>> factory, Iterable<String> internalKeys)
ExternalCacheNotes:
getBulk in interface ExternalCache<V>getBulk in class AbstractNonDirectExternalCache<V>factory - used to generate the values for the keys that do not have entries. The factory must return a
map containing a non-null entry for each supplied key.internalKeys - the keys to retrieveMap that is keyed on the keys specified. Each entry in the Map will have
the value associated with the key.public final CompletionStage<Boolean> put(String internalKey, V value, PutPolicy policy)
ExternalWriteOperationsUnbufferedput in interface ExternalWriteOperationsUnbuffered<V>internalKey - the key to put the data undervalue - the value to associate with the key.policy - the policy to applyprotected abstract CompletionStage<Boolean> internalPut(String internalKey, V value, PutPolicy policy)
public final CompletionStage<Void> remove(Iterable<String> keys)
ExternalWriteOperationsUnbufferedremove in interface ExternalWriteOperationsUnbuffered<V>keys - the keys of the entries to remove.protected abstract CompletionStage<Void> internalRemove(Iterable<String> keys)
public CompletionStage<Void> removeAll()
ExternalWriteOperationsUnbufferedremoveAll in interface ExternalWriteOperationsUnbuffered<V>protected abstract CompletionStage<Void> internalRemoveAll()
Copyright © 2016 Atlassian. All rights reserved.