V - the value typepublic abstract class AbstractTransactionalExternalCache<V> extends AbstractExternalCache<V> implements TransactionalExternalCache<V>, TransactionControl
TransactionalExternalCache instances.| Modifier and Type | Field and Description |
|---|---|
protected Supplier<RequestContext> |
contextSupplier |
protected MetricsRecorder |
metricsRecorder |
lockTimeout, name| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTransactionalExternalCache(String name,
Supplier<RequestContext> contextSupplier,
MetricsRecorder metricsRecorder,
Duration lockTimeout,
ExternalCacheExceptionListener externalCacheExceptionListener) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract Optional<V> |
directGet(String externalKey)
Performs a direct get operation against the external cache using the supplied external key.
|
protected abstract Map<String,Optional<V>> |
directGetBulk(Set<String> externalKeys)
Performs a direct bulk get operation against the external cache using the supplied external 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.
|
void |
put(String internalKey,
V value,
PutPolicy policy)
Puts the value under the specified key using the specified policy.
|
void |
remove(Iterable<String> internalKeys)
Remove the entries with the specified keys.
|
void |
removeAll()
Remove all entries in the cache.
|
boolean |
transactionDiscard()
Discard any changes.
|
ensureCacheContext, getLogger, getName, mapException, perform, performclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBulk, getBulkremovetransactionSyncprotected final Supplier<RequestContext> contextSupplier
protected final MetricsRecorder metricsRecorder
protected AbstractTransactionalExternalCache(String name, Supplier<RequestContext> contextSupplier, MetricsRecorder metricsRecorder, Duration lockTimeout, ExternalCacheExceptionListener externalCacheExceptionListener)
protected abstract Optional<V> directGet(String externalKey)
protected abstract Map<String,Optional<V>> directGetBulk(Set<String> externalKeys)
public final CompletionStage<Optional<V>> get(String internalKey)
ExternalCacheget in interface ExternalCache<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:
ExternalCache.getBulk(java.lang.String...).
When the supplier is called, callers may not assume that the value returned from the supplier is returned
by this method.
get in interface ExternalCache<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)
ExternalCachepublic final CompletionStage<Map<String,V>> getBulk(Function<Set<String>,Map<String,V>> factory, Iterable<String> internalKeys)
ExternalCacheNotes:
ExternalCache.get(String, Supplier).
When the factory is called, callers may not assume that the values returned from the factory
is returned by this method.
getBulk in interface ExternalCache<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 void put(String internalKey, V value, PutPolicy policy)
ExternalWriteOperationsBufferedput in interface ExternalWriteOperationsBuffered<V>internalKey - the key to put the data undervalue - the value to associate with the key.policy - the policy to applypublic final void remove(Iterable<String> internalKeys)
ExternalWriteOperationsBufferedremove in interface ExternalWriteOperationsBuffered<V>internalKeys - the keys of the entries to remove.public final void removeAll()
ExternalWriteOperationsBufferedremoveAll in interface ExternalWriteOperationsBuffered<V>public final boolean transactionDiscard()
TransactionControltransactionDiscard in interface TransactionControlCopyright © 2019 Atlassian. All rights reserved.