Class SecureCacheImpl<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,,V> Map<K,,V> AdvancedCache<K,,V> Cache<K,,V> InternalCache<K,,V> org.infinispan.commons.api.AsyncCache<K,,V> org.infinispan.commons.api.BasicCache<K,,V> org.infinispan.commons.api.BatchingCache,org.infinispan.commons.api.Lifecycle,org.infinispan.commons.api.TransactionalCache,FilteringListenable<K,,V> Listenable,SecureCache<K,V>
- Since:
- 7.0
- Author:
- Tristan Tarrant
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache
cache -
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) CacheSet<CacheEntry<K, V>> Identical toCache.entrySet()but is typed to return CacheEntries instead of Entries.voidclear()Removes all mappings from the cache.compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form of, which takes in an instance ofinvalid reference
#compute(K, BiFunction)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Overloaded, which stores metadata alongside the value.invalid reference
#computeAsync(K, BiFunction)computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form of, which takes in an instance ofinvalid reference
#computeIfAbsent(K, Function)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction) computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Overloaded, which takes in an instance ofinvalid reference
#computeIfAbsentAsync(K, Function)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.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) computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) An overloaded form of, which takes in an instance ofinvalid reference
#computeIfPresent(K, BiFunction)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Overloaded, which takes in an instance ofinvalid reference
#computeIfPresentAsync(K, BiFunction)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.booleancontainsKey(Object key) booleancontainsValue(Object value) voidendBatch(boolean successful) entrySet()Returns a set view of the mappings contained in this cache and cache loader across the entire cluster.booleanvoidEvicts an entry from the memory of the cache.Gets a collection of entries, returning them asMapof the values associated with the set of keys requested.getAllAsync(Set<?> keys) Map<K, CacheEntry<K, V>> getAllCacheEntries(Set<?> keys) Gets a collection of entries from theAdvancedCache, returning them asMapof the cache entries associated with the set of keys requested.getAndPutAll(Map<? extends K, ? extends V> map) Executes an equivalent ofMap.putAll(Map), returning previous values of the modified entries.Retrieves theAuthorizationManagerif the cache has security enabled.Returns the cache's availability.Returns the component in charge of batching cache operations.CacheEntry<K, V> getCacheEntry(Object key) Retrieves a CacheEntry corresponding to a specific key.getCacheEntryAsync(Object key) Retrieves a CacheEntry corresponding to a specific key.Retrieves the cache manager responsible for creating this cache instance.Returns the cache loader associated associated with this cache.Returns the container where data is stored in the cache.Retrieves a reference to theDistributionManagerif the cache is configured to use Distribution.It fetches all the keys which belong to the group.Returns the component that deals with all aspects of acquiring and releasing locks for cache entries.getName()Returns the component in charge of communication with other caches in the cluster.getStats()Returns aStatsobject that allows several statistics associated with this cache at runtime.jakarta.transaction.TransactionManagerReturns theXAResourceassociated with this cache which can be used to do transactional recovery.inthashCode()booleanisEmpty()keySet()Returns a set view of the keys contained in this cache and cache loader across the entire cluster.booleanlock(Collection<? extends K> keys) Locks collections of keys eagerly across cache nodes in a cluster.booleanLocks a given key or keys eagerly across cache nodes in a cluster.Whenever this cache acquires a lock it will do so using the given Object as the owner of said lock.Returns a sequential stream using this Cache as the source.merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) An overloaded form ofCache.merge(Object, Object, BiFunction), which takes in an instance ofMetadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) OverloadedAsyncCache.mergeAsync(Object, Object, BiFunction), which takes in an instance ofMetadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.noFlags()Unset all flags set on this cache usingAdvancedCache.withFlags(Flag...)orAdvancedCache.withFlags(Collection)methods.put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form of, which takes in an instance ofinvalid reference
#put(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.voidvoidvoidputAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) voidAn overloaded form ofMap.putAll(Map), which takes in an instance ofMetadatawhich can be used to provide metadata information for the entries being stored, such as lifespan, version of value...etc.putAllAsync(Map<? extends K, ? extends V> data) putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) putAllAsync(Map<? extends K, ? extends V> map, Metadata metadata) Asynchronous version ofAdvancedCache.put(Object, Object, Metadata)which stores metadata alongside the value.putAsyncEntry(K key, V value, Metadata metadata) Extension ofAdvancedCache.putAsync(K, V, Metadata)which returns aCacheEntryinstead of only the previous value.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.voidputForExternalRead(K key, V value, Metadata metadata) An overloaded form of, which takes in an instance ofinvalid reference
#putForExternalRead(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.putIfAbsent(K key, V value) putIfAbsent(K key, V value, long lifespan, TimeUnit unit) putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) putIfAbsent(K key, V value, Metadata metadata) An overloaded form of, which takes in an instance ofinvalid reference
#putIfAbsent(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.putIfAbsentAsync(K key, V value) putIfAbsentAsync(K key, V value, long lifespan, TimeUnit unit) putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) putIfAbsentAsync(K key, V value, Metadata metadata) An overloaded form of, which takes in an instance ofinvalid reference
#putIfAbsentAsync(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.putIfAbsentAsyncEntry(K key, V value, Metadata metadata) An extension form ofAdvancedCache.putIfAbsentAsync(K, V, Metadata), which returns aCacheEntryinstead of only the value.<T> org.infinispan.commons.api.query.Query<T> booleanremoveAsync(Object key) removeAsync(Object key, Object value) removeAsyncEntry(Object key) An extension ofAsyncCache.removeAsync(Object), which returns aCacheEntryinstead of only the value.voidremoveGroup(String groupName) It removes all the key which belongs to a group.removeLifespanExpired(K key, V value, Long lifespan) Attempts to remove the entry if it is expired.voidremoveListener(Object listener) Removes a listener from the component.removeListenerAsync(Object listener) Asynchronous version ofListenable.removeListener(Object)removeMaxIdleExpired(K key, V value) Attempts to remove the entry for the given key, if it has expired due to max idle.replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form of, which takes in an instance ofinvalid reference
#replace(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.booleanbooleanbooleanreplace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) booleanAn overloaded form of, which takes in an instance ofinvalid reference
#replace(K, V, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.replaceAsync(K key, V value) replaceAsync(K key, V value, long lifespan, TimeUnit unit) replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) replaceAsync(K key, V value, Metadata metadata) An overloaded form of, which takes in an instance ofinvalid reference
#replaceAsync(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.replaceAsync(K key, V oldValue, V newValue) replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) replaceAsync(K key, V oldValue, V newValue, Metadata metadata) replaceAsyncEntry(K key, V value, Metadata metadata) An extension ofAdvancedCache.replaceAsync(K, V, Metadata), which returns aCacheEntryinstead of only the value.rewrap(AdvancedCache newDelegate) No generics because some methods returnAdvancedCache<?, ?>, and returning the proper type would require erasure anyway.voidsetAvailability(AvailabilityMode availabilityMode) Manually change the availability of the cache.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.voidstart()booleanvoidstop()Stops a cache.toString()Touches the given key if present.The same asAdvancedCache.touch(Object, boolean)except that the segment is already known.transform(Function<AdvancedCache<K, V>, ? extends AdvancedCache<K, V>> transformation) Apply thetransformationon eachAdvancedCacheinstance in a delegation chain, starting with the innermost implementation.values()Returns a collection view of the values contained in this cache across the entire cluster.AdvancedCache<?, ?> withEncoding(Class<? extends org.infinispan.commons.dataconversion.Encoder> encoderClass) Performs any cache operations using the specifiedEncoder.AdvancedCache<?, ?> withEncoding(Class<? extends org.infinispan.commons.dataconversion.Encoder> keyEncoderClass, Class<? extends org.infinispan.commons.dataconversion.Encoder> valueEncoderClass) Performs any cache operations using the specified pair ofEncoder.withFlags(Collection<Flag> flags) An alternative toAdvancedCache.withFlags(Flag...)not requiring array allocation.A method that adds flags to any API call.AdvancedCache<?, ?> withKeyEncoding(Class<? extends org.infinispan.commons.dataconversion.Encoder> encoder) AdvancedCache<?, ?> withMediaType(String keyMediaType, String valueMediaType) Perform any cache operations using an alternateMediaType.<K1,V1> AdvancedCache <K1, V1> withMediaType(org.infinispan.commons.dataconversion.MediaType keyMediaType, org.infinispan.commons.dataconversion.MediaType valueMediaType) Perform any cache operations using the sameMediaTypeof the cache storage.withSubject(Subject subject) Performs any cache operations using the specifiedSubject.withWrapping(Class<? extends org.infinispan.commons.dataconversion.Wrapper> wrapperClass) Performs any cache operations using the specifiedWrapper.withWrapping(Class<? extends org.infinispan.commons.dataconversion.Wrapper> keyWrapperClass, Class<? extends org.infinispan.commons.dataconversion.Wrapper> valueWrapperClass) Performs any cache operations using the specified pair ofWrapper.Methods inherited from class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache
getCacheAvailability, isRebalancingEnabled, setCacheAvailability, setRebalancingEnabled, withFlagsMethods inherited from class org.infinispan.cache.impl.AbstractDelegatingCache
forEach, getCacheName, getCacheStatus, getConfigurationAsProperties, getOrDefault, replaceAll, unwrapCacheMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.infinispan.AdvancedCache
compute, computeAsync, computeIfAbsent, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, merge, mergeAsync, withFlagsMethods 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 java.util.concurrent.ConcurrentMap
forEach, getOrDefault, replaceAllMethods inherited from interface org.infinispan.cache.impl.InternalCache
bypassInvocationContextFactory
-
Constructor Details
-
SecureCacheImpl
-
-
Method Details
-
getDelegate
- Overrides:
getDelegatein classAbstractDelegatingCache<K,V>
-
withSubject
Description copied from interface:AdvancedCachePerforms any cache operations using the specifiedSubject. Only applies to caches with authorization enabled (seeConfigurationBuilder.security()).- Specified by:
withSubjectin interfaceAdvancedCache<K,V> - Overrides:
withSubjectin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
subject-- Returns:
- an
AdvancedCacheinstance on which a real operation is to be invoked, using the specified subject
-
startBatch
public boolean startBatch()- Specified by:
startBatchin interfaceorg.infinispan.commons.api.BatchingCache- Overrides:
startBatchin classAbstractDelegatingCache<K,V>
-
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- Overrides:
addListenerin classAbstractDelegatingCache<K,V> - Parameters:
listener- listener to add, must not be null
-
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> - Overrides:
addListenerin classAbstractDelegatingCache<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> - Overrides:
addListenerAsyncin classAbstractDelegatingCache<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
-
addListenerAsync
Description copied from interface:ListenableAsynchronous version ofListenable.addListener(Object)- Specified by:
addListenerAsyncin interfaceListenable- Overrides:
addListenerAsyncin classAbstractDelegatingCache<K,V> - Parameters:
listener- listener to add, must not be null- Returns:
- CompletionStage that when complete the listener is fully installed
-
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> - Overrides:
addFilteredListenerin classAbstractDelegatingCache<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> - Overrides:
addFilteredListenerAsyncin classAbstractDelegatingCache<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> - Overrides:
addStorageFormatFilteredListenerin classAbstractDelegatingCache<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> - Overrides:
addStorageFormatFilteredListenerAsyncin classAbstractDelegatingCache<K,V>
-
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(). -
start
public void start()- Specified by:
startin interfaceorg.infinispan.commons.api.Lifecycle- Overrides:
startin classAbstractDelegatingCache<K,V>
-
stop
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. -
putAsync
-
endBatch
public void endBatch(boolean successful) - Specified by:
endBatchin interfaceorg.infinispan.commons.api.BatchingCache- Overrides:
endBatchin classAbstractDelegatingCache<K,V>
-
removeListener
Description copied from interface:ListenableRemoves a listener from the component.- Specified by:
removeListenerin interfaceListenable- Overrides:
removeListenerin classAbstractDelegatingCache<K,V> - Parameters:
listener- listener to remove. Must not be null.
-
removeListenerAsync
Description copied from interface:ListenableAsynchronous version ofListenable.removeListener(Object)- Specified by:
removeListenerAsyncin interfaceListenable- Overrides:
removeListenerAsyncin classAbstractDelegatingCache<K,V> - Parameters:
listener- listener to remove, must not be null- Returns:
- CompletionStage that when complete the listener is fully removed
-
putAsync
-
withFlags
Description copied from interface:AdvancedCacheA method that adds flags to any API call. For example, consider the following code snippet:cache.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);- Specified by:
withFlagsin interfaceAdvancedCache<K,V> - Overrides:
withFlagsin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
flags- a set of flags to apply. See theFlagdocumentation.- Returns:
- an
AdvancedCacheinstance on which a real operation is to be invoked, if the flags are to be applied.
-
withFlags
Description copied from interface:AdvancedCacheAn alternative toAdvancedCache.withFlags(Flag...)not requiring array allocation.- Specified by:
withFlagsin interfaceAdvancedCache<K,V> - Overrides:
withFlagsin classAbstractDelegatingAdvancedCache<K,V>
-
noFlags
Description copied from interface:AdvancedCacheUnset all flags set on this cache usingAdvancedCache.withFlags(Flag...)orAdvancedCache.withFlags(Collection)methods.- Specified by:
noFlagsin interfaceAdvancedCache<K,V> - Overrides:
noFlagsin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- Cache not applying any flags to the command; possibly
this.
-
transform
public AdvancedCache<K,V> transform(Function<AdvancedCache<K, V>, ? extends AdvancedCache<K, V>> transformation) Description copied from interface:AdvancedCacheApply thetransformationon eachAdvancedCacheinstance in a delegation chain, starting with the innermost implementation.- Specified by:
transformin interfaceAdvancedCache<K,V> - Overrides:
transformin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
transformation-- Returns:
- The outermost transformed cache.
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V> - Overrides:
putIfAbsentin classAbstractDelegatingCache<K,V>
-
putAsync
-
getName
-
getVersion
- Specified by:
getVersionin interfaceorg.infinispan.commons.api.BasicCache<K,V> - Overrides:
getVersionin classAbstractDelegatingCache<K,V>
-
put
-
putAllAsync
- Specified by:
putAllAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
putAllAsyncin classAbstractDelegatingCache<K,V>
-
put
-
remove
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) - Specified by:
putAllAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
putAllAsyncin classAbstractDelegatingCache<K,V>
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceorg.infinispan.commons.api.BasicCache<K,V> - Overrides:
putIfAbsentin classAbstractDelegatingCache<K,V>
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) - Specified by:
putAllAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
putAllAsyncin classAbstractDelegatingCache<K,V>
-
putAll
-
replace
-
clearAsync
- Specified by:
clearAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
clearAsyncin classAbstractDelegatingCache<K,V>
-
replace
-
putIfAbsentAsync
- Specified by:
putIfAbsentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
putIfAbsentAsyncin classAbstractDelegatingCache<K,V>
-
replace
-
putIfAbsentAsync
- Specified by:
putIfAbsentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
putIfAbsentAsyncin classAbstractDelegatingCache<K,V>
-
replace
-
getExpirationManager
- Specified by:
getExpirationManagerin interfaceAdvancedCache<K,V> - Overrides:
getExpirationManagerin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- the expiration manager - if one is configured - for this cache instance
-
put
-
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> - Overrides:
putForExternalReadin classAbstractDelegatingCache<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:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#putForExternalRead(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
putForExternalReadin interfaceAdvancedCache<K,V> - Overrides:
putForExternalReadin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
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 value
-
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.
-
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
-
merge
-
merge
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCacheAn overloaded form ofCache.merge(Object, Object, BiFunction), which takes in an instance ofMetadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
mergein interfaceAdvancedCache<K,V> - Overrides:
mergein classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- , key with which the resulting value is to be associatedvalue- , the non-null value to be merged with the existing value associated with the key or, if no existing value or a null value is associated with the key, to be associated with the keyremappingFunction- , the function to recompute a value if presentmetadata- , information to store alongside the new value- Returns:
- the new value associated with the specified key, or null if no value is associated with the key
-
compute
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#compute(K, BiFunction)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.- Specified by:
computein interfaceAdvancedCache<K,V> - Overrides:
computein classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedremappingFunction- function to be applied to the specified key/valuemetadata- information to store alongside the new value- Returns:
- the previous value associated with the specified key, or null if remapping function is gives null.
-
compute
-
compute
-
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> - Overrides:
computeIfPresentin classAbstractDelegatingCache<K,V>
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#computeIfPresent(K, BiFunction)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
computeIfPresentin interfaceAdvancedCache<K,V> - Overrides:
computeIfPresentin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedremappingFunction- function to be applied to the specified key/valuemetadata- information to store alongside the new value- Returns:
- the previous value associated with the specified key, or null if there was no mapping for the key.
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) - Specified by:
computeIfPresentin interfaceorg.infinispan.commons.api.BasicCache<K,V> - Overrides:
computeIfPresentin classAbstractDelegatingCache<K,V>
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) - Specified by:
computeIfPresentin interfaceorg.infinispan.commons.api.BasicCache<K,V> - Overrides:
computeIfPresentin classAbstractDelegatingCache<K,V>
-
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> - Overrides:
computeIfAbsentin classAbstractDelegatingCache<K,V>
-
computeIfAbsent
Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#computeIfAbsent(K, Function)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
computeIfAbsentin interfaceAdvancedCache<K,V> - Overrides:
computeIfAbsentin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedmappingFunction- function to be applied to the specified keymetadata- information to store alongside the new value- Returns:
- the value created with the mapping function associated with the specified key, or the previous value associated with the specified key if the key is not absent.
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) - Specified by:
computeIfAbsentin interfaceorg.infinispan.commons.api.BasicCache<K,V> - Overrides:
computeIfAbsentin classAbstractDelegatingCache<K,V>
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) - Specified by:
computeIfAbsentin interfaceorg.infinispan.commons.api.BasicCache<K,V> - Overrides:
computeIfAbsentin classAbstractDelegatingCache<K,V>
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCacheOverloaded, which stores metadata alongside the value. This method does not block on remote calls, even if your cache mode is synchronous.invalid reference
#computeAsync(K, BiFunction)- Specified by:
computeAsyncin interfaceAdvancedCache<K,V> - Overrides:
computeAsyncin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedremappingFunction- function to be applied to the specified key/valuemetadata- information to store alongside the new value- Returns:
- the previous value associated with the specified key, or null if remapping function is gives null.
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCacheOverloaded, which takes in an instance ofinvalid reference
#computeIfPresentAsync(K, BiFunction)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
computeIfPresentAsyncin interfaceAdvancedCache<K,V> - Overrides:
computeIfPresentAsyncin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedremappingFunction- function to be applied to the specified key/valuemetadata- information to store alongside the new value- Returns:
- the previous value associated with the specified key, or null if there was no mapping for the key.
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, Metadata metadata) Description copied from interface:AdvancedCacheOverloaded, which takes in an instance ofinvalid reference
#computeIfAbsentAsync(K, Function)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
computeIfAbsentAsyncin interfaceAdvancedCache<K,V> - Overrides:
computeIfAbsentAsyncin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedmappingFunction- function to be applied to the specified keymetadata- information to store alongside the new value- Returns:
- the value created with the mapping function associated with the specified key, or the previous value associated with the specified key if the key is not absent.
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) - Specified by:
mergeAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
mergeAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) - Specified by:
mergeAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
mergeAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCacheOverloadedAsyncCache.mergeAsync(Object, Object, BiFunction), which takes in an instance ofMetadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
mergeAsyncin interfaceAdvancedCache<K,V> - Overrides:
mergeAsyncin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- , key with which the resulting value is to be associatedvalue- , the non-null value to be merged with the existing value associated with the key or, if no existing value or a null value is associated with the key, to be associated with the keyremappingFunction- , the function to recompute a value if presentmetadata- , information to store alongside the new value- Returns:
- the new value associated with the specified key, or null if no value is associated with the key
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) - Specified by:
computeAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) - Specified by:
computeAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeAsyncin classAbstractDelegatingAdvancedCache<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) - Specified by:
computeAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction) - Specified by:
computeIfAbsentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeIfAbsentAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) - Specified by:
computeIfAbsentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeIfAbsentAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) - Specified by:
computeIfAbsentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeIfAbsentAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) - Specified by:
computeIfPresentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeIfPresentAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) - Specified by:
computeIfPresentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeIfPresentAsyncin classAbstractDelegatingAdvancedCache<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) - Specified by:
computeIfPresentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
computeIfPresentAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) - Specified by:
mergeAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
mergeAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
putForExternalRead
Description copied from interface:CacheAn overloaded form ofCache.putForExternalRead(K, V), which takes in lifespan parameters.- Specified by:
putForExternalReadin interfaceCache<K,V> - Overrides:
putForExternalReadin classAbstractDelegatingCache<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> - Overrides:
putForExternalReadin classAbstractDelegatingCache<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
-
getComponentRegistry
- Specified by:
getComponentRegistryin interfaceInternalCache<K,V> - Overrides:
getComponentRegistryin classAbstractDelegatingAdvancedCache<K,V>
-
getDistributionManager
Description copied from interface:AdvancedCacheRetrieves a reference to theDistributionManagerif the cache is configured to use Distribution. Otherwise, returns a null.- Specified by:
getDistributionManagerin interfaceAdvancedCache<K,V> - Overrides:
getDistributionManagerin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- a DistributionManager, or null.
-
getAuthorizationManager
Description copied from interface:AdvancedCacheRetrieves theAuthorizationManagerif the cache has security enabled. Otherwise returns null- Specified by:
getAuthorizationManagerin interfaceAdvancedCache<K,V> - Overrides:
getAuthorizationManagerin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- an AuthorizationManager or null
-
lockAs
Description copied from interface:AdvancedCacheWhenever this cache acquires a lock it will do so using the given Object as the owner of said lock.This 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.
- Specified by:
lockAsin interfaceAdvancedCache<K,V> - Overrides:
lockAsin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
lockOwner- the lock owner to lock any keys as- Returns:
- an
AdvancedCacheinstance on which when an operation is invoked it will use lock owner object to acquire any locks
-
putIfAbsentAsync
public CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) - Specified by:
putIfAbsentAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
putIfAbsentAsyncin classAbstractDelegatingCache<K,V>
-
isEmpty
public boolean isEmpty() -
lock
Description copied from interface:AdvancedCacheLocks a given key or keys eagerly across cache nodes in a cluster.Keys can be locked eagerly in the context of a transaction only.
- Specified by:
lockin interfaceAdvancedCache<K,V> - Overrides:
lockin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
keys- the keys to lock- Returns:
- true if the lock acquisition attempt was successful for all keys; false will only be returned if
the lock acquisition timed out and the operation has been called with
Flag.FAIL_SILENTLY.
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V> - Overrides:
containsKeyin classAbstractDelegatingCache<K,V>
-
putIfAbsent
public V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) - Specified by:
putIfAbsentin interfaceorg.infinispan.commons.api.BasicCache<K,V> - Overrides:
putIfAbsentin classAbstractDelegatingCache<K,V>
-
lock
Description copied from interface:AdvancedCacheLocks collections of keys eagerly across cache nodes in a cluster.Collections of keys can be locked eagerly in the context of a transaction only.
- Specified by:
lockin interfaceAdvancedCache<K,V> - Overrides:
lockin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
keys- collection of keys to lock- Returns:
- true if the lock acquisition attempt was successful for all keys; false will only be returned if
the lock acquisition timed out and the operation has been called with
Flag.FAIL_SILENTLY.
-
removeAsync
- Specified by:
removeAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
removeAsyncin classAbstractDelegatingCache<K,V>
-
removeAsyncEntry
Description copied from interface:AdvancedCacheAn extension ofAsyncCache.removeAsync(Object), which returns aCacheEntryinstead of only the value.- Specified by:
removeAsyncEntryin interfaceAdvancedCache<K,V> - Overrides:
removeAsyncEntryin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key to remove- Returns:
- a future containing the
CacheEntryremoved ornullif not found. - See Also:
-
containsValue
- Specified by:
containsValuein interfaceMap<K,V> - Overrides:
containsValuein classAbstractDelegatingCache<K,V>
-
putAll
-
removeAsync
- Specified by:
removeAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
removeAsyncin classAbstractDelegatingCache<K,V>
-
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. -
replaceAsync
- Specified by:
replaceAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
replaceAsyncin classAbstractDelegatingCache<K,V>
-
getRpcManager
Description copied from interface:AdvancedCacheReturns the component in charge of communication with other caches in the cluster. If the cache'sClusteringConfiguration.cacheMode()isCacheMode.LOCAL, this method will return null.- Specified by:
getRpcManagerin interfaceAdvancedCache<K,V> - Overrides:
getRpcManagerin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- the RPC manager component associated with this cache instance or null
-
replace
-
get
-
replaceAsync
- Specified by:
replaceAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
replaceAsyncin classAbstractDelegatingCache<K,V>
-
getBatchContainer
Description copied from interface:AdvancedCacheReturns the component in charge of batching cache operations.- Specified by:
getBatchContainerin interfaceAdvancedCache<K,V> - Overrides:
getBatchContainerin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- the batching component associated with this cache instance
-
getCacheConfiguration
- Specified by:
getCacheConfigurationin interfaceCache<K,V> - Overrides:
getCacheConfigurationin classAbstractDelegatingCache<K,V>
-
getCacheManager
Description copied from interface:CacheRetrieves the cache manager responsible for creating this cache instance.- Specified by:
getCacheManagerin interfaceCache<K,V> - Overrides:
getCacheManagerin classAbstractDelegatingCache<K,V> - Returns:
- a cache manager
-
getAdvancedCache
- Specified by:
getAdvancedCachein interfaceCache<K,V> - Overrides:
getAdvancedCachein classAbstractDelegatingAdvancedCache<K,V>
-
getStatus
-
getAvailability
Description copied from interface:AdvancedCacheReturns the cache's availability. In local mode this method will always returnAvailabilityMode.AVAILABLE. In clustered mode, thePartitionHandlingManageris queried to obtain the availability mode.- Specified by:
getAvailabilityin interfaceAdvancedCache<K,V> - Overrides:
getAvailabilityin classAbstractDelegatingAdvancedCache<K,V>
-
setAvailability
Description copied from interface:AdvancedCacheManually change the availability of the cache. Doesn't change anything if the cache is not clustered orPartitionHandlingConfiguration.whenSplit()is set toPartitionHandling.ALLOW_READ_WRITES.- Specified by:
setAvailabilityin interfaceAdvancedCache<K,V> - Overrides:
setAvailabilityin classAbstractDelegatingAdvancedCache<K,V>
-
cacheEntrySet
Description copied from interface:AdvancedCacheIdentical toCache.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
- Specified by:
cacheEntrySetin interfaceAdvancedCache<K,V> - Overrides:
cacheEntrySetin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- the entry set containing all of the CacheEntries
- See Also:
-
lockedStream
Description copied from interface:AdvancedCacheReturns a sequential stream using this Cache as the source. This stream is very similar to using theCacheStreamreturned from theCacheCollection.stream()method of the collection returned viaAdvancedCache.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 toLockingMode.OPTIMISTIC, do not support this method. In this case it will throw anUnsupportedOperationException. 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 viaAdvancedCache.lockAs(Object)as this could lead to a deadlock or the release of locks early and will throw anIllegalStateException.- Specified by:
lockedStreamin interfaceAdvancedCache<K,V> - Overrides:
lockedStreamin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- the locked stream
-
removeLifespanExpired
Description copied from interface:AdvancedCacheAttempts to remove the entry if it is expired. Due to expired entries not being consistent across nodes, this will still attempt to remove the value if it is not present. Note that this will raise an expired event even if the entry is not present. Normally this method should never be invoked except by theExpirationManager.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.
- Specified by:
removeLifespanExpiredin interfaceAdvancedCache<K,V> - Overrides:
removeLifespanExpiredin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
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 value- Returns:
- if the entry was removed
-
removeMaxIdleExpired
Description copied from interface:AdvancedCacheAttempts to remove the entry for the given key, if it has expired due to max idle. This command first locks the key and then verifies that the entry has expired via maxIdle across all nodes. If it has this will then remove the given key.This 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.
- Specified by:
removeMaxIdleExpiredin interfaceAdvancedCache<K,V> - Overrides:
removeMaxIdleExpiredin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- the key that expired via max idle for the given entry- Returns:
- if the entry was removed
-
withEncoding
public AdvancedCache<?,?> withEncoding(Class<? extends org.infinispan.commons.dataconversion.Encoder> encoderClass) Description copied from interface:AdvancedCachePerforms any cache operations using the specifiedEncoder.- Specified by:
withEncodingin interfaceAdvancedCache<K,V> - Overrides:
withEncodingin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
encoderClass-Encoderused for both keys and values.- Returns:
- an instance of
AdvancedCachewhere all operations will use the supplied encoder.
-
withKeyEncoding
public AdvancedCache<?,?> withKeyEncoding(Class<? extends org.infinispan.commons.dataconversion.Encoder> encoder) - Specified by:
withKeyEncodingin interfaceAdvancedCache<K,V> - Overrides:
withKeyEncodingin classAbstractDelegatingAdvancedCache<K,V>
-
withWrapping
public AdvancedCache<K,V> withWrapping(Class<? extends org.infinispan.commons.dataconversion.Wrapper> wrapperClass) Description copied from interface:AdvancedCachePerforms any cache operations using the specifiedWrapper.- Specified by:
withWrappingin interfaceAdvancedCache<K,V> - Overrides:
withWrappingin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
wrapperClass-Wrapperfor the keys and values.- Returns:
- an instance of
AdvancedCachewhere all operations will use the supplied wrapper.
-
withMediaType
Description copied from interface:AdvancedCachePerform any cache operations using an alternateMediaType.- Specified by:
withMediaTypein interfaceAdvancedCache<K,V> - Overrides:
withMediaTypein classAbstractDelegatingAdvancedCache<K,V> - Parameters:
keyMediaType-MediaTypefor the keys.valueMediaType-for the values.invalid reference
org.infinispan.commons.dataconversion- Returns:
- an instance of
AdvancedCachewhere all data will formatted according to the suppliedMediaType.
-
withMediaType
public <K1,V1> AdvancedCache<K1,V1> withMediaType(org.infinispan.commons.dataconversion.MediaType keyMediaType, org.infinispan.commons.dataconversion.MediaType valueMediaType) - Specified by:
withMediaTypein interfaceAdvancedCache<K,V> - Overrides:
withMediaTypein classAbstractDelegatingAdvancedCache<K,V> - See Also:
-
withStorageMediaType
Description copied from interface:AdvancedCachePerform any cache operations using the sameMediaTypeof the cache storage. This is equivalent to disabling transcoding on the cache.- Specified by:
withStorageMediaTypein interfaceAdvancedCache<K,V> - Overrides:
withStorageMediaTypein classAbstractDelegatingAdvancedCache<K,V> - Returns:
- an instance of
AdvancedCachewhere no data conversion will take place.
-
withEncoding
public AdvancedCache<?,?> withEncoding(Class<? extends org.infinispan.commons.dataconversion.Encoder> keyEncoderClass, Class<? extends org.infinispan.commons.dataconversion.Encoder> valueEncoderClass) Description copied from interface:AdvancedCachePerforms any cache operations using the specified pair ofEncoder.- Specified by:
withEncodingin interfaceAdvancedCache<K,V> - Overrides:
withEncodingin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
keyEncoderClass-Encoderfor the keys.valueEncoderClass-Encoderfor the values.- Returns:
- an instance of
AdvancedCachewhere all operations will use the supplied encoders.
-
withWrapping
public AdvancedCache<K,V> withWrapping(Class<? extends org.infinispan.commons.dataconversion.Wrapper> keyWrapperClass, Class<? extends org.infinispan.commons.dataconversion.Wrapper> valueWrapperClass) Description copied from interface:AdvancedCachePerforms any cache operations using the specified pair ofWrapper.- Specified by:
withWrappingin interfaceAdvancedCache<K,V> - Overrides:
withWrappingin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
keyWrapperClass-Wrapperfor the keys.valueWrapperClass-Wrapperfor the values.- Returns:
AdvancedCachewhere all operations will use the supplied wrappers.
-
rewrap
Description copied from class:AbstractDelegatingAdvancedCacheNo generics because some methods returnAdvancedCache<?, ?>, and returning the proper type would require erasure anyway.- Specified by:
rewrapin classAbstractDelegatingAdvancedCache<K,V>
-
getKeyDataConversion
- Specified by:
getKeyDataConversionin interfaceAdvancedCache<K,V> - Overrides:
getKeyDataConversionin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- The associated
DataConversionfor the keys.
-
getValueDataConversion
- Specified by:
getValueDataConversionin interfaceAdvancedCache<K,V> - Overrides:
getValueDataConversionin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- The associated
DataConversionfor the cache's values.
-
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 vary 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
-
replace
-
getDataContainer
Description copied from interface:AdvancedCacheReturns the container where data is stored in the cache. Users should interact with this component with care because direct calls on it bypass the internal interceptors and other infrastructure in place to guarantee the consistency of data.- Specified by:
getDataContainerin interfaceAdvancedCache<K,V> - Overrides:
getDataContainerin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- the data container associated with this cache instance
-
replaceAsync
public CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) - Specified by:
replaceAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
replaceAsyncin classAbstractDelegatingCache<K,V>
-
getTransactionManager
public jakarta.transaction.TransactionManager getTransactionManager()- Specified by:
getTransactionManagerin interfaceorg.infinispan.commons.api.TransactionalCache- Overrides:
getTransactionManagerin classAbstractDelegatingAdvancedCache<K,V>
-
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 likely hood 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) -
remove
-
query
-
continuousQuery
- Specified by:
continuousQueryin interfaceorg.infinispan.commons.api.BasicCache<K,V> - Overrides:
continuousQueryin classAbstractDelegatingCache<K,V>
-
getAll
Description copied from interface:AdvancedCacheGets a collection of entries, returning them asMapof 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
CacheLoaderis 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
Mapwill 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.- Specified by:
getAllin interfaceAdvancedCache<K,V> - Overrides:
getAllin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
keys- The keys whose associated values are to be returned.- Returns:
- A map of entries that were found for the given keys. If an entry is not found for a given key, it will not be in the returned map.
-
getAllAsync
- Specified by:
getAllAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
getAllAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
getLockManager
Description copied from interface:AdvancedCacheReturns the component that deals with all aspects of acquiring and releasing locks for cache entries.- Specified by:
getLockManagerin interfaceAdvancedCache<K,V> - Overrides:
getLockManagerin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- retrieves the lock manager associated with this cache instance
-
replaceAsync
- Specified by:
replaceAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
replaceAsyncin classAbstractDelegatingCache<K,V>
-
getStats
Description copied from interface:AdvancedCacheReturns aStatsobject that allows several statistics associated with this cache at runtime.- Specified by:
getStatsin interfaceAdvancedCache<K,V> - Overrides:
getStatsin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- this cache's
Statsobject
-
getXAResource
Description copied from interface:AdvancedCacheReturns theXAResourceassociated with this cache which can be used to do transactional recovery.- Specified by:
getXAResourcein interfaceAdvancedCache<K,V> - Overrides:
getXAResourcein classAbstractDelegatingAdvancedCache<K,V> - Returns:
- an instance of
XAResource
-
getClassLoader
Description copied from interface:AdvancedCacheReturns the cache loader associated associated with this cache. As an alternative to setting this on every invocation, users could also consider using theDecoratedCachewrapper.- Specified by:
getClassLoaderin interfaceAdvancedCache<K,V> - Overrides:
getClassLoaderin classAbstractDelegatingAdvancedCache<K,V> - Returns:
- this cache's cache loader
-
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) - Specified by:
replaceAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
replaceAsyncin classAbstractDelegatingCache<K,V>
-
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 likely hood 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 operations *Supported 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) -
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) - Specified by:
replaceAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Overrides:
replaceAsyncin classAbstractDelegatingCache<K,V>
-
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 likely hood 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 operations *Supported 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. -
getAsync
-
put
Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#put(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.- Specified by:
putin interfaceAdvancedCache<K,V> - Overrides:
putin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key to usevalue- value to storemetadata- information to store alongside the value- Returns:
- the previous value associated with key, or null if there was no mapping for key.
-
putAll
Description copied from interface:AdvancedCacheAn overloaded form ofMap.putAll(Map), which takes in an instance ofMetadatawhich can be used to provide metadata information for the entries being stored, such as lifespan, version of value...etc.- Specified by:
putAllin interfaceAdvancedCache<K,V> - Overrides:
putAllin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
m- the values to storemetadata- information to store alongside the value(s)
-
putAllAsync
- Specified by:
putAllAsyncin interfaceAdvancedCache<K,V> - Overrides:
putAllAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
putAll
-
replace
Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#replace(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
replacein interfaceAdvancedCache<K,V> - Overrides:
replacein classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedvalue- value to be associated with the specified keymetadata- information to store alongside the new value- Returns:
- the previous value associated with the specified key, or null if there was no mapping for the key.
-
replaceAsync
Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#replaceAsync(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
replaceAsyncin interfaceAdvancedCache<K,V> - Overrides:
replaceAsyncin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedvalue- value to be associated with the specified keymetadata- information to store alongside the new value- Returns:
- the future that contains previous value associated with the specified key, or null if there was no mapping for the key.
-
replaceAsyncEntry
Description copied from interface:AdvancedCacheAn extension ofAdvancedCache.replaceAsync(K, V, Metadata), which returns aCacheEntryinstead of only the value.- Specified by:
replaceAsyncEntryin interfaceAdvancedCache<K,V> - Overrides:
replaceAsyncEntryin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedvalue- value to be associated with the specified keymetadata- information to store alongside the new value- Returns:
- the future that contains previous
CacheEntryassociated with the specified key, or null if there was no mapping for the key. - See Also:
-
replace
Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#replace(K, V, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
replacein interfaceAdvancedCache<K,V> - Overrides:
replacein classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key with which the specified value is associatedoldValue- value expected to be associated with the specified keynewValue- value to be associated with the specified keymetadata- information to store alongside the new value- Returns:
- true if the value was replaced
-
replaceAsync
- Specified by:
replaceAsyncin interfaceAdvancedCache<K,V> - Overrides:
replaceAsyncin classAbstractDelegatingAdvancedCache<K,V>
-
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. -
putIfAbsent
Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#putIfAbsent(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
putIfAbsentin interfaceAdvancedCache<K,V> - Overrides:
putIfAbsentin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
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 value- Returns:
- the previous value associated with the specified key, or null if there was no mapping for the key.
-
putIfAbsentAsync
Description copied from interface:AdvancedCacheAn overloaded form of, which takes in an instance ofinvalid reference
#putIfAbsentAsync(K, V)Metadatawhich can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadatais only stored if the call is successful.- Specified by:
putIfAbsentAsyncin interfaceAdvancedCache<K,V> - Overrides:
putIfAbsentAsyncin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
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 value- Returns:
- A future containing the previous value associated with the specified key, or null if there was no mapping for the key.
-
putIfAbsentAsyncEntry
Description copied from interface:AdvancedCacheAn extension form ofAdvancedCache.putIfAbsentAsync(K, V, Metadata), which returns aCacheEntryinstead of only the value.- Specified by:
putIfAbsentAsyncEntryin interfaceAdvancedCache<K,V> - Overrides:
putIfAbsentAsyncEntryin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
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 value- Returns:
- the future that contains previous
CacheEntryassociated with the specified key, or null if there was no mapping for the key. - See Also:
-
putAsync
Description copied from interface:AdvancedCacheAsynchronous version ofAdvancedCache.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 overAdvancedCache.put(Object, Object, Metadata)if used in LOCAL mode.- Specified by:
putAsyncin interfaceAdvancedCache<K,V> - Overrides:
putAsyncin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key to usevalue- value to storemetadata- information to store alongside the new value- Returns:
- a future containing the old value replaced.
-
putAsyncEntry
Description copied from interface:AdvancedCacheExtension ofAdvancedCache.putAsync(K, V, Metadata)which returns aCacheEntryinstead of only the previous value.- Specified by:
putAsyncEntryin interfaceAdvancedCache<K,V> - Overrides:
putAsyncEntryin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key to usevalue- value to storemetadata- information to store alongside the new value- Returns:
- a future containing the old
CacheEntryreplaced.
-
getCacheEntry
Description copied from interface:AdvancedCacheRetrieves a CacheEntry corresponding to a specific key.- Specified by:
getCacheEntryin interfaceAdvancedCache<K,V> - Overrides:
getCacheEntryin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- the key whose associated cache entry is to be returned- Returns:
- the cache entry to which the specified key is mapped, or
nullif this map contains no mapping for the key
-
getCacheEntryAsync
Description copied from interface:AdvancedCacheRetrieves a CacheEntry corresponding to a specific key.- Specified by:
getCacheEntryAsyncin interfaceAdvancedCache<K,V> - Overrides:
getCacheEntryAsyncin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- the key whose associated cache entry is to be returned- Returns:
- a future with the cache entry to which the specified key is mapped, or with
nullif this map contains no mapping for the key
-
getAllCacheEntries
Description copied from interface:AdvancedCacheGets a collection of entries from theAdvancedCache, returning them asMapof 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
CacheLoaderis 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
Mapwill 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.- Specified by:
getAllCacheEntriesin interfaceAdvancedCache<K,V> - Overrides:
getAllCacheEntriesin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
keys- The keys whose associated values are to be returned.- Returns:
- A map of entries that were found for the given keys. Keys not found in the cache are present in the map with null values.
-
getAndPutAll
Description copied from interface:AdvancedCacheExecutes an equivalent ofMap.putAll(Map), returning previous values of the modified entries.- Specified by:
getAndPutAllin interfaceAdvancedCache<K,V> - Overrides:
getAndPutAllin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
map- mappings to be stored in this map- Returns:
- A map of previous values for the given keys. If the previous mapping does not exist it will not be in the returned map.
-
getGroup
Description copied from interface:AdvancedCacheIt fetches all the keys which belong to the group. Semantically, it iterates over all the keys in memory and persistence, and performs a read operation in the keys found. Multiple invocations inside a transaction ensures that all the keys previous read are returned and it may return newly added keys to the group from other committed transactions (also known as phantom reads). Themapreturned is immutable and represents the group at the time of the invocation. If you want to add or remove keys from a group useBasicCache.put(Object, Object)andBasicCache.remove(Object). To remove all the keys in the group useAdvancedCache.removeGroup(String). To improve performance you may use theflagFlag.SKIP_CACHE_LOADto avoid fetching the key/value from persistence. However, you will get an inconsistent snapshot of the group.- Specified by:
getGroupin interfaceAdvancedCache<K,V> - Overrides:
getGroupin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
groupName- the group name.- Returns:
- an immutable
Mapwith the key/value pairs.
-
removeGroup
Description copied from interface:AdvancedCacheIt removes all the key which belongs to a group. Semantically, it fetches the most recent group keys/values and removes them. Note that, concurrent addition perform by other transactions/threads to the group may not be removed.- Specified by:
removeGroupin interfaceAdvancedCache<K,V> - Overrides:
removeGroupin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
groupName- the group name.
-
equals
-
hashCode
public int hashCode() -
toString
- Overrides:
toStringin classAbstractDelegatingCache<K,V>
-
touch
Description copied from interface:AdvancedCacheThe same asAdvancedCache.touch(Object, boolean)except that the segment is already known. This can be helpful to reduce an extra segment computation- Specified by:
touchin interfaceAdvancedCache<K,V> - Overrides:
touchin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key of the entry to touchsegment- segment of the keytouchEvenIfExpired- true if the entry should be touched even if already expired via max idle, effectively making it so the entry is no longer expired via max idle- Returns:
- true if the entry was actually touched
-
touch
Description copied from interface:AdvancedCacheTouches the given key if present. This will refresh its last access time, used for max idle, and count as a recent access for eviction purposes.Note that it is possible to touch an entry that is expired via max idle if
touchEvenIfExpiredargument istrue.This method will return without blocking and complete the returned stage with a value after all appropriate nodes have actually touched the value.
- Specified by:
touchin interfaceAdvancedCache<K,V> - Overrides:
touchin classAbstractDelegatingAdvancedCache<K,V> - Parameters:
key- key of the entry to touchtouchEvenIfExpired- true if the entry should be touched even if already expired via max idle, effectively making it so the entry is no longer expired via max idle- Returns:
- true if the entry was actually touched
-