Class EncoderCache<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,
,V> Map<K,
,V> AdvancedCache<K,
,V> Cache<K,
,V> AsyncCache<K,
,V> BasicCache<K,
,V> BatchingCache
,Lifecycle
,TransactionalCache
,FilteringListenable<K,
,V> Listenable
Encoder
and Wrapper
to convert between storage value and
read/write value.- Since:
- 9.1
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache
cache
-
Constructor Summary
ConstructorDescriptionEncoderCache
(AdvancedCache<K, V> cache, InternalEntryFactory entryFactory, BasicComponentRegistry componentRegistry, DataConversion keyDataConversion, DataConversion valueDataConversion) -
Method Summary
Modifier and TypeMethodDescription<C> void
addFilteredListener
(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)
void
addListener
(Object listener) Adds a listener to the component.<C> void
addListener
(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> void
addStorageFormatFilteredListener
(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.compute
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) An overloaded form ofConcurrentMap.compute(Object, BiFunction)
which takes in lifespan parameters.compute
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.compute(Object, BiFunction)
which takes in lifespan and maxIdleTime parameters.An overloaded form of#compute(K, BiFunction)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.compute
(K key, SerializableBiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) computeAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.compute(Object, BiFunction)
.computeAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit)
.computeAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit, long, TimeUnit)
.computeAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Overloaded#computeAsync(K, BiFunction)
, which stores metadata alongside the value.computeAsync
(K key, SerializableBiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) computeIfAbsent
(K key, Function<? super K, ? extends V> mappingFunction) computeIfAbsent
(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) An overloaded form ofConcurrentMap.computeIfAbsent(Object, Function)
which takes in lifespan parameters.computeIfAbsent
(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.computeIfAbsent(Object, Function)
which takes in lifespan and maxIdleTime parameters.An overloaded form of#computeIfAbsent(K, Function)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.computeIfAbsent
(K key, SerializableFunction<? super K, ? extends V> mappingFunction, Metadata metadata) computeIfAbsentAsync
(K key, Function<? super K, ? extends V> mappingFunction) Asynchronous version ofConcurrentMap.computeIfAbsent(Object, Function)
.computeIfAbsentAsync
(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit)
.computeIfAbsentAsync
(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit)
.Overloaded#computeIfAbsentAsync(K, Function)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.computeIfAbsentAsync
(K key, SerializableFunction<? super K, ? extends V> mappingFunction, Metadata metadata) computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) An overloaded form ofConcurrentMap.computeIfPresent(Object, BiFunction)
which takes in lifespan parameters.computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.computeIfPresent(Object, BiFunction)
which takes in lifespan and maxIdleTime parameters.computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) An overloaded form of#computeIfPresent(K, BiFunction)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.computeIfPresent
(K key, SerializableBiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) computeIfPresentAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.computeIfPresent(Object, BiFunction)
.computeIfPresentAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit)
.computeIfPresentAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit)
.computeIfPresentAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Overloaded#computeIfPresentAsync(K, BiFunction)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.computeIfPresentAsync
(K key, SerializableBiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) boolean
containsKey
(Object key) containsKeyAsync
(K key) Asynchronous version ofMap.containsKey(Object)
boolean
containsValue
(Object value) entrySet()
Returns a set view of the mappings contained in this cache and cache loader across the entire cluster.void
Evicts an entry from the memory of the cache.void
forEach
(BiConsumer<? super K, ? super V> action) Gets a collection of entries, returning them asMap
of the values associated with the set of keys requested.getAllAsync
(Set<?> keys) TODO This should be in AdvancedCache with getAllMap<K,
CacheEntry<K, V>> getAllCacheEntries
(Set<?> keys) Gets a collection of entries from theAdvancedCache
, returning them asMap
of 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.Asynchronous version ofMap.get(Object)
that allows user code to retrieve the value associated with a key at a later stage, hence allowing multiple parallel get requests to be sent.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.It fetches all the keys which belong to the group.getOrDefault
(Object key, V defaultValue) keyFromStorage
(Object key) keySet()
Returns a set view of the keys contained in this cache and cache loader across the entire cluster.keyToStorage
(Object key) boolean
lock
(Collection<? extends K> keys) Locks collections of keys eagerly across cache nodes in a cluster.boolean
Locks a given key or keys eagerly across cache nodes in a cluster.merge
(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) An overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.merge
(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.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 ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.merge
(K key, V value, SerializableBiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) mergeAsync
(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.merge(Object, Object, BiFunction)
.mergeAsync
(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit)
.mergeAsync
(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Asynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit)
.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 ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.mergeAsync
(K key, V value, SerializableBiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) If the return value of this operation will be ignored by the application, the user is strongly encouraged to use theFlag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently as possible (i.e.An overloaded form ofBasicCache.put(Object, Object)
, which takes in lifespan parameters.put
(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofBasicCache.put(Object, Object)
, which takes in lifespan parameters.An overloaded form of#put(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.void
void
An overloaded form ofMap.putAll(Map)
, which takes in lifespan parameters.void
putAll
(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofMap.putAll(Map)
, which takes in lifespan parameters.void
An overloaded form ofMap.putAll(Map)
, which takes in an instance ofMetadata
which 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) Asynchronous version ofMap.putAll(Map)
.putAllAsync
(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.putAll(Map, long, TimeUnit)
.putAllAsync
(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.putAll(Map, long, TimeUnit, long, TimeUnit)
.putAllAsync
(Map<? extends K, ? extends V> map, Metadata metadata) Asynchronous version ofBasicCache.put(Object, Object)
.Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit)
.Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit)
.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 aCacheEntry
instead of only the previous value.putAsyncReturnEntry
(K key, V value, Metadata metadata) void
putForExternalRead
(K key, V value) Under special operating behavior, associates the value with the specified key.void
putForExternalRead
(K key, V value, long lifespan, TimeUnit unit) An overloaded form ofCache.putForExternalRead(K, V)
, which takes in lifespan parameters.void
putForExternalRead
(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) An overloaded form ofCache.putForExternalRead(K, V)
, which takes in lifespan parameters.void
putForExternalRead
(K key, V value, Metadata metadata) An overloaded form of#putForExternalRead(K, V)
, which takes in an instance ofMetadata
which 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) An overloaded form ofConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.putIfAbsent
(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.putIfAbsent
(K key, V value, Metadata metadata) An overloaded form of#putIfAbsent(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.putIfAbsentAsync
(K key, V value) Asynchronous version ofConcurrentMap.putIfAbsent(Object, Object)
.putIfAbsentAsync
(K key, V value, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit)
.putIfAbsentAsync
(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
.putIfAbsentAsync
(K key, V value, Metadata metadata) An overloaded form of#putIfAbsentAsync(K, V)
, which takes in an instance ofMetadata
which 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 aCacheEntry
instead of only the value.putIfAbsentAsyncReturnEntry
(K key, V value, Metadata metadata) If the return value of this operation will be ignored by the application, the user is strongly encouraged to use theFlag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently as possible (i.e.boolean
removeAsync
(Object key) Asynchronous version ofBasicCache.remove(Object)
.removeAsync
(Object key, Object value) Asynchronous version ofConcurrentMap.remove(Object, Object)
.removeAsyncEntry
(Object key) An extension ofAsyncCache.removeAsync(Object)
, which returns aCacheEntry
instead of only the value.removeAsyncReturnEntry
(K key) removeLifespanExpired
(K key, V value, Long lifespan) Attempts to remove the entry if it is expired.removeMaxIdleExpired
(K key, V value) Attempts to remove the entry for the given key, if it has expired due to max idle.An overloaded form ofConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.replace
(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.An overloaded form of#replace(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.boolean
boolean
An overloaded form ofConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.boolean
replace
(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.boolean
An overloaded form of#replace(K, V, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.void
replaceAll
(BiFunction<? super K, ? super V, ? extends V> function) replaceAsync
(K key, V value) Asynchronous version ofConcurrentMap.replace(Object, Object)
.replaceAsync
(K key, V value, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit)
.replaceAsync
(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit)
.replaceAsync
(K key, V value, Metadata metadata) An overloaded form of#replaceAsync(K, V)
, which takes in an instance ofMetadata
which 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) Asynchronous version ofConcurrentMap.replace(Object, Object, Object)
.replaceAsync
(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit)
.replaceAsync
(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
.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 aCacheEntry
instead of only the value.replaceAsyncReturnEntry
(K key, V value, Metadata metadata) rewrap
(AdvancedCache newDelegate) No generics because some methods returnAdvancedCache<?, ?>
, and returning the proper type would require erasure anyway.Touches the given key if present.The same asAdvancedCache.touch(Object, boolean)
except that the segment is already known.valueFromStorage
(Object value) values()
Returns a collection view of the values contained in this cache across the entire cluster.valueToStorage
(Object value) void
withEncoding
(Class<? extends Encoder> encoderClass) Performs any cache operations using the specifiedEncoder
.withEncoding
(Class<? extends Encoder> keyEncoderClass, Class<? extends Encoder> valueEncoderClass) Performs any cache operations using the specified pair ofEncoder
.withKeyEncoding
(Class<? extends Encoder> encoderClass) withMediaType
(String keyMediaType, String valueMediaType) Perform any cache operations using an alternateMediaType
.withMediaType
(MediaType kType, MediaType vType) Perform any cache operations using the sameMediaType
of the cache storage.withWrapping
(Class<? extends Wrapper> wrapper) Performs any cache operations using the specifiedWrapper
.withWrapping
(Class<? extends Wrapper> keyWrapperClass, Class<? extends Wrapper> valueWrapperClass) Performs any cache operations using the specified pair ofWrapper
.Methods inherited from class org.infinispan.cache.impl.AbstractDelegatingAdvancedCache
getAdvancedCache, getAsyncInterceptorChain, getAuthorizationManager, getAvailability, getBatchContainer, getCacheAvailability, getClassLoader, getComponentRegistry, getDataContainer, getDistributionManager, getEvictionManager, getExpirationManager, getLockManager, getRpcManager, getStats, getTransactionManager, getXAResource, isRebalancingEnabled, lockAs, lockedStream, noFlags, removeGroup, setAvailability, setCacheAvailability, setRebalancingEnabled, transform, with, withFlags, withFlags, withFlags, withSubject
Methods inherited from class org.infinispan.cache.impl.AbstractDelegatingCache
clear, clearAsync, endBatch, getCacheConfiguration, getCacheManager, getCacheName, getCacheStatus, getConfigurationAsProperties, getDelegate, getListeners, getName, getStatus, getVersion, isEmpty, removeListener, removeListenerAsync, shutdown, size, sizeAsync, start, startBatch, stop, toString, unwrapCache
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.infinispan.commons.api.AsyncCache
clearAsync, sizeAsync
Methods inherited from interface org.infinispan.commons.api.BasicCache
getName, getVersion
Methods inherited from interface org.infinispan.commons.api.BatchingCache
endBatch, startBatch
Methods inherited from interface org.infinispan.Cache
clear, compute, compute, compute, computeAsync, computeAsync, computeAsync, computeIfAbsent, computeIfAbsent, computeIfAbsent, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresent, computeIfPresentAsync, getCacheConfiguration, getCacheManager, getStatus, merge, merge, merge, mergeAsync, mergeAsync, mergeAsync, shutdown, size, stop
Methods inherited from interface org.infinispan.notifications.Listenable
getListeners, removeListener, removeListenerAsync
-
Constructor Details
-
EncoderCache
public EncoderCache(AdvancedCache<K, V> cache, InternalEntryFactory entryFactory, BasicComponentRegistry componentRegistry, DataConversion keyDataConversion, DataConversion valueDataConversion)
-
-
Method Details
-
rewrap
Description copied from class:AbstractDelegatingAdvancedCache
No generics because some methods returnAdvancedCache<?, ?>
, and returning the proper type would require erasure anyway.- Specified by:
rewrap
in classAbstractDelegatingAdvancedCache<K,
V>
-
keyToStorage
-
valueToStorage
-
keyFromStorage
-
valueFromStorage
-
wireRealCache
public void wireRealCache() -
putForExternalRead
Description copied from interface:Cache
Under 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:
putForExternalRead
in interfaceCache<K,
V> - Overrides:
putForExternalRead
in 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:Cache
An overloaded form ofCache.putForExternalRead(K, V)
, which takes in lifespan parameters.- Specified by:
putForExternalRead
in interfaceCache<K,
V> - Overrides:
putForExternalRead
in 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:Cache
An overloaded form ofCache.putForExternalRead(K, V)
, which takes in lifespan parameters.- Specified by:
putForExternalRead
in interfaceCache<K,
V> - Overrides:
putForExternalRead
in 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
-
evict
Description copied from interface:Cache
Evicts 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. -
put
Description copied from interface:BasicCache
An overloaded form ofBasicCache.put(Object, Object)
, which takes in lifespan parameters.- Specified by:
put
in interfaceBasicCache<K,
V> - Overrides:
put
in 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- Returns:
- the value being replaced, or null if nothing is being replaced.
-
getKeyDataConversion
- Specified by:
getKeyDataConversion
in interfaceAdvancedCache<K,
V> - Overrides:
getKeyDataConversion
in classAbstractDelegatingAdvancedCache<K,
V> - Returns:
- The associated
DataConversion
for the keys.
-
getValueDataConversion
- Specified by:
getValueDataConversion
in interfaceAdvancedCache<K,
V> - Overrides:
getValueDataConversion
in classAbstractDelegatingAdvancedCache<K,
V> - Returns:
- The associated
DataConversion
for the cache's values.
-
putIfAbsent
Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.- Specified by:
putIfAbsent
in interfaceBasicCache<K,
V> - Overrides:
putIfAbsent
in 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- Returns:
- the value being replaced, or null if nothing is being replaced.
-
putAll
Description copied from interface:BasicCache
An overloaded form ofMap.putAll(Map)
, which takes in lifespan parameters. Note that the lifespan is applied to all mappings in the map passed in.- Specified by:
putAll
in interfaceBasicCache<K,
V> - Overrides:
putAll
in classAbstractDelegatingCache<K,
V> - Parameters:
map
- map containing mappings to enterlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespan
-
replace
Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.- Specified by:
replace
in interfaceBasicCache<K,
V> - Overrides:
replace
in 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- Returns:
- the value being replaced, or null if nothing is being replaced.
-
replace
Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.- Specified by:
replace
in interfaceBasicCache<K,
V> - Overrides:
replace
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to useoldValue
- value to replacevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespan- Returns:
- true if the value was replaced, false otherwise
-
put
public V put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofBasicCache.put(Object, Object)
, which takes in lifespan parameters.- Specified by:
put
in interfaceBasicCache<K,
V> - Overrides:
put
in 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 lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time- Returns:
- the value being replaced, or null if nothing is being replaced.
-
putIfAbsent
public V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.- Specified by:
putIfAbsent
in interfaceBasicCache<K,
V> - Overrides:
putIfAbsent
in 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 lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time- Returns:
- the value being replaced, or null if nothing is being replaced.
-
putAll
public void putAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofMap.putAll(Map)
, which takes in lifespan parameters. Note that the lifespan is applied to all mappings in the map passed in.- Specified by:
putAll
in interfaceBasicCache<K,
V> - Overrides:
putAll
in classAbstractDelegatingCache<K,
V> - Parameters:
map
- map containing mappings to enterlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time
-
replace
public V replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.- Specified by:
replace
in interfaceBasicCache<K,
V> - Overrides:
replace
in 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 lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time- Returns:
- the value being replaced, or null if nothing is being replaced.
-
replace
public boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.- Specified by:
replace
in interfaceBasicCache<K,
V> - Overrides:
replace
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to useoldValue
- value to replacevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time- Returns:
- true if the value was replaced, false otherwise
-
replaceAll
- Specified by:
replaceAll
in interfaceConcurrentMap<K,
V> - Specified by:
replaceAll
in interfaceMap<K,
V> - Overrides:
replaceAll
in classAbstractDelegatingCache<K,
V>
-
putAsync
Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.put(Object, Object)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAsync
in interfaceAsyncCache<K,
V> - Overrides:
putAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usevalue
- value to store- Returns:
- a future containing the old value replaced.
-
putAsync
Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAsync
in interfaceAsyncCache<K,
V> - Overrides:
putAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan- Returns:
- a future containing the old value replaced
-
putAsync
public CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAsync
in interfaceAsyncCache<K,
V> - Overrides:
putAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleUnit
- time unit for max idle time- Returns:
- a future containing the old value replaced
-
putAllAsync
Description copied from interface:AsyncCache
Asynchronous version ofMap.putAll(Map)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAllAsync
in interfaceAsyncCache<K,
V> - Overrides:
putAllAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
data
- to store- Returns:
- a future containing a void return type
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.putAll(Map, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAllAsync
in interfaceAsyncCache<K,
V> - Overrides:
putAllAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
data
- to storelifespan
- lifespan of entryunit
- time unit for lifespan- Returns:
- a future containing a void return type
-
putAllAsync
public CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.putAll(Map, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putAllAsync
in interfaceAsyncCache<K,
V> - Overrides:
putAllAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
data
- to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleUnit
- time unit for max idle time- Returns:
- a future containing a void return type
-
putAllAsync
- Specified by:
putAllAsync
in interfaceAdvancedCache<K,
V> - Overrides:
putAllAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
putIfAbsentAsync
Description copied from interface:AsyncCache
Asynchronous version ofConcurrentMap.putIfAbsent(Object, Object)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putIfAbsentAsync
in interfaceAsyncCache<K,
V> - Overrides:
putIfAbsentAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usevalue
- value to store- Returns:
- a future containing the old value replaced.
-
putIfAbsentAsync
Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putIfAbsentAsync
in interfaceAsyncCache<K,
V> - Overrides:
putIfAbsentAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan- Returns:
- a future containing the old value replaced
-
lock
Description copied from interface:AdvancedCache
Locks 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:
lock
in interfaceAdvancedCache<K,
V> - Overrides:
lock
in 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
.
-
lock
Description copied from interface:AdvancedCache
Locks 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:
lock
in interfaceAdvancedCache<K,
V> - Overrides:
lock
in 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
.
-
putIfAbsentAsync
public CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
putIfAbsentAsync
in interfaceAsyncCache<K,
V> - Overrides:
putIfAbsentAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleUnit
- time unit for max idle time- Returns:
- a future containing the old value replaced
-
putIfAbsentAsync
Description copied from interface:AdvancedCache
An overloaded form of#putIfAbsentAsync(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
putIfAbsentAsync
in interfaceAdvancedCache<K,
V> - Overrides:
putIfAbsentAsync
in 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:AdvancedCache
An extension form ofAdvancedCache.putIfAbsentAsync(K, V, Metadata)
, which returns aCacheEntry
instead of only the value.- Specified by:
putIfAbsentAsyncEntry
in interfaceAdvancedCache<K,
V> - Overrides:
putIfAbsentAsyncEntry
in 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
CacheEntry
associated with the specified key, or null if there was no mapping for the key. - See Also:
-
removeAsync
Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.remove(Object)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
removeAsync
in interfaceAsyncCache<K,
V> - Overrides:
removeAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to remove- Returns:
- a future containing the value removed
-
removeAsync
Description copied from interface:AsyncCache
Asynchronous version ofConcurrentMap.remove(Object, Object)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
removeAsync
in interfaceAsyncCache<K,
V> - Overrides:
removeAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to removevalue
- value to match on- Returns:
- a future containing a boolean, indicating whether the entry was removed or not
-
replaceAsync
Description copied from interface:AsyncCache
Asynchronous version ofConcurrentMap.replace(Object, Object)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsync
in interfaceAsyncCache<K,
V> - Overrides:
replaceAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to removevalue
- value to store- Returns:
- a future containing the previous value overwritten
-
replaceAsync
Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsync
in interfaceAsyncCache<K,
V> - Overrides:
replaceAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to removevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan- Returns:
- a future containing the previous value overwritten
-
replaceAsync
Description copied from interface:AdvancedCache
An overloaded form of#replaceAsync(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
replaceAsync
in interfaceAdvancedCache<K,
V> - Overrides:
replaceAsync
in 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:AdvancedCache
An extension ofAdvancedCache.replaceAsync(K, V, Metadata)
, which returns aCacheEntry
instead of only the value.- Specified by:
replaceAsyncEntry
in interfaceAdvancedCache<K,
V> - Overrides:
replaceAsyncEntry
in 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
CacheEntry
associated with the specified key, or null if there was no mapping for the key. - See Also:
-
getAll
Description copied from interface:AdvancedCache
Gets a collection of entries, returning them asMap
of the values associated with the set of keys requested.If the cache is configured read-through, and a get for a key would return null because an entry is missing from the cache, the Cache's
CacheLoader
is called in an attempt to load the entry. If an entry cannot be loaded for a given key, the returned Map will contain null for value of the key.Unlike other bulk methods if this invoked in an existing transaction all entries will be stored in the current transactional context
The returned
Map
will be a copy and updates to the map will not be reflected in the Cache and vice versa. The keys and values themselves however may not be copies depending on if storeAsBinary is enabled and the value was retrieved from the local node.- Specified by:
getAll
in interfaceAdvancedCache<K,
V> - Overrides:
getAll
in 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
Description copied from interface:AsyncCache
TODO This should be in AdvancedCache with getAll- Specified by:
getAllAsync
in interfaceAsyncCache<K,
V> - Overrides:
getAllAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
getCacheEntry
Description copied from interface:AdvancedCache
Retrieves a CacheEntry corresponding to a specific key.- Specified by:
getCacheEntry
in interfaceAdvancedCache<K,
V> - Overrides:
getCacheEntry
in 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
null
if this map contains no mapping for the key
-
getCacheEntryAsync
Description copied from interface:AdvancedCache
Retrieves a CacheEntry corresponding to a specific key.- Specified by:
getCacheEntryAsync
in interfaceAdvancedCache<K,
V> - Overrides:
getCacheEntryAsync
in 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
null
if this map contains no mapping for the key
-
putAsyncReturnEntry
-
replaceAsyncReturnEntry
-
putIfAbsentAsyncReturnEntry
public CompletionStage<CacheEntry<K,V>> putIfAbsentAsyncReturnEntry(K key, V value, Metadata metadata) -
removeAsyncReturnEntry
-
replaceAsync
public CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsync
in interfaceAsyncCache<K,
V> - Overrides:
replaceAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to removevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleUnit
- time unit for max idle time- Returns:
- a future containing the previous value overwritten
-
getAllCacheEntries
Description copied from interface:AdvancedCache
Gets a collection of entries from theAdvancedCache
, returning them asMap
of the cache entries associated with the set of keys requested.If the cache is configured read-through, and a get for a key would return null because an entry is missing from the cache, the Cache's
CacheLoader
is called in an attempt to load the entry. If an entry cannot be loaded for a given key, the returned Map will contain null for value of the key.Unlike other bulk methods if this invoked in an existing transaction all entries will be stored in the current transactional context
The returned
Map
will be a copy and updates to the map will not be reflected in the Cache and vice versa. The keys and values themselves however may not be copies depending on if storeAsBinary is enabled and the value was retrieved from the local node.- Specified by:
getAllCacheEntries
in interfaceAdvancedCache<K,
V> - Overrides:
getAllCacheEntries
in 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.
-
getGroup
Description copied from interface:AdvancedCache
It 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). Themap
returned 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 theflag
Flag.SKIP_CACHE_LOAD
to avoid fetching the key/value from persistence. However, you will get an inconsistent snapshot of the group.- Specified by:
getGroup
in interfaceAdvancedCache<K,
V> - Overrides:
getGroup
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
groupName
- the group name.- Returns:
- an immutable
Map
with the key/value pairs.
-
replaceAsync
Description copied from interface:AsyncCache
Asynchronous version ofConcurrentMap.replace(Object, Object, Object)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsync
in interfaceAsyncCache<K,
V> - Overrides:
replaceAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to removeoldValue
- value to overwritenewValue
- value to store- Returns:
- a future containing a boolean, indicating whether the entry was replaced or not
-
replaceAsync
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsync
in interfaceAsyncCache<K,
V> - Overrides:
replaceAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan- Returns:
- a future containing a boolean, indicating whether the entry was replaced or not
-
put
Description copied from interface:AdvancedCache
An overloaded form of#put(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.- Specified by:
put
in interfaceAdvancedCache<K,
V> - Overrides:
put
in 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.
-
replace
Description copied from interface:AdvancedCache
An overloaded form of#replace(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
replace
in interfaceAdvancedCache<K,
V> - Overrides:
replace
in 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
public CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
replaceAsync
in interfaceAsyncCache<K,
V> - Overrides:
replaceAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleUnit
- time unit for max idle time- Returns:
- a future containing a boolean, indicating whether the entry was replaced or not
-
replace
Description copied from interface:AdvancedCache
An overloaded form of#replace(K, V, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
replace
in interfaceAdvancedCache<K,
V> - Overrides:
replace
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
key
- key with which the specified value is associatedoldValue
- value expected to be associated with the specified keyvalue
- value to be associated with the specified keymetadata
- information to store alongside the new value- Returns:
- true if the value was replaced
-
replaceAsync
- Specified by:
replaceAsync
in interfaceAdvancedCache<K,
V> - Overrides:
replaceAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
putIfAbsent
Description copied from interface:AdvancedCache
An overloaded form of#putIfAbsent(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
putIfAbsent
in interfaceAdvancedCache<K,
V> - Overrides:
putIfAbsent
in 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.
-
putAsync
Description copied from interface:AdvancedCache
Asynchronous 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:
putAsync
in interfaceAdvancedCache<K,
V> - Overrides:
putAsync
in 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:AdvancedCache
Extension ofAdvancedCache.putAsync(K, V, Metadata)
which returns aCacheEntry
instead of only the previous value.- Specified by:
putAsyncEntry
in interfaceAdvancedCache<K,
V> - Overrides:
putAsyncEntry
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
key
- key to usevalue
- value to storemetadata
- information to store alongside the new value- Returns:
- a future containing the old
CacheEntry
replaced.
-
putForExternalRead
Description copied from interface:AdvancedCache
An overloaded form of#putForExternalRead(K, V)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
putForExternalRead
in interfaceAdvancedCache<K,
V> - Overrides:
putForExternalRead
in 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
-
putAll
Description copied from interface:AdvancedCache
An overloaded form ofMap.putAll(Map)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entries being stored, such as lifespan, version of value...etc.- Specified by:
putAll
in interfaceAdvancedCache<K,
V> - Overrides:
putAll
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
map
- the values to storemetadata
- information to store alongside the value(s)
-
cacheEntrySet
Description copied from interface:AdvancedCache
Identical 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:
cacheEntrySet
in interfaceAdvancedCache<K,
V> - Overrides:
cacheEntrySet
in classAbstractDelegatingAdvancedCache<K,
V> - Returns:
- the entry set containing all of the CacheEntries
- See Also:
-
removeLifespanExpired
Description copied from interface:AdvancedCache
Attempts 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:
removeLifespanExpired
in interfaceAdvancedCache<K,
V> - Overrides:
removeLifespanExpired
in 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:AdvancedCache
Attempts 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:
removeMaxIdleExpired
in interfaceAdvancedCache<K,
V> - Overrides:
removeMaxIdleExpired
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
key
- the key that expired via max idle for the given entry- Returns:
- if the entry was removed
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
putIfAbsent
in interfaceMap<K,
V> - Overrides:
putIfAbsent
in classAbstractDelegatingCache<K,
V>
-
withEncoding
public AdvancedCache<K,V> withEncoding(Class<? extends Encoder> keyEncoderClass, Class<? extends Encoder> valueEncoderClass) Description copied from interface:AdvancedCache
Performs any cache operations using the specified pair ofEncoder
.- Specified by:
withEncoding
in interfaceAdvancedCache<K,
V> - Overrides:
withEncoding
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
keyEncoderClass
-Encoder
for the keys.valueEncoderClass
-Encoder
for the values.- Returns:
- an instance of
AdvancedCache
where all operations will use the supplied encoders.
-
withEncoding
Description copied from interface:AdvancedCache
Performs any cache operations using the specifiedEncoder
.- Specified by:
withEncoding
in interfaceAdvancedCache<K,
V> - Overrides:
withEncoding
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
encoderClass
-Encoder
used for both keys and values.- Returns:
- an instance of
AdvancedCache
where all operations will use the supplied encoder.
-
withKeyEncoding
- Specified by:
withKeyEncoding
in interfaceAdvancedCache<K,
V> - Overrides:
withKeyEncoding
in classAbstractDelegatingAdvancedCache<K,
V>
-
withWrapping
public AdvancedCache<K,V> withWrapping(Class<? extends Wrapper> keyWrapperClass, Class<? extends Wrapper> valueWrapperClass) Description copied from interface:AdvancedCache
Performs any cache operations using the specified pair ofWrapper
.- Specified by:
withWrapping
in interfaceAdvancedCache<K,
V> - Overrides:
withWrapping
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
keyWrapperClass
-Wrapper
for the keys.valueWrapperClass
-Wrapper
for the values.- Returns:
AdvancedCache
where all operations will use the supplied wrappers.
-
withWrapping
Description copied from interface:AdvancedCache
Performs any cache operations using the specifiedWrapper
.- Specified by:
withWrapping
in interfaceAdvancedCache<K,
V> - Overrides:
withWrapping
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
wrapper
-Wrapper
for the keys and values.- Returns:
- an instance of
AdvancedCache
where all operations will use the supplied wrapper.
-
withMediaType
Description copied from interface:AdvancedCache
Perform any cache operations using an alternateMediaType
.- Specified by:
withMediaType
in interfaceAdvancedCache<K,
V> - Overrides:
withMediaType
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
keyMediaType
-MediaType
for the keys.valueMediaType
-org.infinispan.commons.dataconversion
for the values.- Returns:
- an instance of
AdvancedCache
where all data will formatted according to the suppliedMediaType
.
-
withMediaType
- Specified by:
withMediaType
in interfaceAdvancedCache<K,
V> - Overrides:
withMediaType
in classAbstractDelegatingAdvancedCache<K,
V> - See Also:
-
withStorageMediaType
Description copied from interface:AdvancedCache
Perform any cache operations using the sameMediaType
of the cache storage. This is equivalent to disabling transcoding on the cache.- Specified by:
withStorageMediaType
in interfaceAdvancedCache<K,
V> - Overrides:
withStorageMediaType
in classAbstractDelegatingAdvancedCache<K,
V> - Returns:
- an instance of
AdvancedCache
where no data conversion will take place.
-
remove
-
replace
-
replace
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V> - Overrides:
containsKey
in classAbstractDelegatingCache<K,
V>
-
containsKeyAsync
Description copied from interface:AsyncCache
Asynchronous version ofMap.containsKey(Object)
- Parameters:
key
- key to retrieve- Returns:
- future containing true if the mapping exists.
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V> - Overrides:
containsValue
in classAbstractDelegatingCache<K,
V>
-
compute
Description copied from interface:Cache
When this method is used on a clustered cache, either replicated or distributed, the bifunction will be serialized to owning nodes to perform the operation in the most performant way. However this means the bifunction must have an appropriate
Externalizer
or beSerializable
itself.For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection must be copied and not directly modified, otherwise whenever rollback is called it won't work. This limitation could disappear in following releases if technically possible.
-
compute
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
An overloaded form of#compute(K, BiFunction)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc.- Specified by:
compute
in interfaceAdvancedCache<K,
V> - Overrides:
compute
in 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
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.compute(Object, BiFunction)
which takes in lifespan parameters.- Specified by:
compute
in interfaceBasicCache<K,
V> - Overrides:
compute
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to useremappingFunction
- function to use to compute and store the value under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespan- Returns:
- the computed value that was stored under key
-
compute
public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.compute(Object, BiFunction)
which takes in lifespan and maxIdleTime parameters.- Specified by:
compute
in interfaceBasicCache<K,
V> - Overrides:
compute
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to useremappingFunction
- function to use to compute and store the value under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time- Returns:
- the computed value that was stored under key
-
compute
public V compute(K key, SerializableBiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
-
computeIfPresent
Description copied from interface:Cache
When this method is used on a clustered cache, either replicated or distributed, the bifunction will be serialized to owning nodes to perform the operation in the most performant way. However this means the bifunction must have an appropriate
Externalizer
or beSerializable
itself.For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection must be copied and not directly modified, otherwise whenever rollback is called it won't work. This limitation could disappear in following releases if technically possible.
- Specified by:
computeIfPresent
in interfaceCache<K,
V> - Specified by:
computeIfPresent
in interfaceConcurrentMap<K,
V> - Specified by:
computeIfPresent
in interfaceMap<K,
V> - Overrides:
computeIfPresent
in classAbstractDelegatingCache<K,
V>
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
An overloaded form of#computeIfPresent(K, BiFunction)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
computeIfPresent
in interfaceAdvancedCache<K,
V> - Overrides:
computeIfPresent
in 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) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.computeIfPresent(Object, BiFunction)
which takes in lifespan parameters.- Specified by:
computeIfPresent
in interfaceBasicCache<K,
V> - Overrides:
computeIfPresent
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to useremappingFunction
- function to use to compute and store the value under key, if such existslifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespan- Returns:
- the computed value that was stored under key
-
computeIfPresent
public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.computeIfPresent(Object, BiFunction)
which takes in lifespan and maxIdleTime parameters.- Specified by:
computeIfPresent
in interfaceBasicCache<K,
V> - Overrides:
computeIfPresent
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to useremappingFunction
- function to use to compute and store the value under key, if such existslifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time- Returns:
- the computed value that was stored under key
-
computeIfAbsent
Description copied from interface:Cache
When this method is used on a clustered cache, either replicated or distributed, the function will be serialized to owning nodes to perform the operation in the most performant way. However this means the function must have an appropriate
Externalizer
or beSerializable
itself.For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection must be copied and not directly modified, otherwise whenever rollback is called it won't work. This limitation could disappear in following releases if technically possible.
- Specified by:
computeIfAbsent
in interfaceCache<K,
V> - Specified by:
computeIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
computeIfAbsent
in interfaceMap<K,
V> - Overrides:
computeIfAbsent
in classAbstractDelegatingCache<K,
V>
-
computeIfAbsent
Description copied from interface:AdvancedCache
An overloaded form of#computeIfAbsent(K, Function)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
computeIfAbsent
in interfaceAdvancedCache<K,
V> - Overrides:
computeIfAbsent
in 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) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.computeIfAbsent(Object, Function)
which takes in lifespan parameters.- Specified by:
computeIfAbsent
in interfaceBasicCache<K,
V> - Overrides:
computeIfAbsent
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usemappingFunction
- function to use to compute and store the value under key, if the key is absentlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespan- Returns:
- the computed value that was stored under key
-
computeIfAbsent
public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.computeIfAbsent(Object, Function)
which takes in lifespan and maxIdleTime parameters.- Specified by:
computeIfAbsent
in interfaceBasicCache<K,
V> - Overrides:
computeIfAbsent
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usemappingFunction
- function to use to compute and store the value under key, if the key is absentlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time- Returns:
- the computed value that was stored under key
-
computeIfAbsent
public V computeIfAbsent(K key, SerializableFunction<? super K, ? extends V> mappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
-
merge
public V merge(K key, V value, SerializableBiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
-
computeAsync
public CompletableFuture<V> computeAsync(K key, SerializableBiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, SerializableFunction<? super K, ? extends V> mappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
-
get
-
getOrDefault
- Specified by:
getOrDefault
in interfaceConcurrentMap<K,
V> - Specified by:
getOrDefault
in interfaceMap<K,
V> - Overrides:
getOrDefault
in classAbstractDelegatingCache<K,
V>
-
put
Description copied from interface:BasicCache
If the return value of this operation will be ignored by the application, the user is strongly encouraged to use theFlag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls). -
remove
Description copied from interface:BasicCache
If the return value of this operation will be ignored by the application, the user is strongly encouraged to use theFlag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently as possible (i.e. avoiding needless remote or network calls). -
putAll
-
getAndPutAll
Description copied from interface:AdvancedCache
Executes an equivalent ofMap.putAll(Map)
, returning previous values of the modified entries.- Specified by:
getAndPutAll
in interfaceAdvancedCache<K,
V> - Overrides:
getAndPutAll
in 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.
-
merge
Description copied from interface:Cache
When this method is used on a clustered cache, either replicated or distributed, the bifunction will be serialized to owning nodes to perform the operation in the most performant way. However this means the bifunction must have an appropriate
Externalizer
or beSerializable
itself.For transactional caches, whenever the values of the caches are collections, and the mapping function modifies the collection, the collection must be copied and not directly modified, otherwise whenever rollback is called it won't work. This limitation could disappear in following releases if technically possible.
-
merge
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
An overloaded form ofCache.merge(Object, Object, BiFunction)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
merge
in interfaceAdvancedCache<K,
V> - Overrides:
merge
in 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
-
merge
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.- Specified by:
merge
in interfaceBasicCache<K,
V> - Overrides:
merge
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usevalue
- new value to merge with existing valueremappingFunction
- function to use to merge new and existing values into a merged value to store under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespan- Returns:
- the merged value that was stored under key
-
merge
public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:BasicCache
An overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.- Specified by:
merge
in interfaceBasicCache<K,
V> - Overrides:
merge
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to usevalue
- new value to merge with existing valueremappingFunction
- function to use to merge new and existing values into a merged value to store under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
- time unit for max idle time- Returns:
- the merged value that was stored under key
-
computeIfPresent
public V computeIfPresent(K key, SerializableBiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, SerializableBiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
Overloaded#computeIfPresentAsync(K, BiFunction)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
computeIfPresentAsync
in interfaceAdvancedCache<K,
V> - Overrides:
computeIfPresentAsync
in 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.
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Description copied from interface:AsyncCache
Asynchronous version ofConcurrentMap.computeIfPresent(Object, BiFunction)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfPresentAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeIfPresentAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
computeIfPresentAsync
public CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfPresentAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeIfPresentAsync
in 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) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfPresentAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeIfPresentAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, SerializableBiFunction<? super V, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
mergeAsync
in interfaceAsyncCache<K,
V> - Overrides:
mergeAsync
in 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) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
mergeAsync
in interfaceAsyncCache<K,
V> - Overrides:
mergeAsync
in 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:AdvancedCache
OverloadedAsyncCache.mergeAsync(Object, Object, BiFunction)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
mergeAsync
in interfaceAdvancedCache<K,
V> - Overrides:
mergeAsync
in 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
-
mergeAsync
public CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) Description copied from interface:AsyncCache
Asynchronous version ofConcurrentMap.merge(Object, Object, BiFunction)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
mergeAsync
in interfaceAsyncCache<K,
V> - Overrides:
mergeAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
Overloaded#computeAsync(K, BiFunction)
, which stores metadata alongside the value. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeAsync
in interfaceAdvancedCache<K,
V> - Overrides:
computeAsync
in 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.
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, Metadata metadata) Description copied from interface:AdvancedCache
Overloaded#computeIfAbsentAsync(K, Function)
, which takes in an instance ofMetadata
which can be used to provide metadata information for the entry being stored, such as lifespan, version of value...etc. TheMetadata
is only stored if the call is successful.- Specified by:
computeIfAbsentAsync
in interfaceAdvancedCache<K,
V> - Overrides:
computeIfAbsentAsync
in 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.
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Description copied from interface:AsyncCache
Asynchronous version ofConcurrentMap.compute(Object, BiFunction)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
computeAsync
public CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeAsync
in 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) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction) Description copied from interface:AsyncCache
Asynchronous version ofConcurrentMap.computeIfAbsent(Object, Function)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfAbsentAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeIfAbsentAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfAbsentAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeIfAbsentAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
computeIfAbsentAsync
public CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:AsyncCache
Asynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit)
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
computeIfAbsentAsync
in interfaceAsyncCache<K,
V> - Overrides:
computeIfAbsentAsync
in classAbstractDelegatingAdvancedCache<K,
V>
-
forEach
-
keySet
Description copied from interface:Cache
Returns 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 configuredCacheLoader
and remote entries. The former 2 methods especially have a very high likely hood of causing aOutOfMemoryError
due to storing all the keys in the entire cluster in the array. Use involving execution of this method on a production system is not recommended as they can be quite expensive 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_LOAD
flag should be used to avoid hitting the cache store as this will cause all entries there to be read in (albeit in a batched form to preventOutOfMemoryError
) Also if you want the local contents only you can use theFlag.CACHE_MODE_LOCAL
flag so that other remote nodes are not queried for data. However the loader will still be used unless the previously mentionedFlag.SKIP_CACHE_LOAD
is also configured.Iterator Use
This class implements theCloseableIteratorSet
interface which creates aCloseableIterator
instead of a regular one. This means this iterator must be explicitly closed either through try with resource or calling the close method directly. Technically this iterator will also close itself if you iterate fully over it, but it is safest to always make sure you close it explicitly.Unsupported Operations
Due to not being able to add null values the following methods are not supported and will throwUnsupportedOperationException
if invoked.Set.add(Object)
Set.addAll(java.util.Collection)
-
entrySet
Description copied from interface:Cache
Returns 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 configuredCacheLoader
and remote entries. The former 2 methods especially have a very high likely hood of causing aOutOfMemoryError
due to storing all the keys in the entire cluster in the array. Use involving execution of this method on a production system is not recommended as they can be quite expensive operations *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_LOAD
flag should be used to avoid hitting the cache store as this will cause all entries there to be read in (albeit in a batched form to preventOutOfMemoryError
) Also if you want the local contents only you can use theFlag.CACHE_MODE_LOCAL
flag so that other remote nodes are not queried for data. However the loader will still be used unless the previously mentionedFlag.SKIP_CACHE_LOAD
is 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 theCloseableIteratorSet
interface which creates aCloseableIterator
instead of a regular one. This means this iterator must be explicitly closed either through try with resource or calling the close method directly. Technically this iterator will also close itself if you iterate fully over it, but it is safest to always make sure you close it explicitly. -
values
Description copied from interface:Cache
Returns 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 configuredCacheLoader
and remote entries. The former 2 methods especially have a very high likely hood of causing aOutOfMemoryError
due to storing all the keys in the entire cluster in the array. Use involving execution of this method on a production system is not recommended as they can be quite expensive operations *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_LOAD
flag should be used to avoid hitting the cache store as this will cause all entries there to be read in (albeit in a batched form to preventOutOfMemoryError
) Also if you want the local contents only you can use theFlag.CACHE_MODE_LOCAL
flag so that other remote nodes are not queried for data. However the loader will still be used unless the previously mentionedFlag.SKIP_CACHE_LOAD
is also configured.Iterator Use
This class implements the
CloseableIteratorCollection
interface which creates aCloseableIterator
instead of a regular one. This means this iterator must be explicitly closed either through try with resource or calling the close method directly. Technically this iterator will also close itself if you iterate fully over it, but it is safest to always make sure you close it explicitly.The iterator retrieved using
CloseableIteratorCollection.iterator()
supports the remove method, however the iterator retrieved 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 throwUnsupportedOperationException
if invoked.Set.add(Object)
Set.addAll(java.util.Collection)
-
getAsync
Description copied from interface:AsyncCache
Asynchronous version ofMap.get(Object)
that allows user code to retrieve the value associated with a key at a later stage, hence allowing multiple parallel get requests to be sent. Normally, when this method detects that the value is likely to be retrieved from from a remote entity, it will span a different thread in order to allow the asynchronous get call to return immediately. If the call will definitely resolve locally, for example when the cache is configured with LOCAL mode and no stores are configured, the get asynchronous call will act sequentially and will have no different toMap.get(Object)
.- Specified by:
getAsync
in interfaceAsyncCache<K,
V> - Overrides:
getAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
key
- key to retrieve- Returns:
- a future that can be used to retrieve value associated with the
key when this is available. The actual value returned by the future
follows the same rules as
Map.get(Object)
-
addListener
Description copied from interface:Listenable
Adds a listener to the component. Typically, listeners would need to be annotated withListener
and further to that, contain methods annotated appropriately, otherwise the listener will not be registered. See theListener
annotation for more information.- Specified by:
addListener
in interfaceListenable
- Overrides:
addListener
in classAbstractDelegatingCache<K,
V> - Parameters:
listener
- listener to add, must not be null
-
addListenerAsync
Description copied from interface:Listenable
Asynchronous version ofListenable.addListener(Object)
- Specified by:
addListenerAsync
in interfaceListenable
- Overrides:
addListenerAsync
in classAbstractDelegatingCache<K,
V> - Parameters:
listener
- listener to add, must not be null- Returns:
- CompletionStage that when complete the listener is fully installed
-
addListener
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter) Description copied from interface:FilteringListenable
Registers 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
CacheEventFilterConverter
is 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:
addListener
in interfaceFilteringListenable<K,
V> - Overrides:
addListener
in 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:FilteringListenable
Asynchronous version ofFilteringListenable.addListener(Object, CacheEventFilter, CacheEventConverter)
- Specified by:
addListenerAsync
in interfaceFilteringListenable<K,
V> - Overrides:
addListenerAsync
in 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:FilteringListenable
Registers 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 forCacheEntryCreated
andCacheEntryModified
, and filtered annotations contains onlyCacheEntryCreated
, then the listener will be registered only forCacheEntryCreated
callbacks. Callback filtering only applies toCacheEntryCreated
,CacheEntryModified
,CacheEntryRemoved
andCacheEntryExpired
annotations. 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:
addFilteredListener
in interfaceFilteringListenable<K,
V> - Overrides:
addFilteredListener
in 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:FilteringListenable
Asynchronous version ofFilteringListenable.addFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
- Specified by:
addFilteredListenerAsync
in interfaceFilteringListenable<K,
V> - Overrides:
addFilteredListenerAsync
in 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:FilteringListenable
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.- Specified by:
addStorageFormatFilteredListener
in interfaceFilteringListenable<K,
V> - Overrides:
addStorageFormatFilteredListener
in 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:FilteringListenable
Asynchronous version ofFilteringListenable.addStorageFormatFilteredListener(Object, CacheEventFilter, CacheEventConverter, Set)
- Specified by:
addStorageFormatFilteredListenerAsync
in interfaceFilteringListenable<K,
V> - Overrides:
addStorageFormatFilteredListenerAsync
in classAbstractDelegatingCache<K,
V>
-
removeAsyncEntry
Description copied from interface:AdvancedCache
An extension ofAsyncCache.removeAsync(Object)
, which returns aCacheEntry
instead of only the value.- Specified by:
removeAsyncEntry
in interfaceAdvancedCache<K,
V> - Overrides:
removeAsyncEntry
in classAbstractDelegatingAdvancedCache<K,
V> - Parameters:
key
- key to remove- Returns:
- a future containing the
CacheEntry
removed ornull
if not found. - See Also:
-
touch
Description copied from interface:AdvancedCache
Touches 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
touchEvenIfExpired
argument 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:
touch
in interfaceAdvancedCache<K,
V> - Overrides:
touch
in 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
-
touch
Description copied from interface:AdvancedCache
The same asAdvancedCache.touch(Object, boolean)
except that the segment is already known. This can be helpful to reduce an extra segment computation- Specified by:
touch
in interfaceAdvancedCache<K,
V> - Overrides:
touch
in 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
-