Class AbstractDelegatingCache<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,,V> Map<K,,V> Cache<K,,V> InternalCache<K,,V> AsyncCache<K,,V> BasicCache<K,,V> BatchingCache,Lifecycle,FilteringListenable<K,,V> Listenable
- Direct Known Subclasses:
AbstractDelegatingAdvancedCache
Cache
argument, to which each method call is delegated. One can extend this class and override the method sub-set it is
interested in. There is also a similar implementation for AdvancedCache: AbstractDelegatingAdvancedCache.- Author:
- Mircea.Markus@jboss.com
- See Also:
-
Nested Class Summary
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<C> voidaddFilteredListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, Set<Class<? extends Annotation>> filterAnnotations) Registers a listener limiting the cache-entry specific events only to annotations that are passed in as parameter.<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 ofFilteringListenable.addFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)voidaddListener(Object listener) Adds a listener to the component.<C> voidaddListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter) Registers a listener that will be notified on events that pass the filter condition.addListenerAsync(Object listener) Asynchronous version ofListenable.addListener(Object)<C> CompletionStage<Void> addListenerAsync(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter) Asynchronous version ofFilteringListenable.addListener(Object, CacheEventFilter, CacheEventConverter)<C> voidaddStorageFormatFilteredListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, Set<Class<? extends Annotation>> filterAnnotations) Same asFilteringListenable.addFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set), but assumes the filter and/or the converter will be done in the same data format as it's stored in the cache.<C> CompletionStage<Void> addStorageFormatFilteredListenerAsync(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, Set<Class<? extends Annotation>> filterAnnotations) voidclear()Removes all mappings from the cache.Asynchronous version ofMap.clear().compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) An overloaded form ofConcurrentMap.compute(Object, BiFunction)which takes in lifespan parameters.compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.compute(Object, BiFunction)which takes in lifespan and maxIdleTime parameters.computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.compute(Object, BiFunction).computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit).computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit, long, TimeUnit).computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) An overloaded form ofConcurrentMap.computeIfAbsent(Object, Function)which takes in lifespan parameters.computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.computeIfAbsent(Object, Function)which takes in lifespan and maxIdleTime parameters.computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction) Asynchronous version ofConcurrentMap.computeIfAbsent(Object, Function).computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit).computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit).computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) An overloaded form ofConcurrentMap.computeIfPresent(Object, BiFunction)which takes in lifespan parameters.computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.computeIfPresent(Object, BiFunction)which takes in lifespan and maxIdleTime parameters.computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.computeIfPresent(Object, BiFunction).computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit).computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit).booleancontainsKey(Object key) booleancontainsValue(Object value) voidendBatch(boolean successful) Completes a batch if one has been started usingBatchingCache.startBatch().entrySet()Returns a set view of the mappings contained in this cache and cache loader across the entire cluster.voidEvicts an entry from the memory of the cache.voidforEach(BiConsumer<? super K, ? super V> action) getAllAsync(Set<?> keys) TODO This should be in AdvancedCache with getAllAsynchronous version ofMap.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.Retrieves the cache manager responsible for creating this cache instance.Returns String representation of ComponentStatus enumeration in order to avoid class not found exceptions in JMX tools that don't have access to infinispan classes.getName()Retrieves the name of the cachegetOrDefault(Object key, V defaultValue) Retrieves the version of InfinispanbooleanisEmpty()keySet()Returns a set view of the keys contained in this cache and cache loader across the entire cluster.merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) An overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)which takes in lifespan parameters.merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)which takes in lifespan parameters.mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.merge(Object, Object, BiFunction).mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit).mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit).If the return value of this operation will be ignored by the application, the user is strongly encouraged to use theorg.infinispan.context.Flag#IGNORE_RETURN_VALUESflag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).An overloaded form ofBasicCache.put(Object, Object), which takes in lifespan parameters.put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofBasicCache.put(Object, Object), which takes in lifespan parameters.voidvoidAn overloaded form ofMap.putAll(Map), which takes in lifespan parameters.voidputAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofMap.putAll(Map), which takes in lifespan parameters.putAllAsync(Map<? extends K, ? extends V> data) Asynchronous version ofMap.putAll(Map).putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.putAll(Map, long, TimeUnit).putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.putAll(Map, long, TimeUnit, long, TimeUnit).Asynchronous version ofBasicCache.put(Object, Object).Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit).Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit).voidputForExternalRead(K key, V value) Under special operating behavior, associates the value with the specified key.voidputForExternalRead(K key, V value, long lifespan, TimeUnit unit) An overloaded form ofCache.putForExternalRead(K, V), which takes in lifespan parameters.voidputForExternalRead(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) An overloaded form ofCache.putForExternalRead(K, V), which takes in lifespan parameters.putIfAbsent(K key, V value) putIfAbsent(K key, V value, long lifespan, TimeUnit unit) An overloaded form ofConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.putIfAbsentAsync(K key, V value) Asynchronous version ofConcurrentMap.putIfAbsent(Object, Object).putIfAbsentAsync(K key, V value, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit).putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit).<T> Query<T> If the return value of this operation will be ignored by the application, the user is strongly encouraged to use theorg.infinispan.context.Flag#IGNORE_RETURN_VALUESflag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls).booleanremoveAsync(Object key) Asynchronous version ofBasicCache.remove(Object).removeAsync(Object key, Object value) Asynchronous version ofConcurrentMap.remove(Object, Object).voidremoveListener(Object listener) Removes a listener from the component.removeListenerAsync(Object listener) Asynchronous version ofListenable.removeListener(Object)An overloaded form ofConcurrentMap.replace(Object, Object), which takes in lifespan parameters.replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.replace(Object, Object), which takes in lifespan parameters.booleanbooleanAn overloaded form ofConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.booleanreplace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.voidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) replaceAsync(K key, V value) Asynchronous version ofConcurrentMap.replace(Object, Object).replaceAsync(K key, V value, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit).replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit).replaceAsync(K key, V oldValue, V newValue) Asynchronous version ofConcurrentMap.replace(Object, Object, Object).replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit).replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit).voidshutdown()Performs a controlled, clustered shutdown of the cache.intsize()Returns a count of all elements in this cache and cache loader across the entire cluster.Asynchronous version ofMap.size().voidstart()Invoked on component startbooleanStarts a batch.voidstop()Stops a cache.toString()static <K,V> Cache <K, V> unwrapCache(Cache<K, V> cache) Fully unwraps a given cache returning the base cache.values()Returns a collection view of the values contained in this cache across the entire cluster.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.commons.api.AsyncCache
containsKeyAsyncMethods inherited from interface org.infinispan.Cache
compute, compute, compute, computeAsync, computeAsync, computeAsync, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, merge, merge, merge, mergeAsync, mergeAsync, mergeAsyncMethods inherited from interface org.infinispan.cache.impl.InternalCache
bypassInvocationContextFactory
-
Field Details
-
cache
-
-
Constructor Details
-
AbstractDelegatingCache
-
-
Method Details
-
getComponentRegistry
- Specified by:
getComponentRegistryin interfaceInternalCache<K,V>
-
putForExternalRead
Description copied from interface:CacheUnder special operating behavior, associates the value with the specified key.- Only goes through if the
key specified does not exist; no-op otherwise (similar to
ConcurrentMap.putIfAbsent(Object, Object)) - Force asynchronous mode for replication to prevent any blocking.
- invalidation does not take place.
- 0ms lock timeout to prevent any blocking here either. If the lock is not acquired, this method is a no-op, and swallows the timeout exception.
- Ongoing transactions are suspended before this call, so failures here will not affect any ongoing transactions.
- Errors and exceptions are 'silent' - logged at a much lower level than normal, and this method does not throw exceptions
- Specified by:
putForExternalReadin interfaceCache<K,V> - Parameters:
key- key with which the specified value is to be associated.value- value to be associated with the specified key.
- Only goes through if the
key specified does not exist; no-op otherwise (similar to
-
putForExternalRead
Description copied from interface:CacheAn overloaded form ofCache.putForExternalRead(K, V), which takes in lifespan parameters.- Specified by:
putForExternalReadin interfaceCache<K,V> - Parameters:
key- key to usevalue- value to storelifespan- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit- unit of measurement for the lifespan
-
putForExternalRead
public void putForExternalRead(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:CacheAn overloaded form ofCache.putForExternalRead(K, V), which takes in lifespan parameters.- Specified by:
putForExternalReadin interfaceCache<K,V> - Parameters:
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 time
-
evict
Description copied from interface:CacheEvicts an entry from the memory of the cache. Note that the entry is not removed from any configured cache stores or any other caches in the cluster (if used in a clustered mode). UseBasicCache.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. -
getCacheConfiguration
- Specified by:
getCacheConfigurationin interfaceCache<K,V>
-
startBatch
public boolean startBatch()Description copied from interface:BatchingCacheStarts a batch. All operations on the current client thread are performed as a part of this batch, with locks held for the duration of the batch and any remote calls delayed till the end of the batch.- Specified by:
startBatchin interfaceBatchingCache- Returns:
- true if a batch was successfully started; false if one was available and already running.
-
endBatch
public void endBatch(boolean successful) Description copied from interface:BatchingCacheCompletes a batch if one has been started usingBatchingCache.startBatch(). If no batch has been started, this is a no-op.- Specified by:
endBatchin interfaceBatchingCache- Parameters:
successful- if true, the batch completes, otherwise the batch is aborted and changes are not committed.
-
getName
Description copied from interface:BasicCacheRetrieves the name of the cache- Specified by:
getNamein interfaceBasicCache<K,V> - Returns:
- the name of the cache
-
getCacheName
@ManagedAttribute(description="Returns the cache name", displayName="Cache name", dataType=TRAIT) public String getCacheName() -
getVersion
@ManagedAttribute(description="Returns the version of Infinispan", displayName="Infinispan version", dataType=TRAIT) public String getVersion()Description copied from interface:BasicCacheRetrieves the version of Infinispan- Specified by:
getVersionin interfaceBasicCache<K,V> - Returns:
- a version string
-
getCacheManager
Description copied from interface:CacheRetrieves the cache manager responsible for creating this cache instance.- Specified by:
getCacheManagerin interfaceCache<K,V> - Returns:
- a cache manager
-
put
Description copied from interface:BasicCacheAn overloaded form ofBasicCache.put(Object, Object), which takes in lifespan parameters.- Specified by:
putin interfaceBasicCache<K,V> - Parameters:
key- key to usevalue- value to storelifespan- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit- unit of measurement for the lifespan- Returns:
- the value being replaced, or null if nothing is being replaced.
-
putIfAbsent
Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.- Specified by:
putIfAbsentin interfaceBasicCache<K,V> - Parameters:
key- key to usevalue- value to storelifespan- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit- unit of measurement for the lifespan- Returns:
- the value being replaced, or null if nothing is being replaced.
-
putAll
Description copied from interface:BasicCacheAn overloaded form ofMap.putAll(Map), which takes in lifespan parameters. Note that the lifespan is applied to all mappings in the map passed in.- Specified by:
putAllin interfaceBasicCache<K,V> - Parameters:
map- map containing mappings to enterlifespan- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit- unit of measurement for the lifespan
-
replace
Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.replace(Object, Object), which takes in lifespan parameters.- Specified by:
replacein interfaceBasicCache<K,V> - Parameters:
key- key to usevalue- value to storelifespan- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit- unit of measurement for the lifespan- Returns:
- the value being replaced, or null if nothing is being replaced.
-
replace
Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.- Specified by:
replacein interfaceBasicCache<K,V> - Parameters:
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 lifespan- Returns:
- true if the value was replaced, false otherwise
-
put
public V put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofBasicCache.put(Object, Object), which takes in lifespan parameters.- Specified by:
putin interfaceBasicCache<K,V> - Parameters:
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 time- Returns:
- the value being replaced, or null if nothing is being replaced.
-
putIfAbsent
public V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.- Specified by:
putIfAbsentin interfaceBasicCache<K,V> - Parameters:
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 time- Returns:
- the value being replaced, or null if nothing is being replaced.
-
putAll
public void putAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofMap.putAll(Map), which takes in lifespan parameters. Note that the lifespan is applied to all mappings in the map passed in.- Specified by:
putAllin interfaceBasicCache<K,V> - Parameters:
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 time
-
replace
public V replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.replace(Object, Object), which takes in lifespan parameters.- Specified by:
replacein interfaceBasicCache<K,V> - Parameters:
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 time- Returns:
- the value being replaced, or null if nothing is being replaced.
-
replace
public boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.- Specified by:
replacein interfaceBasicCache<K,V> - Parameters:
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 time- Returns:
- true if the value was replaced, false otherwise
-
replaceAll
- Specified by:
replaceAllin interfaceConcurrentMap<K,V> - Specified by:
replaceAllin interfaceMap<K,V>
-
putAsync
Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.put(Object, Object). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to usevalue- value to store- Returns:
- a future containing the old value replaced.
-
putAsync
Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.put(Object, Object, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to usevalue- value to storelifespan- lifespan of entryunit- time unit for lifespan- Returns:
- a future containing the old value replaced
-
putAsync
public CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAsyncin interfaceAsyncCache<K,V> - Parameters:
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 time- Returns:
- a future containing the old value replaced
-
putAllAsync
Description copied from interface:AsyncCacheAsynchronous version ofMap.putAll(Map). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAllAsyncin interfaceAsyncCache<K,V> - Parameters:
data- to store- Returns:
- a future containing a void return type
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.putAll(Map, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAllAsyncin interfaceAsyncCache<K,V> - Parameters:
data- to storelifespan- lifespan of entryunit- time unit for lifespan- Returns:
- a future containing a void return type
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.putAll(Map, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAllAsyncin interfaceAsyncCache<K,V> - Parameters:
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 time- Returns:
- a future containing a void return type
-
clearAsync
Description copied from interface:AsyncCacheAsynchronous version ofMap.clear(). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
clearAsyncin interfaceAsyncCache<K,V> - Returns:
- a future containing a void return type
-
putIfAbsentAsync
Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.putIfAbsent(Object, Object). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putIfAbsentAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to usevalue- value to store- Returns:
- a future containing the old value replaced.
-
putIfAbsentAsync
Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putIfAbsentAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to usevalue- value to storelifespan- lifespan of entryunit- time unit for lifespan- Returns:
- a future containing the old value replaced
-
putIfAbsentAsync
public CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putIfAbsentAsyncin interfaceAsyncCache<K,V> - Parameters:
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 time- Returns:
- a future containing the old value replaced
-
removeAsync
Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.remove(Object). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
removeAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to remove- Returns:
- a future containing the value removed
-
removeAsync
Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.remove(Object, Object). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
removeAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to removevalue- value to match on- Returns:
- a future containing a boolean, indicating whether the entry was removed or not
-
replaceAsync
Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.replace(Object, Object). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to removevalue- value to store- Returns:
- a future containing the previous value overwritten
-
replaceAsync
Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to removevalue- value to storelifespan- lifespan of entryunit- time unit for lifespan- Returns:
- a future containing the previous value overwritten
-
replaceAsync
public CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsyncin interfaceAsyncCache<K,V> - Parameters:
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 time- Returns:
- a future containing the previous value overwritten
-
replaceAsync
Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.replace(Object, Object, Object). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to removeoldValue- value to overwritenewValue- value to store- Returns:
- a future containing a boolean, indicating whether the entry was replaced or not
-
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to removeoldValue- value to overwritenewValue- value to storelifespan- lifespan of entryunit- time unit for lifespan- Returns:
- a future containing a boolean, indicating whether the entry was replaced or not
-
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsyncin interfaceAsyncCache<K,V> - Parameters:
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 time- Returns:
- a future containing a boolean, indicating whether the entry was replaced or not
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.compute(Object, BiFunction). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeAsyncin interfaceAsyncCache<K,V>
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeAsyncin interfaceAsyncCache<K,V>
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeAsyncin interfaceAsyncCache<K,V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction) Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.computeIfAbsent(Object, Function). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfAbsentAsyncin interfaceAsyncCache<K,V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfAbsentAsyncin interfaceAsyncCache<K,V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfAbsentAsyncin interfaceAsyncCache<K,V>
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.computeIfPresent(Object, BiFunction). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfPresentAsyncin interfaceAsyncCache<K,V>
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfPresentAsyncin interfaceAsyncCache<K,V>
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfPresentAsyncin interfaceAsyncCache<K,V>
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) Description copied from interface:AsyncCacheAsynchronous version ofConcurrentMap.merge(Object, Object, BiFunction). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
mergeAsyncin interfaceAsyncCache<K,V>
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
mergeAsyncin interfaceAsyncCache<K,V>
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCacheAsynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
mergeAsyncin interfaceAsyncCache<K,V>
-
getAdvancedCache
- Specified by:
getAdvancedCachein interfaceCache<K,V>
-
getStatus
-
getCacheStatus
@ManagedAttribute(description="Returns the cache status", displayName="Cache status", dataType=TRAIT) public String getCacheStatus()Returns String representation of ComponentStatus enumeration in order to avoid class not found exceptions in JMX tools that don't have access to infinispan classes. -
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
remove
-
replace
-
replace
-
size
public int size()Description copied from interface:CacheReturns a count of all elements in this cache and cache loader across the entire cluster. Only a subset of entries is held in memory at a time when using a loader or remote entries, to prevent possible memory issues, however the loading of said entries can still be very slow. If there are performance concerns then theFlag.SKIP_CACHE_LOADflag 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 theFlag.CACHE_MODE_LOCALflag so that other remote nodes are not queried for data. However, the loader will still be used unless the previously mentionedFlag.SKIP_CACHE_LOADis 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 aIsolationLevel.READ_COMMITTEDbehavior 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 usingIsolationLevel.REPEATABLE_READThis 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. -
sizeAsync
Description copied from interface:AsyncCacheAsynchronous version ofMap.size(). This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
sizeAsyncin interfaceAsyncCache<K,V> - Returns:
- a future containing the count of the cache
-
isEmpty
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V>
-
compute
Description copied from interface:CacheWhen 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
Externalizeror beSerializableitself.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.
-
compute
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.compute(Object, BiFunction)which takes in lifespan parameters.- Specified by:
computein interfaceBasicCache<K,V> - Parameters:
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 lifespan- Returns:
- the computed value that was stored under key
-
compute
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.compute(Object, BiFunction)which takes in lifespan and maxIdleTime parameters.- Specified by:
computein interfaceBasicCache<K,V> - Parameters:
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 time- Returns:
- the computed value that was stored under key
-
computeIfPresent
Description copied from interface:CacheWhen 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
Externalizeror beSerializableitself.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.
- Specified by:
computeIfPresentin interfaceCache<K,V> - Specified by:
computeIfPresentin interfaceConcurrentMap<K,V> - Specified by:
computeIfPresentin interfaceMap<K,V>
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.computeIfPresent(Object, BiFunction)which takes in lifespan parameters.- Specified by:
computeIfPresentin interfaceBasicCache<K,V> - Parameters:
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 lifespan- Returns:
- the computed value that was stored under key
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.computeIfPresent(Object, BiFunction)which takes in lifespan and maxIdleTime parameters.- Specified by:
computeIfPresentin interfaceBasicCache<K,V> - Parameters:
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 time- Returns:
- the computed value that was stored under key
-
computeIfAbsent
Description copied from interface:CacheWhen 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
Externalizeror beSerializableitself.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.
- Specified by:
computeIfAbsentin interfaceCache<K,V> - Specified by:
computeIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
computeIfAbsentin interfaceMap<K,V>
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.computeIfAbsent(Object, Function)which takes in lifespan parameters.- Specified by:
computeIfAbsentin interfaceBasicCache<K,V> - Parameters:
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 lifespan- Returns:
- the computed value that was stored under key
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.computeIfAbsent(Object, Function)which takes in lifespan and maxIdleTime parameters.- Specified by:
computeIfAbsentin interfaceBasicCache<K,V> - Parameters:
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 time- Returns:
- the computed value that was stored under key
-
get
-
getOrDefault
- Specified by:
getOrDefaultin interfaceConcurrentMap<K,V> - Specified by:
getOrDefaultin interfaceMap<K,V>
-
put
Description copied from interface:BasicCacheIf the return value of this operation will be ignored by the application, the user is strongly encouraged to use theorg.infinispan.context.Flag#IGNORE_RETURN_VALUESflag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls). -
remove
Description copied from interface:BasicCacheIf the return value of this operation will be ignored by the application, the user is strongly encouraged to use theorg.infinispan.context.Flag#IGNORE_RETURN_VALUESflag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls). -
putAll
-
merge
Description copied from interface:CacheWhen 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
Externalizeror beSerializableitself.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.
-
merge
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)which takes in lifespan parameters.- Specified by:
mergein interfaceBasicCache<K,V> - Parameters:
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 lifespan- Returns:
- the merged value that was stored under key
-
merge
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCacheAn overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)which takes in lifespan parameters.- Specified by:
mergein interfaceBasicCache<K,V> - Parameters:
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 time- Returns:
- the merged value that was stored under key
-
forEach
-
clear
@ManagedOperation(description="Clears the cache", displayName="Clears the cache", name="clear") public void clear()Description copied from interface:CacheRemoves all mappings from the cache. Note: This should never be invoked in production unless you can guarantee no other invocations are ran concurrently. If the cache is transactional, it will not interact with the transaction. -
keySet
Description copied from interface:CacheReturns a set view of the keys contained in this cache and cache loader across the entire cluster. Modifications and changes to the cache will be reflected in the set and vice versa. When this method is called nothing is actually queried as the backing set is just returned. Invocation on the set itself is when the various operations are ran.Unsupported Operations
Care should be taken when invokingSet.toArray(),Set.toArray(Object[]),Set.size(),Set.retainAll(Collection)andSet.iterator()methods as they will traverse the entire contents of the cluster including a configuredCacheLoaderand remote entries. The former 2 methods especially have a very high likelihood of causing aOutOfMemoryErrordue 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 operationsSupported Flags
Note any flag configured for the cache will also be passed along to the backing set when it was created. If additional flags are configured on the cache they will not affect any existing backings sets. If there are performance concerns then theFlag.SKIP_CACHE_LOADflag 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 preventOutOfMemoryError) Also if you want the local contents only you can use theFlag.CACHE_MODE_LOCALflag so that other remote nodes are not queried for data. However, the loader will still be used unless the previously mentionedFlag.SKIP_CACHE_LOADis also configured.Iterator Use
This class implements theCloseableIteratorSetinterface which creates aCloseableIteratorinstead 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.Unsupported Operations
Due to not being able to add null values the following methods are not supported and will throwUnsupportedOperationExceptionif invoked.Set.add(Object)Set.addAll(java.util.Collection) -
entrySet
Description copied from interface:CacheReturns a set view of the mappings contained in this cache and cache loader across the entire cluster. Modifications and changes to the cache will be reflected in the set and vice versa. When this method is called nothing is actually queried as the backing set is just returned. Invocation on the set itself is when the various operations are ran. Care should be taken when invokingSet.toArray(),Set.toArray(Object[]),Set.size(),Set.retainAll(Collection)andSet.iterator()methods as they will traverse the entire contents of the cluster including a configuredCacheLoaderand remote entries. The former 2 methods especially have a very high likelihood of causing aOutOfMemoryErrordue 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 operationsSupported Flags
Note any flag configured for the cache will also be passed along to the backing set when it was created. If additional flags are configured on the cache they will not affect any existing backings sets. If there are performance concerns then theFlag.SKIP_CACHE_LOADflag 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 preventOutOfMemoryError) Also if you want the local contents only you can use theFlag.CACHE_MODE_LOCALflag so that other remote nodes are not queried for data. However, the loader will still be used unless the previously mentionedFlag.SKIP_CACHE_LOADis also configured.Modifying or Adding Entries
An entry's value is supported to be modified by using theMap.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 theSet.add(Object)orSet.addAll(java.util.Collection)methods.Iterator Use
This class implements theCloseableIteratorSetinterface which creates aCloseableIteratorinstead 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. -
values
Description copied from interface:CacheReturns a collection view of the values contained in this cache across the entire cluster. Modifications and changes to the cache will be reflected in the set and vice versa. When this method is called nothing is actually queried as the backing collection is just returned. Invocation on the collection itself is when the various operations are ran. Care should be taken when invokingCollection.toArray(),Collection.toArray(Object[]),Collection.size(),Collection.retainAll(Collection)andCollection.iterator()methods as they will traverse the entire contents of the cluster including a configuredCacheLoaderand remote entries. The former 2 methods especially have a very high likelihood of causing aOutOfMemoryErrordue 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 operationsSupported Flags
Note any flag configured for the cache will also be passed along to the backing set when it was created. If additional flags are configured on the cache they will not affect any existing backings sets. If there are performance concerns then theFlag.SKIP_CACHE_LOADflag 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 preventOutOfMemoryError) Also if you want the local contents only you can use theFlag.CACHE_MODE_LOCALflag so that other remote nodes are not queried for data. However the loader will still be used unless the previously mentionedFlag.SKIP_CACHE_LOADis also configured.Iterator Use
This class implements the
CloseableIteratorCollectioninterface which creates aCloseableIteratorinstead 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 fromCacheStream.iterator()will not support remove.Unsupported Operations
Due to not being able to add null values the following methods are not supported and will throwUnsupportedOperationExceptionif invoked.Set.add(Object)Set.addAll(java.util.Collection) -
start
-
stop
@ManagedOperation(description="Stops the cache.", displayName="Stops cache.") public void stop()Description copied from interface:CacheStops a cache. If the cache is clustered, this only stops the cache on the node where it is being invoked. If you need to stop the cache across a cluster, use theCache.shutdown()method. -
shutdown
@ManagedOperation(description="Shuts down the cache across the cluster", displayName="Clustered cache shutdown") public void shutdown()Description copied from interface:CachePerforms a controlled, clustered shutdown of the cache. When invoked, the following operations are performed:- rebalancing for the cache is disabled
- in-memory data is flushed/passivated to any persistent stores
- state is persisted to the location defined in
GlobalStateConfigurationBuilder.persistentLocation(String)
Cache.stop()only in clustered modes, and only whenGlobalStateConfiguration.enabled()is true, otherwise it just behaves likeCache.stop(). -
addListener
Description copied from interface:ListenableAdds a listener to the component. Typically, listeners would need to be annotated withListenerand further to that, contain methods annotated appropriately, otherwise the listener will not be registered. See theListenerannotation for more information.- Specified by:
addListenerin interfaceListenable- Parameters:
listener- listener to add, must not be null
-
addListenerAsync
Description copied from interface:ListenableAsynchronous version ofListenable.addListener(Object)- Specified by:
addListenerAsyncin interfaceListenable- Parameters:
listener- listener to add, must not be null- Returns:
- CompletionStage that when complete the listener is fully installed
-
addListener
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter) Description copied from interface:FilteringListenableRegisters a listener that will be notified on events that pass the filter condition. The value presented in the notifications will be first converted using the provided converter if there is one.Some implementations may provide optimizations when a
CacheEventFilterConverteris provided as both arguments to the filter and converter arguments. Note the provided object must have reference equality ie. (==) to be recognized. This allows for the filter and conversion step to take place in the same method call reducing possible overhead.- Specified by:
addListenerin interfaceFilteringListenable<K,V> - Type Parameters:
C- The type of the resultant value after being converted- Parameters:
listener- The listener to callback upon event notifications. Must not be null.filter- The filter to see if the notification should be sent to the listener. Can be null.converter- The converter to apply to the entry before being sent to the listener. Can be null.
-
addListenerAsync
public <C> CompletionStage<Void> addListenerAsync(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter) Description copied from interface:FilteringListenableAsynchronous version ofFilteringListenable.addListener(Object, CacheEventFilter, CacheEventConverter)- Specified by:
addListenerAsyncin interfaceFilteringListenable<K,V> - Type Parameters:
C-- Parameters:
listener- listener to add, must not be nullfilter-converter-- Returns:
- CompletionStage that when complete the listener is fully installed
-
removeListener
Description copied from interface:ListenableRemoves a listener from the component.- Specified by:
removeListenerin interfaceListenable- Parameters:
listener- listener to remove. Must not be null.
-
removeListenerAsync
Description copied from interface:ListenableAsynchronous version ofListenable.removeListener(Object)- Specified by:
removeListenerAsyncin interfaceListenable- Parameters:
listener- listener to remove, must not be null- Returns:
- CompletionStage that when complete the listener is fully removed
-
addFilteredListener
public <C> void addFilteredListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, Set<Class<? extends Annotation>> filterAnnotations) Description copied from interface:FilteringListenableRegisters a listener limiting the cache-entry specific events only to annotations that are passed in as parameter. For example, if the listener passed in contains callbacks forCacheEntryCreatedandCacheEntryModified, and filtered annotations contains onlyCacheEntryCreated, then the listener will be registered only forCacheEntryCreatedcallbacks. Callback filtering only applies toCacheEntryCreated,CacheEntryModified,CacheEntryRemovedandCacheEntryExpiredannotations. If the listener contains other annotations, these are preserved. This methods enables dynamic registration of listener interests at runtime without the need to create several different listener classes.- Specified by:
addFilteredListenerin interfaceFilteringListenable<K,V> - Type Parameters:
C- The type of the resultant value after being converted- Parameters:
listener- The listener to callback upon event notifications. Must not be null.filter- The filter to see if the notification should be sent to the listener. Can be null.converter- The converter to apply to the entry before being sent to the listener. Can be null.filterAnnotations- cache-entry annotations to allow listener to be registered on. Must not be null.
-
addFilteredListenerAsync
public <C> CompletionStage<Void> addFilteredListenerAsync(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, Set<Class<? extends Annotation>> filterAnnotations) Description copied from interface:FilteringListenableAsynchronous version ofFilteringListenable.addFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)- Specified by:
addFilteredListenerAsyncin interfaceFilteringListenable<K,V>
-
addStorageFormatFilteredListener
public <C> void addStorageFormatFilteredListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, Set<Class<? extends Annotation>> filterAnnotations) Description copied from interface:FilteringListenableSame asFilteringListenable.addFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set), but assumes the filter and/or the converter will be done in the same data format as it's stored in the cache.- Specified by:
addStorageFormatFilteredListenerin interfaceFilteringListenable<K,V>
-
addStorageFormatFilteredListenerAsync
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) Description copied from interface:FilteringListenableAsynchronous version ofFilteringListenable.addStorageFormatFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)- Specified by:
addStorageFormatFilteredListenerAsyncin interfaceFilteringListenable<K,V>
-
getAsync
Description copied from interface:AsyncCacheAsynchronous version ofMap.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 toMap.get(Object).- Specified by:
getAsyncin interfaceAsyncCache<K,V> - Parameters:
key- key to retrieve- Returns:
- a future that can be used to retrieve value associated with the
key when this is available. The actual value returned by the future
follows the same rules as
Map.get(Object)
-
getAllAsync
Description copied from interface:AsyncCacheTODO This should be in AdvancedCache with getAll- Specified by:
getAllAsyncin interfaceAsyncCache<K,V>
-
query
-
continuousQuery
- Specified by:
continuousQueryin interfaceBasicCache<K,V> - Returns:
- a continuous query service usable with the current cache context
-
getConfigurationAsProperties
@ManagedAttribute(description="Returns the cache configuration in form of properties", displayName="Cache configuration properties", dataType=TRAIT) public Properties getConfigurationAsProperties() -
toString
-
getDelegate
-
unwrapCache
-