@MBean(objectName="Cache",
description="Component that represents a simplified cache instance.")
public class SimpleCacheImpl<K,V>
extends Object
implements AdvancedCache<K,V>
AdvancedCache since it is too troublesome to omit that.| Modifier and Type | Class and Description |
|---|---|
protected static class |
SimpleCacheImpl.CacheEntryChange<K,V> |
protected class |
SimpleCacheImpl.CacheEntrySet |
protected class |
SimpleCacheImpl.EntrySet |
protected class |
SimpleCacheImpl.EntrySetBase<T extends Map.Entry<K,V>> |
protected class |
SimpleCacheImpl.KeySet |
protected static class |
SimpleCacheImpl.ValueAndMetadata<V> |
protected class |
SimpleCacheImpl.Values |
| Constructor and Description |
|---|
SimpleCacheImpl(String cacheName) |
| Modifier and Type | Method and Description |
|---|---|
<C> CompletionStage<Void> |
addFilteredListenerAsync(Object listener,
CacheEventFilter<? super K,? super V> filter,
CacheEventConverter<? super K,? super V,C> converter,
Set<Class<? extends Annotation>> filterAnnotations)
Asynchronous version of
FilteringListenable.addFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set) |
CompletionStage<Void> |
addListenerAsync(Object listener)
Asynchronous version of
Listenable.addListener(Object) |
<C> CompletionStage<Void> |
addListenerAsync(Object listener,
CacheEventFilter<? super K,? super V> filter,
CacheEventConverter<? super K,? super V,C> converter)
Asynchronous version of
FilteringListenable.addListener(Object, CacheEventFilter, CacheEventConverter) |
<C> CompletionStage<Void> |
addStorageFormatFilteredListenerAsync(Object listener,
CacheEventFilter<? super K,? super V> filter,
CacheEventConverter<? super K,? super V,C> converter,
Set<Class<? extends Annotation>> filterAnnotations)
|
CacheSet<CacheEntry<K,V>> |
cacheEntrySet()
Identical to
Cache.entrySet() but is typed to return CacheEntries instead of Entries. |
protected boolean |
checkExpiration(InternalCacheEntry<K,V> entry,
long now) |
void |
clear()
Removes all mappings from the cache.
|
CompletableFuture<Void> |
clearAsync()
Asynchronous version of
Map.clear(). |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.compute(Object, BiFunction) which takes in lifespan parameters. |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.compute(Object, BiFunction) which takes in lifespan and maxIdleTime parameters. |
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) |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan parameters. |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan and maxIdleTime parameters. |
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. |
protected V |
computeIfAbsentInternal(K key,
Function<? super K,? extends V> mappingFunction,
ByRef<V> newValueRef) |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan parameters. |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan and maxIdleTime parameters. |
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. |
protected V |
computeIfPresentInternal(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
SimpleCacheImpl.CacheEntryChange<K,V> ref) |
protected V |
computeInternal(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
SimpleCacheImpl.CacheEntryChange<K,V> ref) |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
void |
endBatch(boolean successful)
Completes a batch if one has been started using
BatchingCache.startBatch(). |
CacheSet<Map.Entry<K,V>> |
entrySet()
Returns a set view of the mappings contained in this cache and cache loader across the entire cluster.
|
void |
evict(K key)
Evicts an entry from the memory of the cache.
|
void |
forEach(BiConsumer<? super K,? super V> action) |
V |
get(Object key) |
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. |
protected V |
getAndPutInternal(K key,
V value,
Metadata metadata) |
protected V |
getAndReplaceInternal(K key,
V value,
Metadata metadata) |
CompletableFuture<V> |
getAsync(K key)
Asynchronous version of
Map.get(Object) that allows user code to
retrieve the value associated with a key at a later stage, hence allowing
multiple parallel get requests to be sent. |
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.
|
Configuration |
getCacheConfiguration() |
CacheEntry<K,V> |
getCacheEntry(Object k)
Retrieves a CacheEntry corresponding to a specific key.
|
CompletableFuture<CacheEntry<K,V>> |
getCacheEntryAsync(Object key)
Retrieves a CacheEntry corresponding to a specific key.
|
EmbeddedCacheManager |
getCacheManager()
Retrieves the cache manager responsible for creating this cache instance.
|
String |
getCacheName() |
String |
getCacheStatus() |
ClassLoader |
getClassLoader()
Returns the cache loader associated associated with this cache.
|
ComponentRegistry |
getComponentRegistry() |
Properties |
getConfigurationAsProperties() |
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() |
Set<Object> |
getListeners()
Deprecated.
|
LockManager |
getLockManager()
Returns the component that deals with all aspects of acquiring and releasing locks for cache entries.
|
String |
getName()
Retrieves the name of the cache
|
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. |
ComponentStatus |
getStatus() |
protected Supplier<Stream<CacheEntry<K,V>>> |
getStreamSupplier(boolean parallel) |
TransactionManager |
getTransactionManager() |
DataConversion |
getValueDataConversion() |
String |
getVersion()
Retrieves the version of Infinispan
|
XAResource |
getXAResource()
Returns the
XAResource associated with this cache which can be used to do transactional recovery. |
boolean |
isEmpty() |
CacheSet<K> |
keySet()
Returns a set view of the keys contained in this cache and cache loader across the entire cluster.
|
boolean |
lock(Collection<? extends K> keys)
Locks collections of keys eagerly across cache nodes in a cluster.
|
boolean |
lock(K... keys)
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) |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters. |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters. |
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. |
protected V |
mergeInternal(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
SimpleCacheImpl.CacheEntryChange<K,V> ref,
Metadata metadata) |
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)
If the return value of this operation will be ignored by the application,
the user is strongly encouraged to use the
Flag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently
as possible (i.e. |
V |
put(K key,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
BasicCache.put(Object, Object), which takes in lifespan parameters. |
V |
put(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
BasicCache.put(Object, Object), which takes in lifespan parameters. |
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) |
void |
putAll(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit unit)
An overloaded form of
Map.putAll(Map), which takes in lifespan parameters. |
void |
putAll(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
Map.putAll(Map), which takes in lifespan parameters. |
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> data)
Asynchronous version of
Map.putAll(Map). |
CompletableFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data,
long lifespan,
TimeUnit unit)
Asynchronous version of
BasicCache.putAll(Map, long, TimeUnit). |
CompletableFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.putAll(Map, long, TimeUnit, long, TimeUnit). |
CompletableFuture<Void> |
putAllAsync(Map<? extends K,? extends V> map,
Metadata metadata) |
protected void |
putAllInternal(Map<? extends K,? extends V> map,
Metadata metadata) |
CompletableFuture<V> |
putAsync(K key,
V value)
Asynchronous version of
BasicCache.put(Object, Object). |
CompletableFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of
BasicCache.put(Object, Object, long, TimeUnit) . |
CompletableFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit). |
CompletableFuture<V> |
putAsync(K key,
V value,
Metadata metadata)
Asynchronous version of
AdvancedCache.put(Object, Object, Metadata) which stores metadata alongside the value. |
void |
putForExternalRead(K key,
V value)
Under special operating behavior, associates the value with the specified key.
|
void |
putForExternalRead(K key,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
#putForExternalRead(K, V), which takes in lifespan parameters. |
void |
putForExternalRead(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
An overloaded form of
#putForExternalRead(K, V), which takes in lifespan parameters. |
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 |
putForExternalReadInternal(K key,
V value,
Metadata metadata,
ByRef.Boolean isCreatedRef) |
V |
putIfAbsent(K key,
V value) |
V |
putIfAbsent(K key,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
ConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters. |
V |
putIfAbsent(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters. |
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)
Asynchronous version of
ConcurrentMap.putIfAbsent(Object, Object). |
CompletableFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of
BasicCache.putIfAbsent(Object, Object, long, TimeUnit) . |
CompletableFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit). |
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. |
protected V |
putIfAbsentInternal(K key,
V value,
Metadata metadata) |
V |
remove(Object key)
If the return value of this operation will be ignored by the application,
the user is strongly encouraged to use the
Flag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently
as possible (i.e. |
boolean |
remove(Object key,
Object value) |
CompletableFuture<V> |
removeAsync(Object key)
Asynchronous version of
BasicCache.remove(Object). |
CompletableFuture<Boolean> |
removeAsync(Object key,
Object value)
Asynchronous version of
ConcurrentMap.remove(Object, Object). |
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.
|
CompletionStage<Void> |
removeListenerAsync(Object listener)
Asynchronous version of
Listenable.removeListener(Object) |
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) |
V |
replace(K key,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
ConcurrentMap.replace(Object, Object), which takes in lifespan parameters. |
V |
replace(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.replace(Object, Object), which takes in lifespan parameters. |
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 newValue) |
boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
ConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters. |
boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters. |
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. |
void |
replaceAll(BiFunction<? super K,? super V,? extends V> function) |
CompletableFuture<V> |
replaceAsync(K key,
V value)
Asynchronous version of
ConcurrentMap.replace(Object, Object). |
CompletableFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of
BasicCache.replace(Object, Object, long, TimeUnit). |
CompletableFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit). |
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)
Asynchronous version of
ConcurrentMap.replace(Object, Object, Object). |
CompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit unit)
Asynchronous version of
BasicCache.replace(Object, Object, Object, long, TimeUnit). |
CompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit). |
CompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
Metadata metadata) |
protected boolean |
replaceInternal(K key,
V oldValue,
V value,
Metadata metadata) |
void |
setAvailability(AvailabilityMode availabilityMode)
Manually change the availability of the cache.
|
int |
size()
Returns a count of all elements in this cache and cache loader across the entire cluster.
|
CompletableFuture<Long> |
sizeAsync()
Asynchronous version of
Map.size(). |
void |
start()
Invoked on component start
|
boolean |
startBatch()
Starts a batch.
|
void |
stop()
Stops a cache.
|
String |
toString() |
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. |
CacheCollection<V> |
values()
Returns a collection view of the values contained in this cache across the entire cluster.
|
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<Object,Object> |
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)
Performs any cache operations using the specified
Wrapper. |
AdvancedCache<K,V> |
withWrapping(Class<? extends Wrapper> keyWrapper,
Class<? extends Wrapper> valueWrapper)
Performs any cache operations using the specified pair of
Wrapper. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, getAndPutAll, merge, mergeAsync, withFlagscompute, compute, compute, computeAsync, computeAsync, computeAsync, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, merge, merge, merge, mergeAsync, mergeAsync, mergeAsync, shutdowncontainsKeyAsyncgetOrDefaultaddFilteredListener, addListener, addStorageFormatFilteredListeneraddListener, removeListenerpublic SimpleCacheImpl(String cacheName)
@ManagedOperation(description="Starts the cache.",
displayName="Starts cache.")
public void start()
Lifecycle@ManagedOperation(description="Stops the cache.",
displayName="Stops cache.")
public void stop()
CacheCache.shutdown() method.public void putForExternalRead(K key, V value)
CacheConcurrentMap.putIfAbsent(Object, Object))
putForExternalRead in interface Cache<K,V>key - key with which the specified value is to be associated.value - value to be associated with the specified key.public void putForExternalRead(K key, V value, long lifespan, TimeUnit unit)
Cache#putForExternalRead(K, V), which takes in lifespan parameters.putForExternalRead in interface Cache<K,V>key - key to usevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit - unit of measurement for the lifespanpublic void putForExternalRead(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
Cache#putForExternalRead(K, V), which takes in lifespan parameters.putForExternalRead in interface Cache<K,V>key - key to usevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit - time unit for max idle timepublic 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 valueprotected void putForExternalReadInternal(K key, V value, Metadata metadata, ByRef.Boolean isCreatedRef)
public 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 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 CompletableFuture<Map<K,V>> getAllAsync(Set<?> keys)
AsyncCachegetAllAsync in interface AsyncCache<K,V>public CacheEntry<K,V> getCacheEntry(Object k)
AdvancedCachegetCacheEntry in interface AdvancedCache<K,V>k - 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 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>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>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>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>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>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>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>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>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>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>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>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>public 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 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>public void evict(K key)
CacheBasicCache.remove(Object) to remove an
entry from the entire cache system.
This method is designed to evict an entry from memory to free up memory used by the application. This method uses
a 0 lock acquisition timeout so it does not block in attempting to acquire locks. It behaves as a no-op if the
lock on the entry cannot be acquired immediately.
Important: this method should not be called from within a transaction scope.public Configuration getCacheConfiguration()
getCacheConfiguration in interface Cache<K,V>public EmbeddedCacheManager getCacheManager()
CachegetCacheManager in interface Cache<K,V>public AdvancedCache<K,V> getAdvancedCache()
getAdvancedCache in interface Cache<K,V>public ComponentStatus getStatus()
@ManagedAttribute(description="Returns the cache status",
displayName="Cache status",
dataType=TRAIT)
public String getCacheStatus()
protected boolean checkExpiration(InternalCacheEntry<K,V> entry, long now)
public int size()
CacheFlag.SKIP_CACHE_LOAD flag should be used to
avoid hitting the cache loader in case if this is not needed in the size calculation.
Also if you want the local contents only you can use the Flag.CACHE_MODE_LOCAL flag so
that other remote nodes are not queried for data. However the loader will still be used unless the previously
mentioned Flag.SKIP_CACHE_LOAD is also configured.
If this method is used in a transactional context, note this method will not bring additional values into the
transaction context and thus objects that haven't yet been read will act in a
IsolationLevel.READ_COMMITTED behavior irrespective of the configured
isolation level. However values that have been previously modified or read that are in the context will be
adhered to. e.g. any write modification or any previous read when using
IsolationLevel.REPEATABLE_READ
This method should only be used for debugging purposes such as to verify that the cache contains all the keys
entered. Any other use involving execution of this method on a production system is not recommended.
public CompletableFuture<Long> sizeAsync()
AsyncCacheMap.size(). This method does not block on remote calls, even if your cache mode is
synchronous.sizeAsync in interface AsyncCache<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>public CacheSet<K> keySet()
CacheSet.toArray(), Set.toArray(Object[]),
Set.size(), Set.retainAll(Collection) and Set.iterator()
methods as they will traverse the entire contents of the cluster including a configured
CacheLoader and remote entries. The former 2 methods especially have a
very high likely hood of causing a OutOfMemoryError due to storing all the keys in the entire
cluster in the array.
Use involving execution of this method on a production system is not recommended as they can be quite expensive
operations
Flag.SKIP_CACHE_LOAD flag should be used to
avoid hitting the cache store as this will cause all entries there to be read in (albeit in a batched form to
prevent OutOfMemoryError)
Also if you want the local contents only you can use the Flag.CACHE_MODE_LOCAL flag so
that other remote nodes are not queried for data. However the loader will still be used unless the previously
mentioned Flag.SKIP_CACHE_LOAD is also configured.
CloseableIteratorSet interface which creates a
CloseableIterator instead of a regular one. This means this iterator must be
explicitly closed either through try with resource or calling the close method directly. Technically this iterator
will also close itself if you iterate fully over it, but it is safest to always make sure you close it explicitly.
UnsupportedOperationException if invoked.
Set.add(Object)
Set.addAll(java.util.Collection)public CacheCollection<V> values()
CacheCollection.toArray(), Collection.toArray(Object[]),
Collection.size(), Collection.retainAll(Collection) and Collection.iterator()
methods as they will traverse the entire contents of the cluster including a configured
CacheLoader and remote entries. The former 2 methods especially have a
very high likely hood of causing a OutOfMemoryError due to storing all the keys in the entire
cluster in the array.
Use involving execution of this method on a production system is not recommended as they can be quite expensive
operations
* Flag.SKIP_CACHE_LOAD flag should be used to
avoid hitting the cache store as this will cause all entries there to be read in (albeit in a batched form to
prevent OutOfMemoryError)
Also if you want the local contents only you can use the Flag.CACHE_MODE_LOCAL flag so
that other remote nodes are not queried for data. However the loader will still be used unless the previously
mentioned Flag.SKIP_CACHE_LOAD is also configured.
This class implements the CloseableIteratorCollection interface which creates a
CloseableIterator instead of a regular one. This means this iterator must be
explicitly closed either through try with resource or calling the close method directly. Technically this iterator
will also close itself if you iterate fully over it, but it is safest to always make sure you close it explicitly.
The iterator retrieved using CloseableIteratorCollection.iterator() supports the remove method, however the
iterator retrieved from CacheStream.iterator() will not support remove.
UnsupportedOperationException if invoked.
Set.add(Object)
Set.addAll(java.util.Collection)public CacheSet<Map.Entry<K,V>> entrySet()
CacheSet.toArray(), Set.toArray(Object[]),
Set.size(), Set.retainAll(Collection) and Set.iterator()
methods as they will traverse the entire contents of the cluster including a configured
CacheLoader and remote entries. The former 2 methods especially have a
very high likely hood of causing a OutOfMemoryError due to storing all the keys in the entire
cluster in the array.
Use involving execution of this method on a production system is not recommended as they can be quite expensive
operations
* Flag.SKIP_CACHE_LOAD flag should be used to
avoid hitting the cache store as this will cause all entries there to be read in (albeit in a batched form to
prevent OutOfMemoryError)
Also if you want the local contents only you can use the Flag.CACHE_MODE_LOCAL flag so
that other remote nodes are not queried for data. However the loader will still be used unless the previously
mentioned Flag.SKIP_CACHE_LOAD is also configured.
Map.Entry.setValue(Object) and it will update
the cache as well. Also this backing set does allow addition of a new Map.Entry(s) via the
Set.add(Object) or Set.addAll(java.util.Collection) methods.
CloseableIteratorSet interface which creates a
CloseableIterator instead of a regular one. This means this iterator must be
explicitly closed either through try with resource or calling the close method directly. Technically this iterator
will also close itself if you iterate fully over it, but it is safest to always make sure you close it explicitly.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<Object,Object> withKeyEncoding(Class<? extends Encoder> encoder)
withKeyEncoding in interface AdvancedCache<K,V>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.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 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.@ManagedOperation(description="Clears the cache",
displayName="Clears the cache",
name="clear")
public void clear()
Cachepublic String getName()
BasicCachegetName in interface BasicCache<K,V>@ManagedAttribute(description="Returns the cache name",
displayName="Cache name",
dataType=TRAIT)
public String getCacheName()
@ManagedAttribute(description="Returns the version of Infinispan",
displayName="Infinispan version",
dataType=TRAIT)
public String getVersion()
BasicCachegetVersion in interface BasicCache<K,V>@ManagedAttribute(description="Returns the cache configuration in form of properties",
displayName="Cache configuration properties",
dataType=TRAIT)
public Properties getConfigurationAsProperties()
public V put(K key, V value)
BasicCacheFlag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently
as possible (i.e. avoiding needless remote or network calls).public V put(K key, V value, long lifespan, TimeUnit unit)
BasicCacheBasicCache.put(Object, Object), which takes in lifespan parameters.put in interface BasicCache<K,V>key - key to usevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit - unit of measurement for the lifespanpublic V putIfAbsent(K key, V value, long lifespan, TimeUnit unit)
BasicCacheConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.putIfAbsent in interface BasicCache<K,V>key - key to usevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit - unit of measurement for the lifespanpublic 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 void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit)
BasicCacheMap.putAll(Map), which takes in lifespan parameters. Note that the lifespan is applied
to all mappings in the map passed in.putAll in interface BasicCache<K,V>map - map containing mappings to enterlifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit - unit of measurement for the lifespanpublic V replace(K key, V value, long lifespan, TimeUnit unit)
BasicCacheConcurrentMap.replace(Object, Object), which takes in lifespan parameters.replace in interface BasicCache<K,V>key - key to usevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit - unit of measurement for the lifespanpublic boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit unit)
BasicCacheConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.replace in interface BasicCache<K,V>key - key to useoldValue - value to replacevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit - unit of measurement for the lifespanpublic V put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheBasicCache.put(Object, Object), which takes in lifespan parameters.put in interface BasicCache<K,V>key - key to usevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timepublic V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.putIfAbsent in interface BasicCache<K,V>key - key to usevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timepublic void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheMap.putAll(Map), which takes in lifespan parameters. Note that the lifespan is applied
to all mappings in the map passed in.putAll in interface BasicCache<K,V>map - map containing mappings to enterlifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timepublic V replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheConcurrentMap.replace(Object, Object), which takes in lifespan parameters.replace in interface BasicCache<K,V>key - key to usevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timepublic boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.replace in interface BasicCache<K,V>key - key to useoldValue - value to replacevalue - value to storelifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timepublic 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 V remove(Object key)
BasicCacheFlag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently
as possible (i.e. avoiding needless remote or network calls).public CompletableFuture<V> putAsync(K key, V value)
AsyncCacheBasicCache.put(Object, Object). This method does not block on remote calls, even if your
cache mode is synchronous.putAsync in interface AsyncCache<K,V>key - key to usevalue - value to storepublic CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit unit)
AsyncCacheBasicCache.put(Object, Object, long, TimeUnit) . This method does not block on remote
calls, even if your cache mode is synchronous.putAsync in interface AsyncCache<K,V>key - key to usevalue - value to storelifespan - lifespan of entryunit - time unit for lifespanpublic CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCacheBasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block
on remote calls, even if your cache mode is synchronous.putAsync in interface AsyncCache<K,V>key - key to usevalue - value to storelifespan - lifespan of entrylifespanUnit - time unit for lifespanmaxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit - time unit for max idle timepublic CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> data)
AsyncCacheMap.putAll(Map). This method does not block on remote calls, even if your cache mode
is synchronous.putAllAsync in interface AsyncCache<K,V>data - to storepublic CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit unit)
AsyncCacheBasicCache.putAll(Map, long, TimeUnit). This method does not block on remote calls, even if
your cache mode is synchronous.putAllAsync in interface AsyncCache<K,V>data - to storelifespan - lifespan of entryunit - time unit for lifespanpublic CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCacheBasicCache.putAll(Map, long, TimeUnit, long, TimeUnit). This method does not block on
remote calls, even if your cache mode is synchronous.putAllAsync in interface AsyncCache<K,V>data - to storelifespan - lifespan of entrylifespanUnit - time unit for lifespanmaxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit - time unit for max idle timepublic CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> map, Metadata metadata)
putAllAsync in interface AdvancedCache<K,V>public CompletableFuture<Void> clearAsync()
AsyncCacheMap.clear(). This method does not block on remote calls, even if your cache mode is
synchronous.clearAsync in interface AsyncCache<K,V>public CompletableFuture<V> putIfAbsentAsync(K key, V value)
AsyncCacheConcurrentMap.putIfAbsent(Object, Object). This method does not block on remote calls, even if
your cache mode is synchronous.putIfAbsentAsync in interface AsyncCache<K,V>key - key to usevalue - value to storepublic CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit unit)
AsyncCacheBasicCache.putIfAbsent(Object, Object, long, TimeUnit) . This method does not block on
remote calls, even if your cache mode is synchronous.putIfAbsentAsync in interface AsyncCache<K,V>key - key to usevalue - value to storelifespan - lifespan of entryunit - time unit for lifespanpublic CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCacheBasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit). This method does
not block on remote calls, even if your cache mode is synchronous.putIfAbsentAsync in interface AsyncCache<K,V>key - key to usevalue - value to storelifespan - lifespan of entrylifespanUnit - time unit for lifespanmaxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit - time unit for max idle timepublic 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> removeAsync(Object key)
AsyncCacheBasicCache.remove(Object). This method does not block on remote calls, even if your cache
mode is synchronous.removeAsync in interface AsyncCache<K,V>key - key to removepublic CompletableFuture<Boolean> removeAsync(Object key, Object value)
AsyncCacheConcurrentMap.remove(Object, Object). This method does not block on remote calls, even if your
cache mode is synchronous.removeAsync in interface AsyncCache<K,V>key - key to removevalue - value to match onpublic CompletableFuture<V> replaceAsync(K key, V value)
AsyncCacheConcurrentMap.replace(Object, Object). This method does not block on remote calls, even if
your cache mode is synchronous.replaceAsync in interface AsyncCache<K,V>key - key to removevalue - value to storepublic CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit unit)
AsyncCacheBasicCache.replace(Object, Object, long, TimeUnit). This method does not block on remote
calls, even if your cache mode is synchronous.replaceAsync in interface AsyncCache<K,V>key - key to removevalue - value to storelifespan - lifespan of entryunit - time unit for lifespanpublic CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCacheBasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit). This method does not
block on remote calls, even if your cache mode is synchronous.replaceAsync in interface AsyncCache<K,V>key - key to removevalue - value to storelifespan - lifespan of entrylifespanUnit - time unit for lifespanmaxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit - time unit for max idle timepublic CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
AsyncCacheConcurrentMap.replace(Object, Object, Object). This method does not block on remote calls,
even if your cache mode is synchronous.replaceAsync in interface AsyncCache<K,V>key - key to removeoldValue - value to overwritenewValue - value to storepublic CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit)
AsyncCacheBasicCache.replace(Object, Object, Object, long, TimeUnit). This method does not block on
remote calls, even if your cache mode is synchronous.replaceAsync in interface AsyncCache<K,V>key - key to removeoldValue - value to overwritenewValue - value to storelifespan - lifespan of entryunit - time unit for lifespanpublic CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCacheBasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit). This method
does not block on remote calls, even if your cache mode is synchronous.replaceAsync in interface AsyncCache<K,V>key - key to removeoldValue - value to overwritenewValue - value to storelifespan - lifespan of entrylifespanUnit - time unit for lifespanmaxIdle - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit - time unit for max idle timepublic 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 CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, Metadata metadata)
replaceAsync in interface AdvancedCache<K,V>public CompletableFuture<V> getAsync(K key)
AsyncCacheMap.get(Object) that allows user code to
retrieve the value associated with a key at a later stage, hence allowing
multiple parallel get requests to be sent. Normally, when this method
detects that the value is likely to be retrieved from from a remote
entity, it will span a different thread in order to allow the
asynchronous get call to return immediately. If the call will definitely
resolve locally, for example when the cache is configured with LOCAL mode
and no stores are configured, the get asynchronous call will act
sequentially and will have no different to Map.get(Object).getAsync in interface AsyncCache<K,V>key - key to retrieveMap.get(Object)public boolean startBatch()
BatchingCachestartBatch in interface BatchingCachepublic void endBatch(boolean successful)
BatchingCacheBatchingCache.startBatch(). If no batch has been started, this is a
no-op.
endBatch in interface BatchingCachesuccessful - if true, the batch completes, otherwise the batch is aborted and changes are not committed.public V putIfAbsent(K key, V value)
putIfAbsent in interface ConcurrentMap<K,V>putIfAbsent in interface Map<K,V>public <C> CompletionStage<Void> addListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter)
FilteringListenableFilteringListenable.addListener(Object, CacheEventFilter, CacheEventConverter)addListenerAsync in interface FilteringListenable<K,V>listener - listener to add, must not be nullpublic CompletionStage<Void> addListenerAsync(Object listener)
ListenableListenable.addListener(Object)addListenerAsync in interface Listenablelistener - listener to add, must not be nullpublic CompletionStage<Void> removeListenerAsync(Object listener)
ListenableListenable.removeListener(Object)removeListenerAsync in interface Listenablelistener - listener to remove, must not be null@Deprecated public Set<Object> getListeners()
getListeners in interface Listenablepublic <C> CompletionStage<Void> addFilteredListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
FilteringListenableFilteringListenable.addFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)addFilteredListenerAsync in interface FilteringListenable<K,V>public <C> CompletionStage<Void> addStorageFormatFilteredListenerAsync(Object listener, CacheEventFilter<? super K,? super V> filter, CacheEventConverter<? super K,? super V,C> converter, Set<Class<? extends Annotation>> filterAnnotations)
FilteringListenableFilteringListenable.addStorageFormatFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)addStorageFormatFilteredListenerAsync in interface FilteringListenable<K,V>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 subject@Deprecated public AsyncInterceptorChain getAsyncInterceptorChain()
AdvancedCachegetAsyncInterceptorChain in interface AdvancedCache<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 boolean lock(K... keys)
AdvancedCacheKeys can be locked eagerly in the context of a transaction only.
lock in interface AdvancedCache<K,V>keys - 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 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 Stats getStats()
AdvancedCacheStats object that allows several statistics associated with this cache at runtime.getStats in interface AdvancedCache<K,V>Stats objectpublic XAResource getXAResource()
AdvancedCacheXAResource associated with this cache which can be used to do transactional recovery.getXAResource in interface AdvancedCache<K,V>XAResourcepublic ClassLoader getClassLoader()
AdvancedCacheDecoratedCache wrapper.getClassLoader in interface AdvancedCache<K,V>public AdvancedCache<K,V> with(ClassLoader classLoader)
with in interface AdvancedCache<K,V>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 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 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 V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
Cache
When this method is used on a clustered cache, either replicated or distributed, the function will be serialized
to owning nodes to perform the operation in the most performant way. However this means the function must
have an appropriate Externalizer or be Serializable itself.
For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection must be copied and not directly modified, otherwise whenever rollback is called it won't work. This limitation could disappear in following releases if technically possible.
computeIfAbsent in interface ConcurrentMap<K,V>computeIfAbsent in interface Map<K,V>computeIfAbsent in interface Cache<K,V>public 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 computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit)
BasicCacheConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan parameters.computeIfAbsent in interface BasicCache<K,V>key - key to usemappingFunction - function to use to compute and store the value under key, if the key is absentlifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanpublic V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan and maxIdleTime parameters.computeIfAbsent in interface BasicCache<K,V>key - key to usemappingFunction - function to use to compute and store the value under key, if the key is absentlifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timeprotected V computeIfAbsentInternal(K key, Function<? super K,? extends V> mappingFunction, ByRef<V> newValueRef)
public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
Cache
When this method is used on a clustered cache, either replicated or distributed, the bifunction will be serialized
to owning nodes to perform the operation in the most performant way. However this means the bifunction must
have an appropriate Externalizer or be Serializable itself.
For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection must be copied and not directly modified, otherwise whenever rollback is called it won't work. This limitation could disappear in following releases if technically possible.
computeIfPresent in interface ConcurrentMap<K,V>computeIfPresent in interface Map<K,V>computeIfPresent in interface Cache<K,V>public V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
BasicCacheConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan parameters.computeIfPresent in interface BasicCache<K,V>key - key to useremappingFunction - function to use to compute and store the value under key, if such existslifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanpublic V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan and maxIdleTime parameters.computeIfPresent in interface BasicCache<K,V>key - key to useremappingFunction - function to use to compute and store the value under key, if such existslifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timepublic 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 valueprotected V computeIfPresentInternal(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K,V> ref)
public V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
Cache
When this method is used on a clustered cache, either replicated or distributed, the bifunction will be serialized
to owning nodes to perform the operation in the most performant way. However this means the bifunction must
have an appropriate Externalizer or be Serializable itself.
For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection must be copied and not directly modified, otherwise whenever rollback is called it won't work. This limitation could disappear in following releases if technically possible.
public V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
BasicCacheConcurrentMap.compute(Object, BiFunction) which takes in lifespan parameters.compute in interface BasicCache<K,V>key - key to useremappingFunction - function to use to compute and store the value under keylifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanpublic V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheConcurrentMap.compute(Object, BiFunction) which takes in lifespan and maxIdleTime parameters.compute in interface BasicCache<K,V>key - key to useremappingFunction - function to use to compute and store the value under keylifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timepublic 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 valueprotected V computeInternal(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K,V> ref)
public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
Cache
When this method is used on a clustered cache, either replicated or distributed, the bifunction will be serialized
to owning nodes to perform the operation in the most performant way. However this means the bifunction must
have an appropriate Externalizer or be Serializable itself.
For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection must be copied and not directly modified, otherwise whenever rollback is called it won't work. This limitation could disappear in following releases if technically possible.
public V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
BasicCacheConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters.merge in interface BasicCache<K,V>key - key to usevalue - new value to merge with existing valueremappingFunction - function to use to merge new and existing values into a merged value to store under keylifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanpublic V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCacheConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters.merge in interface BasicCache<K,V>key - key to usevalue - new value to merge with existing valueremappingFunction - function to use to merge new and existing values into a merged value to store under keylifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit - time unit for lifespanmaxIdleTime - the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit - time unit for max idle timepublic 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>protected V mergeInternal(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, SimpleCacheImpl.CacheEntryChange<K,V> ref, Metadata metadata)
public void forEach(BiConsumer<? super K,? super V> action)
public void replaceAll(BiFunction<? super K,? super V,? extends V> function)
replaceAll in interface ConcurrentMap<K,V>replaceAll in interface Map<K,V>protected Supplier<Stream<CacheEntry<K,V>>> getStreamSupplier(boolean parallel)
Copyright © 2022 JBoss by Red Hat. All rights reserved.