V - the value type.public class GuavaDirectExternalCache<V> extends AbstractExternalCache<V> implements DirectExternalCache<V>
DirectExternalCache.lockTimeout, name| Constructor and Description |
|---|
GuavaDirectExternalCache(String name,
com.google.common.cache.Cache<String,IdentifiedData> delegate,
Supplier<RequestContext> contextSupplier,
ExternalCacheKeyGenerator keyGenerator,
Optional<com.atlassian.marshalling.api.MarshallingPair<V>> valueMarshalling,
Duration lockTimeout) |
| Modifier and Type | Method and Description |
|---|---|
protected AbstractExternalCacheRequestContext<V> |
ensureCacheContext()
Returns the cache context for the current request.
|
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.
|
CompletionStage<Map<String,Optional<IdentifiedValue<V>>>> |
getBulkIdentified(Iterable<String> internalKeys)
Returns the
IdentifiedValue's that are associated with the specified keys. |
CompletionStage<Optional<IdentifiedValue<V>>> |
getIdentified(String internalKey)
Returns an identified value that is associated with a specified key.
|
CompletionStage<IdentifiedValue<V>> |
getIdentified(String internalKey,
Supplier<V> supplier)
Returns an identified value that is associated with a specified key.
|
protected org.slf4j.Logger |
getLogger()
Returns the logging instance for the implementation class.
|
protected ExternalCacheException |
mapException(Exception ex)
Maps a generic
Exception to a corresponding ExternalCacheException. |
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> internalKeys)
Remove the entries with the specified keys.
|
CompletionStage<Void> |
removeAll()
Remove all entries in the cache.
|
CompletionStage<Boolean> |
removeIf(String internalKey,
CasIdentifier casId)
Removes the specified entry, iff the specified CAS identifier matches.
|
CompletionStage<Boolean> |
replaceIf(String internalKey,
CasIdentifier casId,
V newValue)
Replaces the value for a specified entry, iff the specified CAS identifier matches.
|
getName, perform, performclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBulkIdentifiedgetBulk, getBulkremovepublic GuavaDirectExternalCache(String name, com.google.common.cache.Cache<String,IdentifiedData> delegate, Supplier<RequestContext> contextSupplier, ExternalCacheKeyGenerator keyGenerator, Optional<com.atlassian.marshalling.api.MarshallingPair<V>> valueMarshalling, Duration lockTimeout)
public 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 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 CompletionStage<Optional<IdentifiedValue<V>>> getIdentified(String internalKey)
DirectExternalCacheIdentifiedValue.identifier()
may be used in subsequent CAS operations, such as
DirectExternalCache.removeIf(String, CasIdentifier) and
DirectExternalCache.replaceIf(String, CasIdentifier, Object).getIdentified in interface DirectExternalCache<V>internalKey - the key to check.Optional which may contain the identified value associated with the key.public CompletionStage<IdentifiedValue<V>> getIdentified(String internalKey, Supplier<V> supplier)
DirectExternalCacheIdentifiedValue.identifier()
may be used in subsequent CAS operations, such as
DirectExternalCache.removeIf(String, CasIdentifier) and
DirectExternalCache.replaceIf(String, CasIdentifier, Object).getIdentified in interface DirectExternalCache<V>internalKey - the key to check.supplier - used to generate the value, if one does not exist already for the key. The supplier may not
return null.Optional which may contain the identified value associated with the key.public CompletionStage<Map<String,Optional<V>>> getBulk(Iterable<String> internalKeys)
ExternalCachepublic 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 CompletionStage<Map<String,Optional<IdentifiedValue<V>>>> getBulkIdentified(Iterable<String> internalKeys)
DirectExternalCacheIdentifiedValue's that are associated with the specified keys.getBulkIdentified in interface DirectExternalCache<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 IdentifiedValue associated with the key.public 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 applypublic CompletionStage<Boolean> removeIf(String internalKey, CasIdentifier casId)
DirectExternalCacheremoveIf in interface DirectExternalCache<V>internalKey - the key of the entry to removecasId - the CAS identifier to matchpublic CompletionStage<Boolean> replaceIf(String internalKey, CasIdentifier casId, V newValue)
DirectExternalCachereplaceIf in interface DirectExternalCache<V>internalKey - the key of the entry to replace it's valuecasId - the CAS identifier to matchnewValue - the new value to replace withpublic CompletionStage<Void> remove(Iterable<String> internalKeys)
ExternalWriteOperationsUnbufferedremove in interface ExternalWriteOperationsUnbuffered<V>internalKeys - the keys of the entries to remove.public CompletionStage<Void> removeAll()
ExternalWriteOperationsUnbufferedremoveAll in interface ExternalWriteOperationsUnbuffered<V>protected AbstractExternalCacheRequestContext<V> ensureCacheContext()
AbstractExternalCacheensureCacheContext in class AbstractExternalCache<V>protected ExternalCacheException mapException(Exception ex)
AbstractExternalCacheException to a corresponding ExternalCacheException.mapException in class AbstractExternalCache<V>protected org.slf4j.Logger getLogger()
AbstractExternalCachegetLogger in class AbstractExternalCache<V>Copyright © 2019 Atlassian. All rights reserved.