public abstract class AbstractDelegatingAdvancedCache<K,V> extends AbstractDelegatingCache<K,V> implements AdvancedCache<K,V>
AbstractDelegatingCache, but for AdvancedCache.AbstractDelegatingCache| Modifier and Type | Field and Description |
|---|---|
protected AdvancedCache<K,V> |
cache |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDelegatingAdvancedCache(AdvancedCache<K,V> cache) |
| Modifier and Type | Method and Description |
|---|---|
CacheSet<CacheEntry<K,V>> |
cacheEntrySet()
Identical to
Cache.entrySet() but is typed to return CacheEntries instead of Entries. |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
Metadata metadata)
An overloaded form of
#compute(K, BiFunction), which takes in an instance of Metadata which can be
used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
CompletableFuture<V> |
computeAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction)
Asynchronous version of
ConcurrentMap.compute(Object, BiFunction). |
CompletableFuture<V> |
computeAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.compute(Object, BiFunction, long, TimeUnit). |
CompletableFuture<V> |
computeAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.compute(Object, BiFunction, long, TimeUnit, long, TimeUnit). |
CompletableFuture<V> |
computeAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
Metadata metadata)
Overloaded
#computeAsync(K, BiFunction), which stores metadata alongside the value. |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction,
Metadata metadata)
An overloaded form of
#computeIfAbsent(K, Function), which takes in an instance of Metadata which
can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
CompletableFuture<V> |
computeIfAbsentAsync(K key,
Function<? super K,? extends V> mappingFunction)
Asynchronous version of
ConcurrentMap.computeIfAbsent(Object, Function). |
CompletableFuture<V> |
computeIfAbsentAsync(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.computeIfAbsent(Object, Function, long, TimeUnit). |
CompletableFuture<V> |
computeIfAbsentAsync(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit). |
CompletableFuture<V> |
computeIfAbsentAsync(K key,
Function<? super K,? extends V> mappingFunction,
Metadata metadata)
Overloaded
#computeIfAbsentAsync(K, Function), which takes in an instance of Metadata which
can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
Metadata metadata)
An overloaded form of
#computeIfPresent(K, BiFunction), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. |
CompletableFuture<V> |
computeIfPresentAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction)
Asynchronous version of
ConcurrentMap.computeIfPresent(Object, BiFunction). |
CompletableFuture<V> |
computeIfPresentAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit) . |
CompletableFuture<V> |
computeIfPresentAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit) . |
CompletableFuture<V> |
computeIfPresentAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
Metadata metadata)
Overloaded
#computeIfPresentAsync(K, BiFunction), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. |
AdvancedCache<K,V> |
getAdvancedCache() |
Map<K,V> |
getAll(Set<?> keys)
Gets a collection of entries, returning them as
Map of the values associated with the set of keys
requested. |
CompletableFuture<Map<K,V>> |
getAllAsync(Set<?> keys)
TODO This should be in AdvancedCache with getAll
|
Map<K,CacheEntry<K,V>> |
getAllCacheEntries(Set<?> keys)
Gets a collection of entries from the
AdvancedCache, returning them as Map of the cache entries
associated with the set of keys requested. |
Map<K,V> |
getAndPutAll(Map<? extends K,? extends V> map)
Executes an equivalent of
Map.putAll(Map), returning previous values of the modified entries. |
AsyncInterceptorChain |
getAsyncInterceptorChain()
Deprecated.
Since 10.0, will be removed without a replacement
|
AuthorizationManager |
getAuthorizationManager()
Retrieves the
AuthorizationManager if the cache has security enabled. |
AvailabilityMode |
getAvailability()
Returns the cache's availability.
|
BatchContainer |
getBatchContainer()
Returns the component in charge of batching cache operations.
|
String |
getCacheAvailability() |
CacheEntry<K,V> |
getCacheEntry(Object key)
Retrieves a CacheEntry corresponding to a specific key.
|
CompletableFuture<CacheEntry<K,V>> |
getCacheEntryAsync(Object key)
Retrieves a CacheEntry corresponding to a specific key.
|
ClassLoader |
getClassLoader()
Returns the cache loader associated associated with this cache.
|
ComponentRegistry |
getComponentRegistry() |
DataContainer<K,V> |
getDataContainer()
Returns the container where data is stored in the cache.
|
DistributionManager |
getDistributionManager()
Retrieves a reference to the
DistributionManager if the cache is configured to
use Distribution. |
EvictionManager |
getEvictionManager() |
ExpirationManager<K,V> |
getExpirationManager() |
Map<K,V> |
getGroup(String groupName)
It fetches all the keys which belong to the group.
|
DataConversion |
getKeyDataConversion() |
LockManager |
getLockManager()
Returns the component that deals with all aspects of acquiring and releasing locks for cache entries.
|
RpcManager |
getRpcManager()
Returns the component in charge of communication with other caches in the cluster.
|
Stats |
getStats()
Returns a
Stats object that allows several statistics associated with this cache at runtime. |
TransactionManager |
getTransactionManager() |
DataConversion |
getValueDataConversion() |
XAResource |
getXAResource()
Returns the
XAResource associated with this cache which can be used to do transactional recovery. |
boolean |
isRebalancingEnabled() |
boolean |
lock(Collection<? extends K> keys)
Locks collections of keys eagerly across cache nodes in a cluster.
|
boolean |
lock(K... key)
Locks a given key or keys eagerly across cache nodes in a cluster.
|
AdvancedCache<K,V> |
lockAs(Object lockOwner)
Whenever this cache acquires a lock it will do so using the given Object as the owner of said lock.
|
LockedStream<K,V> |
lockedStream()
Returns a sequential stream using this Cache as the source.
|
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
Metadata metadata)
An overloaded form of
Cache.merge(Object, Object, BiFunction), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. |
CompletableFuture<V> |
mergeAsync(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction)
Asynchronous version of
ConcurrentMap.merge(Object, Object, BiFunction). |
CompletableFuture<V> |
mergeAsync(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.merge(Object, Object, BiFunction, long, TimeUnit). |
CompletableFuture<V> |
mergeAsync(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
Asynchronous version of
BasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit). |
CompletableFuture<V> |
mergeAsync(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
Metadata metadata)
Overloaded
AsyncCache.mergeAsync(Object, Object, BiFunction), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. |
AdvancedCache<K,V> |
noFlags()
Unset all flags set on this cache using
AdvancedCache.withFlags(Flag...) or AdvancedCache.withFlags(Collection) methods. |
V |
put(K key,
V value,
Metadata metadata)
An overloaded form of
#put(K, V), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. |
void |
putAll(Map<? extends K,? extends V> map,
Metadata metadata)
An overloaded form of
Map.putAll(Map), which takes in an instance of Metadata
which can be used to provide metadata information for the entries being stored, such as lifespan, version of
value...etc. |
CompletableFuture<Void> |
putAllAsync(Map<? extends K,? extends V> map,
Metadata metadata) |
CompletableFuture<V> |
putAsync(K key,
V value,
Metadata metadata)
Asynchronous version of
AdvancedCache.put(Object, Object, Metadata) which stores metadata alongside the value. |
protected void |
putForExternalRead(K key,
V value,
EnumSet<Flag> flags,
ClassLoader classLoader) |
void |
putForExternalRead(K key,
V value,
Metadata metadata)
An overloaded form of
#putForExternalRead(K, V), which takes in an instance of Metadata which can
be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
protected void |
putForExternalRead(K key,
V value,
Metadata metadata,
EnumSet<Flag> flags,
ClassLoader classLoader) |
V |
putIfAbsent(K key,
V value,
Metadata metadata)
An overloaded form of
#putIfAbsent(K, V), which takes in an instance of Metadata which can be used
to provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
CompletableFuture<V> |
putIfAbsentAsync(K key,
V value,
Metadata metadata)
An overloaded form of
#putIfAbsentAsync(K, V), which takes in an instance of Metadata which can be used
to provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
void |
removeGroup(String groupName)
It removes all the key which belongs to a group.
|
CompletableFuture<Boolean> |
removeLifespanExpired(K key,
V value,
Long lifespan)
Attempts to remove the entry if it is expired.
|
CompletableFuture<Boolean> |
removeMaxIdleExpired(K key,
V value)
Attempts to remove the entry for the given key, if it has expired due to max idle.
|
V |
replace(K key,
V value,
Metadata metadata)
An overloaded form of
#replace(K, V), which takes in an instance of Metadata which can be used to
provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
boolean |
replace(K key,
V oldValue,
V value,
Metadata metadata)
An overloaded form of
#replace(K, V, V), which takes in an instance of Metadata which can be used
to provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
CompletableFuture<V> |
replaceAsync(K key,
V value,
Metadata metadata)
An overloaded form of
#replaceAsync(K, V), which takes in an instance of Metadata which can be used to
provide metadata information for the entry being stored, such as lifespan, version of value...etc. |
CompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
Metadata metadata) |
abstract AdvancedCache |
rewrap(AdvancedCache newDelegate)
No generics because some methods return
AdvancedCache<?, ?>,
and returning the proper type would require erasure anyway. |
void |
setAvailability(AvailabilityMode availabilityMode)
Manually change the availability of the cache.
|
void |
setCacheAvailability(String availabilityString) |
void |
setRebalancingEnabled(boolean enabled) |
AdvancedCache<K,V> |
transform(Function<AdvancedCache<K,V>,? extends AdvancedCache<K,V>> transformation)
Apply the
transformation on each AdvancedCache instance in a delegation chain, starting
with the innermost implementation. |
AdvancedCache<K,V> |
with(ClassLoader classLoader) |
AdvancedCache<?,?> |
withEncoding(Class<? extends Encoder> encoder)
Performs any cache operations using the specified
Encoder. |
AdvancedCache |
withEncoding(Class<? extends Encoder> keyEncoder,
Class<? extends Encoder> valueEncoder)
Performs any cache operations using the specified pair of
Encoder. |
AdvancedCache<K,V> |
withFlags(Collection<Flag> flags)
An alternative to
AdvancedCache.withFlags(Flag...) not requiring array allocation. |
AdvancedCache<K,V> |
withFlags(Flag... flags)
A method that adds flags to any API call.
|
AdvancedCache<?,?> |
withKeyEncoding(Class<? extends Encoder> encoder) |
AdvancedCache<?,?> |
withMediaType(String keyMediaType,
String valueMediaType)
Perform any cache operations using an alternate
MediaType. |
AdvancedCache<K,V> |
withStorageMediaType()
Perform any cache operations using the same
MediaType of the cache
storage. |
AdvancedCache<K,V> |
withSubject(Subject subject)
Performs any cache operations using the specified
Subject. |
AdvancedCache<K,V> |
withWrapping(Class<? extends Wrapper> wrapper)
Deprecated.
|
AdvancedCache<K,V> |
withWrapping(Class<? extends Wrapper> keyWrapper,
Class<? extends Wrapper> valueWrapper)
Deprecated.
|
addFilteredListener, addFilteredListenerAsync, addListener, addListener, addListenerAsync, addListenerAsync, addStorageFormatFilteredListener, addStorageFormatFilteredListenerAsync, clear, clearAsync, compute, compute, compute, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfPresent, computeIfPresent, computeIfPresent, containsKey, containsValue, endBatch, entrySet, evict, forEach, get, getAsync, getCacheConfiguration, getCacheManager, getCacheName, getCacheStatus, getConfigurationAsProperties, getDelegate, getListeners, getName, getOrDefault, getStatus, getVersion, isEmpty, keySet, merge, merge, merge, put, put, put, putAll, putAll, putAll, putAllAsync, putAllAsync, putAllAsync, putAsync, putAsync, putAsync, putForExternalRead, putForExternalRead, putForExternalRead, putIfAbsent, putIfAbsent, putIfAbsent, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, remove, remove, removeAsync, removeAsync, removeListener, removeListenerAsync, replace, replace, replace, replace, replace, replace, replaceAll, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, set, shutdown, size, sizeAsync, start, startBatch, stop, toString, unwrapCache, valuesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, merge, mergeAsync, withFlagsclear, compute, compute, compute, compute, computeAsync, computeAsync, computeAsync, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresent, computeIfPresent, computeIfPresentAsync, entrySet, evict, getCacheConfiguration, getCacheManager, getStatus, keySet, merge, merge, merge, merge, mergeAsync, mergeAsync, mergeAsync, putForExternalRead, putForExternalRead, putForExternalRead, shutdown, size, stop, valuescompute, compute, computeIfAbsent, computeIfAbsent, computeIfPresent, computeIfPresent, getName, getVersion, merge, merge, put, put, put, putAll, putAll, putIfAbsent, putIfAbsent, remove, replace, replace, replace, replaceclearAsync, containsKeyAsync, getAsync, putAllAsync, putAllAsync, putAllAsync, putAsync, putAsync, putAsync, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, removeAsync, removeAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, sizeAsyncforEach, getOrDefault, putIfAbsent, remove, replace, replace, replaceAllcontainsKey, containsValue, equals, get, hashCode, isEmpty, putAllendBatch, startBatchaddFilteredListener, addFilteredListenerAsync, addListener, addListenerAsync, addStorageFormatFilteredListener, addStorageFormatFilteredListenerAsyncaddListener, addListenerAsync, getListeners, removeListener, removeListenerAsyncprotected final AdvancedCache<K,V> cache
protected AbstractDelegatingAdvancedCache(AdvancedCache<K,V> cache)
@Deprecated public AsyncInterceptorChain getAsyncInterceptorChain()
AdvancedCachegetAsyncInterceptorChain in interface AdvancedCache<K,V>public AdvancedCache<K,V> getAdvancedCache()
getAdvancedCache in interface Cache<K,V>getAdvancedCache in class AbstractDelegatingCache<K,V>public EvictionManager getEvictionManager()
getEvictionManager in interface AdvancedCache<K,V>public ExpirationManager<K,V> getExpirationManager()
getExpirationManager in interface AdvancedCache<K,V>public ComponentRegistry getComponentRegistry()
getComponentRegistry in interface AdvancedCache<K,V>public DistributionManager getDistributionManager()
AdvancedCacheDistributionManager if the cache is configured to
use Distribution. Otherwise, returns a null.getDistributionManager in interface AdvancedCache<K,V>public AuthorizationManager getAuthorizationManager()
AdvancedCacheAuthorizationManager if the cache has security enabled. Otherwise returns nullgetAuthorizationManager in interface AdvancedCache<K,V>public AdvancedCache<K,V> lockAs(Object lockOwner)
AdvancedCacheThis can be useful when a lock may have been manually acquired and you wish to reuse that lock across invocations.
Great care should be taken with this command as misuse can very easily lead to deadlocks.
lockAs in interface AdvancedCache<K,V>lockOwner - the lock owner to lock any keys asAdvancedCache instance on which when an operation is invoked it will use lock owner object to
acquire any lockspublic RpcManager getRpcManager()
AdvancedCacheClusteringConfiguration.cacheMode() is CacheMode.LOCAL, this method will return null.getRpcManager in interface AdvancedCache<K,V>public BatchContainer getBatchContainer()
AdvancedCachegetBatchContainer in interface AdvancedCache<K,V>public DataContainer<K,V> getDataContainer()
AdvancedCachegetDataContainer in interface AdvancedCache<K,V>public TransactionManager getTransactionManager()
getTransactionManager in interface TransactionalCacheTransactionManager in use by this cache or null if the cache isn't transactional.public LockManager getLockManager()
AdvancedCachegetLockManager in interface AdvancedCache<K,V>public XAResource getXAResource()
AdvancedCacheXAResource associated with this cache which can be used to do transactional recovery.getXAResource in interface AdvancedCache<K,V>XAResourcepublic AvailabilityMode getAvailability()
AdvancedCacheAvailabilityMode.AVAILABLE.
In clustered mode, the PartitionHandlingManager is queried to obtain the availability mode.getAvailability in interface AdvancedCache<K,V>public void setAvailability(AvailabilityMode availabilityMode)
AdvancedCachePartitionHandlingConfiguration.whenSplit() is set to PartitionHandling.ALLOW_READ_WRITES.setAvailability in interface AdvancedCache<K,V>@ManagedAttribute(description="Returns the cache availability",
displayName="Cache availability",
dataType=TRAIT,
writable=true)
public String getCacheAvailability()
public void setCacheAvailability(String availabilityString) throws Exception
Exception@ManagedAttribute(description="Returns whether cache rebalancing is enabled",
displayName="Cache rebalacing",
dataType=TRAIT,
writable=true)
public boolean isRebalancingEnabled()
public void setRebalancingEnabled(boolean enabled)
public AdvancedCache<K,V> withFlags(Flag... flags)
AdvancedCachecache.withFlags(Flag.FORCE_WRITE_LOCK).get(key);will invoke a cache.get() with a write lock forced. Note that for the flag to take effect, the cache operation must be invoked on the instance returned by this method. As an alternative to setting this on every invocation, users should also consider saving the decorated cache, as this allows for more readable code. E.g.:
AdvancedCache<?, ?> forceWriteLockCache = cache.withFlags(Flag.FORCE_WRITE_LOCK);
forceWriteLockCache.get(key1);
forceWriteLockCache.get(key2);
forceWriteLockCache.get(key3);
withFlags in interface AdvancedCache<K,V>flags - a set of flags to apply. See the Flag documentation.AdvancedCache instance on which a real operation is to be invoked, if the flags are to be
applied.public AdvancedCache<K,V> withFlags(Collection<Flag> flags)
AdvancedCacheAdvancedCache.withFlags(Flag...) not requiring array allocation.withFlags in interface AdvancedCache<K,V>public AdvancedCache<K,V> noFlags()
AdvancedCacheAdvancedCache.withFlags(Flag...) or AdvancedCache.withFlags(Collection) methods.noFlags in interface AdvancedCache<K,V>this.public AdvancedCache<K,V> transform(Function<AdvancedCache<K,V>,? extends AdvancedCache<K,V>> transformation)
AdvancedCachetransformation on each AdvancedCache instance in a delegation chain, starting
with the innermost implementation.transform in interface AdvancedCache<K,V>public AdvancedCache<K,V> withSubject(Subject subject)
AdvancedCacheSubject. Only applies to caches with authorization
enabled (see ConfigurationBuilder.security()).withSubject in interface AdvancedCache<K,V>AdvancedCache instance on which a real operation is to be invoked, using the specified subjectpublic boolean lock(K... key)
AdvancedCacheKeys can be locked eagerly in the context of a transaction only.
lock in interface AdvancedCache<K,V>key - the keys to lockFlag.FAIL_SILENTLY.public boolean lock(Collection<? extends K> keys)
AdvancedCacheCollections of keys can be locked eagerly in the context of a transaction only.
lock in interface AdvancedCache<K,V>keys - collection of keys to lockFlag.FAIL_SILENTLY.public Stats getStats()
AdvancedCacheStats object that allows several statistics associated with this cache at runtime.getStats in interface AdvancedCache<K,V>Stats objectpublic ClassLoader getClassLoader()
AdvancedCacheDecoratedCache wrapper.getClassLoader in interface AdvancedCache<K,V>public AdvancedCache<K,V> with(ClassLoader classLoader)
with in interface AdvancedCache<K,V>public Map<K,V> getAll(Set<?> keys)
AdvancedCacheMap of the values associated with the set of keys
requested.
If the cache is configured read-through, and a get for a key would return null because an entry is missing from
the cache, the Cache's CacheLoader is called in an attempt to load the entry. If an entry cannot be loaded
for a given key, the returned Map will contain null for value of the key.
Unlike other bulk methods if this invoked in an existing transaction all entries will be stored in the current transactional context
The returned Map will be a copy and updates to the map will not be reflected in the Cache and vice versa.
The keys and values themselves however may not be copies depending on if storeAsBinary is enabled and the value
was retrieved from the local node.
getAll in interface AdvancedCache<K,V>keys - The keys whose associated values are to be returned.public CacheEntry<K,V> getCacheEntry(Object key)
AdvancedCachegetCacheEntry in interface AdvancedCache<K,V>key - the key whose associated cache entry is to be returnednull if this map contains no mapping for
the keypublic CompletableFuture<CacheEntry<K,V>> getCacheEntryAsync(Object key)
AdvancedCachegetCacheEntryAsync in interface AdvancedCache<K,V>key - the key whose associated cache entry is to be returnednull
if this map contains no mapping for the keypublic Map<K,CacheEntry<K,V>> getAllCacheEntries(Set<?> keys)
AdvancedCacheAdvancedCache, returning them as Map of the cache entries
associated with the set of keys requested.
If the cache is configured read-through, and a get for a key would return null because an entry is missing from
the cache, the Cache's CacheLoader is called in an attempt to load the entry. If an entry cannot be loaded
for a given key, the returned Map will contain null for value of the key.
Unlike other bulk methods if this invoked in an existing transaction all entries will be stored in the current transactional context
The returned Map will be a copy and updates to the map will not be reflected in the Cache and vice versa.
The keys and values themselves however may not be copies depending on if storeAsBinary is enabled and the value
was retrieved from the local node.
getAllCacheEntries in interface AdvancedCache<K,V>keys - The keys whose associated values are to be returned.public Map<K,V> getAndPutAll(Map<? extends K,? extends V> map)
AdvancedCacheMap.putAll(Map), returning previous values of the modified entries.getAndPutAll in interface AdvancedCache<K,V>map - mappings to be stored in this mappublic Map<K,V> getGroup(String groupName)
AdvancedCachemap returned is immutable and represents the group at the time of the invocation. If you want to add
or remove keys from a group use BasicCache.put(Object, Object) and BasicCache.remove(Object). To remove all the keys
in the group use AdvancedCache.removeGroup(String).
To improve performance you may use the flag Flag.SKIP_CACHE_LOAD to avoid
fetching the key/value from persistence. However, you will get an inconsistent snapshot of the group.getGroup in interface AdvancedCache<K,V>groupName - the group name.Map with the key/value pairs.public void removeGroup(String groupName)
AdvancedCacheremoveGroup in interface AdvancedCache<K,V>groupName - the group name.public V put(K key, V value, Metadata metadata)
AdvancedCache#put(K, V), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc.put in interface AdvancedCache<K,V>key - key to usevalue - value to storemetadata - information to store alongside the valuepublic V replace(K key, V value, Metadata metadata)
AdvancedCache#replace(K, V), which takes in an instance of Metadata which can be used to
provide metadata information for the entry being stored, such as lifespan, version of value...etc. The Metadata is only stored if the call is successful.replace in interface AdvancedCache<K,V>key - key with which the specified value is associatedvalue - value to be associated with the specified keymetadata - information to store alongside the new valuepublic CompletableFuture<V> replaceAsync(K key, V value, Metadata metadata)
AdvancedCache#replaceAsync(K, V), which takes in an instance of Metadata which can be used to
provide metadata information for the entry being stored, such as lifespan, version of value...etc. The Metadata is only stored if the call is successful.replaceAsync in interface AdvancedCache<K,V>key - key with which the specified value is associatedvalue - value to be associated with the specified keymetadata - information to store alongside the new valuepublic boolean replace(K key, V oldValue, V value, Metadata metadata)
AdvancedCache#replace(K, V, V), which takes in an instance of Metadata which can be used
to provide metadata information for the entry being stored, such as lifespan, version of value...etc. The Metadata is only stored if the call is successful.replace in interface AdvancedCache<K,V>key - key with which the specified value is associatedoldValue - value expected to be associated with the specified keyvalue - value to be associated with the specified keymetadata - information to store alongside the new valuepublic CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, Metadata metadata)
replaceAsync in interface AdvancedCache<K,V>public V putIfAbsent(K key, V value, Metadata metadata)
AdvancedCache#putIfAbsent(K, V), which takes in an instance of Metadata which can be used
to provide metadata information for the entry being stored, such as lifespan, version of value...etc. The Metadata is only stored if the call is successful.putIfAbsent in interface AdvancedCache<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keymetadata - information to store alongside the new valuepublic CompletableFuture<V> putIfAbsentAsync(K key, V value, Metadata metadata)
AdvancedCache#putIfAbsentAsync(K, V), which takes in an instance of Metadata which can be used
to provide metadata information for the entry being stored, such as lifespan, version of value...etc. The Metadata is only stored if the call is successful.putIfAbsentAsync in interface AdvancedCache<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keymetadata - information to store alongside the new valuepublic CompletableFuture<V> putAsync(K key, V value, Metadata metadata)
AdvancedCacheAdvancedCache.put(Object, Object, Metadata) which stores metadata alongside the value. This
method does not block on remote calls, even if your cache mode is synchronous. Has no benefit over AdvancedCache.put(Object, Object, Metadata) if used in LOCAL mode.
putAsync in interface AdvancedCache<K,V>key - key to usevalue - value to storemetadata - information to store alongside the new valuepublic void putForExternalRead(K key, V value, Metadata metadata)
AdvancedCache#putForExternalRead(K, V), which takes in an instance of Metadata which can
be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. The
Metadata is only stored if the call is successful.putForExternalRead in interface AdvancedCache<K,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keymetadata - information to store alongside the new valuepublic V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, Metadata metadata)
AdvancedCache#compute(K, BiFunction), which takes in an instance of Metadata which can be
used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.compute in interface AdvancedCache<K,V>key - key with which the specified value is associatedremappingFunction - function to be applied to the specified key/valuemetadata - information to store alongside the new valuepublic V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, Metadata metadata)
AdvancedCache#computeIfPresent(K, BiFunction), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. The Metadata is only stored if the call is successful.computeIfPresent in interface AdvancedCache<K,V>key - key with which the specified value is associatedremappingFunction - function to be applied to the specified key/valuemetadata - information to store alongside the new valuepublic V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, Metadata metadata)
AdvancedCache#computeIfAbsent(K, Function), which takes in an instance of Metadata which
can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.
The Metadata is only stored if the call is successful.computeIfAbsent in interface AdvancedCache<K,V>key - key with which the specified value is associatedmappingFunction - function to be applied to the specified keymetadata - information to store alongside the new valuepublic V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, Metadata metadata)
AdvancedCacheCache.merge(Object, Object, BiFunction), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. The Metadata is only stored if the call is successful.merge in interface AdvancedCache<K,V>public CompletableFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, Metadata metadata)
AdvancedCache#computeAsync(K, BiFunction), which stores metadata alongside the value. This
method does not block on remote calls, even if your cache mode is synchronous.computeAsync in interface AdvancedCache<K,V>key - key with which the specified value is associatedremappingFunction - function to be applied to the specified key/valuemetadata - information to store alongside the new valuepublic CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, Metadata metadata)
AdvancedCache#computeIfPresentAsync(K, BiFunction), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. The Metadata is only stored if the call is successful.computeIfPresentAsync in interface AdvancedCache<K,V>key - key with which the specified value is associatedremappingFunction - function to be applied to the specified key/valuemetadata - information to store alongside the new valuepublic CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction, Metadata metadata)
AdvancedCache#computeIfAbsentAsync(K, Function), which takes in an instance of Metadata which
can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.
The Metadata is only stored if the call is successful.computeIfAbsentAsync in interface AdvancedCache<K,V>key - key with which the specified value is associatedmappingFunction - function to be applied to the specified keymetadata - information to store alongside the new valuepublic CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
AsyncCacheBasicCache.merge(Object, Object, BiFunction, long, TimeUnit). This method does not
block on remote calls, even if your cache mode is synchronous.mergeAsync in interface AsyncCache<K,V>mergeAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
AsyncCacheBasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit). This
method does not block on remote calls, even if your cache mode is synchronous.mergeAsync in interface AsyncCache<K,V>mergeAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, Metadata metadata)
AdvancedCacheAsyncCache.mergeAsync(Object, Object, BiFunction), which takes in an instance of Metadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of
value...etc. The Metadata is only stored if the call is successful.mergeAsync in interface AdvancedCache<K,V>public CompletableFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
AsyncCacheConcurrentMap.compute(Object, BiFunction). This method does not block on remote
calls, even if your cache mode is synchronous.computeAsync in interface AsyncCache<K,V>computeAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
AsyncCacheBasicCache.compute(Object, BiFunction, long, TimeUnit). This method does not block on remote
calls, even if your cache mode is synchronous.computeAsync in interface AsyncCache<K,V>computeAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCacheBasicCache.compute(Object, BiFunction, long, TimeUnit, long, TimeUnit). This method does not block on remote
calls, even if your cache mode is synchronous.computeAsync in interface AsyncCache<K,V>computeAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction)
AsyncCacheConcurrentMap.computeIfAbsent(Object, Function). This method does not block on remote
calls, even if your cache mode is synchronous.computeIfAbsentAsync in interface AsyncCache<K,V>computeIfAbsentAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit)
AsyncCacheBasicCache.computeIfAbsent(Object, Function, long, TimeUnit). This method does not block on remote
calls, even if your cache mode is synchronous.computeIfAbsentAsync in interface AsyncCache<K,V>computeIfAbsentAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCacheBasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit). This method does not block on remote
calls, even if your cache mode is synchronous.computeIfAbsentAsync in interface AsyncCache<K,V>computeIfAbsentAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
AsyncCacheConcurrentMap.computeIfPresent(Object, BiFunction). This method does not block on
remote calls, even if your cache mode is synchronous.computeIfPresentAsync in interface AsyncCache<K,V>computeIfPresentAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
AsyncCacheBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit) . This method does not block on
remote calls, even if your cache mode is synchronous.computeIfPresentAsync in interface AsyncCache<K,V>computeIfPresentAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCacheBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit) . This method does not block on
remote calls, even if your cache mode is synchronous.computeIfPresentAsync in interface AsyncCache<K,V>computeIfPresentAsync in class AbstractDelegatingCache<K,V>public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
AsyncCacheConcurrentMap.merge(Object, Object, BiFunction). This method does not block on remote
calls, even if your cache mode is synchronous.mergeAsync in interface AsyncCache<K,V>mergeAsync in class AbstractDelegatingCache<K,V>public void putAll(Map<? extends K,? extends V> map, Metadata metadata)
AdvancedCacheMap.putAll(Map), which takes in an instance of Metadata
which can be used to provide metadata information for the entries being stored, such as lifespan, version of
value...etc.putAll in interface AdvancedCache<K,V>map - the values to storemetadata - information to store alongside the value(s)public CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> map, Metadata metadata)
putAllAsync in interface AdvancedCache<K,V>public CacheSet<CacheEntry<K,V>> cacheEntrySet()
AdvancedCacheCache.entrySet() but is typed to return CacheEntries instead of Entries. Please see the
other method for a description of its behaviors.
This method is needed since nested generics do not support covariance
cacheEntrySet in interface AdvancedCache<K,V>Cache.entrySet()public LockedStream<K,V> lockedStream()
AdvancedCacheCacheStream returned from the CacheCollection.stream() method of the collection returned via AdvancedCache.cacheEntrySet(). The use of this locked stream is that when an entry is being processed by the user
the entry is locked for the invocation preventing a different thread from modifying it.
Note that this stream is not supported when using a optimistic transactional or simple cache. Both non transactional and pessimistic transactional caches are supported.
The stream will not share any ongoing transaction the user may have. Code executed by the stream should be treated as completely independent. That is any operation performed via the stream will require the user to start their own transaction or will be done intrinsically on the invocation. Note that if there is an ongoing transaction that has a lock on a key from the cache, that it will cause a deadlock.
Currently simple cache, ConfigurationBuilder.simpleCache(boolean) was
set to true, and optimistic caches, TransactionConfigurationBuilder.lockingMode(LockingMode)
was set to LockingMode.OPTIMISTIC, do not support this method. In this case it will throw an UnsupportedOperationException. This restriction may be removed in a future version. Also this method cannot be
used on a cache that has a lock owner already specified via AdvancedCache.lockAs(Object) as this could
lead to a deadlock or the release of locks early and will throw an IllegalStateException.
lockedStream in interface AdvancedCache<K,V>public CompletableFuture<Boolean> removeLifespanExpired(K key, V value, Long lifespan)
AdvancedCacheExpirationManager.
This command will only remove the value if the value and lifespan also match if provided.
This method will suspend any ongoing transaction and start a new one just for the invocation of this command. It is automatically committed or rolled back after the command completes, either successfully or via an exception.
NOTE: This method may be removed at any point including in a minor release and is not supported for external usage.
removeLifespanExpired in interface AdvancedCache<K,V>key - the key that is expiringvalue - the value that mapped to the given. Null means it will match any valuelifespan - the lifespan that should match. If null is provided it will match any lifespan valuepublic CompletableFuture<Boolean> removeMaxIdleExpired(K key, V value)
AdvancedCacheThis method returns a boolean when it has determined if the entry has expired. This is useful for when a backup node invokes this command for a get that found the entry expired. This way the node can return back to the caller much faster when the entry is not expired and do any additional processing asynchronously if needed.
This method will suspend any ongoing transaction and start a new one just for the invocation of this command. It is automatically committed or rolled back after the command completes, either successfully or via an exception.
NOTE: This method may be removed at any point including in a minor release and is not supported for external usage.
removeMaxIdleExpired in interface AdvancedCache<K,V>key - the key that expired via max idle for the given entrypublic AdvancedCache<?,?> withEncoding(Class<? extends Encoder> encoder)
AdvancedCacheEncoder.withEncoding in interface AdvancedCache<K,V>encoder - Encoder used for both keys and values.AdvancedCache where all operations will use the supplied encoder.public AdvancedCache withEncoding(Class<? extends Encoder> keyEncoder, Class<? extends Encoder> valueEncoder)
AdvancedCacheEncoder.withEncoding in interface AdvancedCache<K,V>keyEncoder - Encoder for the keys.valueEncoder - Encoder for the values.AdvancedCache where all operations will use the supplied encoders.public AdvancedCache<?,?> withKeyEncoding(Class<? extends Encoder> encoder)
withKeyEncoding in interface AdvancedCache<K,V>@Deprecated public AdvancedCache<K,V> withWrapping(Class<? extends Wrapper> wrapper)
AdvancedCacheWrapper.withWrapping in interface AdvancedCache<K,V>wrapper - Wrapper for the keys and values.AdvancedCache where all operations will use the supplied wrapper.public AdvancedCache<?,?> withMediaType(String keyMediaType, String valueMediaType)
AdvancedCacheMediaType.withMediaType in interface AdvancedCache<K,V>keyMediaType - MediaType for the keys.valueMediaType - org.infinispan.commons.dataconversion for the values.AdvancedCache where all data will formatted according to the supplied MediaType.public AdvancedCache<K,V> withStorageMediaType()
AdvancedCacheMediaType of the cache
storage. This is equivalent to disabling transcoding on the cache.withStorageMediaType in interface AdvancedCache<K,V>AdvancedCache where no data conversion will take place.@Deprecated public AdvancedCache<K,V> withWrapping(Class<? extends Wrapper> keyWrapper, Class<? extends Wrapper> valueWrapper)
AdvancedCacheWrapper.withWrapping in interface AdvancedCache<K,V>keyWrapper - Wrapper for the keys.valueWrapper - Wrapper for the values.AdvancedCache where all operations will use the supplied wrappers.public abstract AdvancedCache rewrap(AdvancedCache newDelegate)
AdvancedCache<?, ?>,
and returning the proper type would require erasure anyway.public DataConversion getKeyDataConversion()
getKeyDataConversion in interface AdvancedCache<K,V>DataConversion for the keys.public DataConversion getValueDataConversion()
getValueDataConversion in interface AdvancedCache<K,V>DataConversion for the cache's values.protected final void putForExternalRead(K key, V value, EnumSet<Flag> flags, ClassLoader classLoader)
protected final void putForExternalRead(K key, V value, Metadata metadata, EnumSet<Flag> flags, ClassLoader classLoader)
public CompletableFuture<Map<K,V>> getAllAsync(Set<?> keys)
AsyncCachegetAllAsync in interface AsyncCache<K,V>getAllAsync in class AbstractDelegatingCache<K,V>Copyright © 2022 JBoss by Red Hat. All rights reserved.