Class RemoteCacheSupport<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,
,V> Map<K,
,V> RemoteCache<K,
,V> AsyncCache<K,
,V> BasicCache<K,
,V> Lifecycle
,TransactionalCache
- Direct Known Subclasses:
DelegatingRemoteCache
,RemoteCacheImpl
- Since:
- 4.1
- Author:
- Mircea.Markus@jboss.com
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
protected long
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
RemoteCacheSupport
(long defaultLifespan, long defaultMaxIdleTime) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
clear()
final V
final V
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.final V
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.final CompletableFuture<V>
computeAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.compute(Object, BiFunction)
.final CompletableFuture<V>
computeAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.compute(Object, BiFunction, long, TimeUnit)
.abstract CompletableFuture<V>
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)
.final V
computeIfAbsent
(K key, Function<? super K, ? extends V> mappingFunction) final V
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.final V
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.final CompletableFuture<V>
computeIfAbsentAsync
(K key, Function<? super K, ? extends V> mappingFunction) Asynchronous version ofConcurrentMap.computeIfAbsent(Object, Function)
.final CompletableFuture<V>
computeIfAbsentAsync
(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.computeIfAbsent(Object, Function, long, TimeUnit)
.abstract CompletableFuture<V>
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)
.final V
computeIfPresent
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) final V
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.final V
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.final CompletableFuture<V>
computeIfPresentAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.computeIfPresent(Object, BiFunction)
.final CompletableFuture<V>
computeIfPresentAsync
(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit)
.abstract CompletableFuture<V>
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)
.final boolean
containsKey
(Object key) abstract CompletableFuture<Boolean>
containsKeyAsync
(K key) Asynchronous version ofMap.containsKey(Object)
final V
Retrieves all of the entries for the provided keys.abstract CompletableFuture<Map<K,
V>> getAllAsync
(Set<?> keys) TODO This should be in AdvancedCache with getAllabstract CompletableFuture<V>
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.final MetadataValue<V>
getWithMetadata
(K key) Returns theMetadataValue
associated to the supplied key param, or null if it doesn't exist.abstract CompletableFuture<MetadataValue<V>>
getWithMetadataAsync
(K key) Asynchronously returns theMetadataValue
associated to the supplied key param, or null if it doesn't exist.final V
final V
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.final V
merge
(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) An overloaded form ofConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.final CompletableFuture<V>
mergeAsync
(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) Asynchronous version ofConcurrentMap.merge(Object, Object, BiFunction)
.final CompletableFuture<V>
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)
.abstract CompletableFuture<V>
mergeAsync
(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Asynchronous version ofBasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit)
.final V
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.final V
An overloaded form ofBasicCache.put(Object, Object)
, which takes in lifespan parameters.final V
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.final void
Adds or overrides each specified entry in the remote cache.final void
Adds or overrides each specified entry in the remote cache.final void
putAll
(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Adds or overrides each specified entry in the remote cache.final CompletableFuture<Void>
putAllAsync
(Map<? extends K, ? extends V> data) Adds or overrides each specified entry in the remote cache.final CompletableFuture<Void>
putAllAsync
(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) Adds or overrides each specified entry in the remote cache.abstract CompletableFuture<Void>
putAllAsync
(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Adds or overrides each specified entry in the remote cache.final CompletableFuture<V>
Asynchronous version ofBasicCache.put(Object, Object)
.final CompletableFuture<V>
Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit)
.abstract CompletableFuture<V>
Asynchronous version ofBasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit)
.final V
putIfAbsent
(K key, V value) final V
putIfAbsent
(K key, V value, long lifespan, TimeUnit unit) An overloaded form ofConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.final V
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.final CompletableFuture<V>
putIfAbsentAsync
(K key, V value) Asynchronous version ofConcurrentMap.putIfAbsent(Object, Object)
.final CompletableFuture<V>
putIfAbsentAsync
(K key, V value, long lifespan, TimeUnit lifespanUnit) Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit)
.abstract CompletableFuture<V>
putIfAbsentAsync
(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
.final V
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.final boolean
abstract CompletableFuture<V>
removeAsync
(Object key) Asynchronous version ofBasicCache.remove(Object)
.abstract CompletableFuture<Boolean>
removeAsync
(Object key, Object value) Asynchronous version ofConcurrentMap.remove(Object, Object)
.final boolean
removeWithVersion
(K key, long version) Removes the given entry only if its version matches the supplied version.abstract CompletableFuture<Boolean>
removeWithVersionAsync
(K key, long version) final V
final V
An overloaded form ofConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.final V
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.final boolean
final boolean
An overloaded form ofConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.final 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.abstract void
replaceAll
(BiFunction<? super K, ? super V, ? extends V> function) final CompletableFuture<V>
replaceAsync
(K key, V value) Asynchronous version ofConcurrentMap.replace(Object, Object)
.final CompletableFuture<V>
replaceAsync
(K key, V value, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit)
.abstract CompletableFuture<V>
replaceAsync
(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Asynchronous version ofBasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit)
.final CompletableFuture<Boolean>
replaceAsync
(K key, V oldValue, V newValue) Asynchronous version ofConcurrentMap.replace(Object, Object, Object)
.final CompletableFuture<Boolean>
replaceAsync
(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) Asynchronous version ofBasicCache.replace(Object, Object, Object, long, TimeUnit)
.abstract CompletableFuture<Boolean>
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)
.final boolean
replaceWithVersion
(K key, V newValue, long version) Replaces the given value only if its version matches the supplied version.final boolean
replaceWithVersion
(K key, V newValue, long version, int lifespanSeconds) A overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan parameters.final boolean
replaceWithVersion
(K key, V newValue, long version, int lifespanSeconds, int maxIdleTimeSeconds) A overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan and maximum idle time parameters.final boolean
replaceWithVersion
(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit) A overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan and maximum idle time parameters.final CompletableFuture<Boolean>
replaceWithVersionAsync
(K key, V newValue, long version) final CompletableFuture<Boolean>
replaceWithVersionAsync
(K key, V newValue, long version, int lifespanSeconds) final CompletableFuture<Boolean>
replaceWithVersionAsync
(K key, V newValue, long version, int lifespanSeconds, int maxIdleSeconds) final int
size()
abstract CompletableFuture<Long>
Asynchronous version ofMap.size()
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.infinispan.commons.api.AsyncCache
clearAsync
Methods inherited from interface org.infinispan.commons.api.BasicCache
getName, getVersion
Methods inherited from interface java.util.concurrent.ConcurrentMap
forEach, getOrDefault
Methods inherited from interface java.util.Map
containsValue, equals, hashCode, isEmpty
Methods inherited from interface org.infinispan.client.hotrod.RemoteCache
addClientListener, addClientListener, clientStatistics, entrySet, entrySet, execute, execute, execute, getCacheTopologyInfo, getDataFormat, getListeners, getProtocolVersion, getRemoteCacheContainer, getRemoteCacheManager, isTransactional, keySet, keySet, publishEntries, publishEntriesByQuery, publishEntriesWithMetadata, removeClientListener, replaceWithVersionAsync, retrieveEntries, retrieveEntries, retrieveEntries, retrieveEntriesByQuery, retrieveEntriesWithMetadata, serverStatistics, serverStatisticsAsync, stats, streaming, values, values, withDataFormat, withFlags
Methods inherited from interface org.infinispan.commons.api.TransactionalCache
getTransactionManager
-
Field Details
-
defaultLifespan
protected long defaultLifespan -
defaultMaxIdleTime
protected long defaultMaxIdleTime
-
-
Constructor Details
-
RemoteCacheSupport
protected RemoteCacheSupport() -
RemoteCacheSupport
protected RemoteCacheSupport(long defaultLifespan, long defaultMaxIdleTime)
-
-
Method Details
-
putAll
Description copied from interface:RemoteCache
Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry. -
putAll
Description copied from interface:RemoteCache
Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAll
in interfaceBasicCache<K,
V> - Specified by:
putAll
in interfaceRemoteCache<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
-
putAll
public final void putAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:RemoteCache
Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAll
in interfaceBasicCache<K,
V> - Specified by:
putAll
in interfaceRemoteCache<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- See Also:
-
putAllAsync
Description copied from interface:RemoteCache
Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAllAsync
in interfaceAsyncCache<K,
V> - Specified by:
putAllAsync
in interfaceRemoteCache<K,
V> - Parameters:
data
- to store- Returns:
- a future containing a void return type
- See Also:
-
putAllAsync
public final CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) Description copied from interface:RemoteCache
Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAllAsync
in interfaceAsyncCache<K,
V> - Specified by:
putAllAsync
in interfaceRemoteCache<K,
V> - Parameters:
data
- to storelifespan
- lifespan of entryunit
- time unit for lifespan- Returns:
- a future containing a void return type
- See Also:
-
putAllAsync
public abstract CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) Description copied from interface:RemoteCache
Adds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAllAsync
in interfaceAsyncCache<K,
V> - Specified by:
putAllAsync
in interfaceRemoteCache<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
- See Also:
-
putIfAbsent
- Specified by:
putIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
putIfAbsent
in interfaceMap<K,
V>
-
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> - Parameters:
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespan- Returns:
- the value being replaced, or null if nothing is being replaced.
-
putIfAbsent
public final 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> - 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.
-
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> - Parameters:
key
- key to usevalue
- value to store- Returns:
- a future containing the old value replaced.
-
putIfAbsentAsync
public final CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit) 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> - Parameters:
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespan- Returns:
- a future containing the old value replaced
-
putIfAbsentAsync
public abstract 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> - 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
-
replace
Description copied from interface:RemoteCache
This method requires 2 round trips to the server. The first to retrieve the value and version and a second to replace the key with the version if the value matches. If possible user should use
RemoteCache.getWithMetadata(Object)
andRemoteCache.replaceWithVersion(Object, Object, long)
. -
replace
Description copied from interface:RemoteCache
An overloaded form ofConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.This method requires 2 round trips to the server. The first to retrieve the value and version and a second to replace the key with the version if the value matches. If possible user should use
RemoteCache.getWithMetadata(Object)
andRemoteCache.replaceWithVersion(Object, Object, long, long, TimeUnit, long, TimeUnit)
.- Specified by:
replace
in interfaceBasicCache<K,
V> - Specified by:
replace
in interfaceRemoteCache<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
-
replace
public final boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:RemoteCache
An overloaded form ofConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.This method requires 2 round trips to the server. The first to retrieve the value and version and a second to replace the key with the version if the value matches. If possible user should use
RemoteCache.getWithMetadata(Object)
andRemoteCache.replaceWithVersion(Object, Object, long, long, TimeUnit, long, TimeUnit)
if possible.- Specified by:
replace
in interfaceBasicCache<K,
V> - Specified by:
replace
in interfaceRemoteCache<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
-
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> - 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 final 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> - Parameters:
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan- Returns:
- a future containing a boolean, indicating whether the entry was replaced or not
-
replaceAsync
public abstract 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> - 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
-
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> - 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
public final 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> - 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.
-
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> - 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> - Parameters:
key
- key to removevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan- Returns:
- a future containing the previous value overwritten
-
replaceAsync
public abstract 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> - 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
-
get
-
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> - 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)
-
getAll
Description copied from interface:RemoteCache
Retrieves all of the entries for the provided keys. A key will not be present in the resulting map if the entry was not found in the cache.- Specified by:
getAll
in interfaceRemoteCache<K,
V> - Parameters:
keys
- The keys to find values for- Returns:
- The entries that were present for the given keys
-
getAllAsync
Description copied from interface:AsyncCache
TODO This should be in AdvancedCache with getAll- Specified by:
getAllAsync
in interfaceAsyncCache<K,
V>
-
getWithMetadata
Description copied from interface:RemoteCache
Returns theMetadataValue
associated to the supplied key param, or null if it doesn't exist.- Specified by:
getWithMetadata
in interfaceRemoteCache<K,
V>
-
getWithMetadataAsync
Description copied from interface:RemoteCache
Asynchronously returns theMetadataValue
associated to the supplied key param, or null if it doesn't exist.- Specified by:
getWithMetadataAsync
in interfaceRemoteCache<K,
V>
-
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsKeyAsync
Description copied from interface:AsyncCache
Asynchronous version ofMap.containsKey(Object)
- Specified by:
containsKeyAsync
in interfaceAsyncCache<K,
V> - Parameters:
key
- key to retrieve- Returns:
- future containing true if the mapping exists.
-
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). -
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> - 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.
-
put
public final 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> - 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.
-
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> - 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> - 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 abstract 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> - 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
-
replaceWithVersion
Description copied from interface:RemoteCache
Replaces the given value only if its version matches the supplied version. SeeRemoteCache.removeWithVersion(Object, long)
for a sample usage of the version-based methods.- Specified by:
replaceWithVersion
in interfaceRemoteCache<K,
V> version
- numeric version that should match the one in the server for the operation to succeed- Returns:
- true if the value has been replaced
- See Also:
-
replaceWithVersion
Description copied from interface:RemoteCache
A overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan parameters.- Specified by:
replaceWithVersion
in interfaceRemoteCache<K,
V> - Parameters:
key
- key to usenewValue
- new value to be associated with the keyversion
- numeric version that should match the one in the server for the operation to succeedlifespanSeconds
- lifespan of the entry- Returns:
- true if the value was replaced
-
replaceWithVersion
public final boolean replaceWithVersion(K key, V newValue, long version, int lifespanSeconds, int maxIdleTimeSeconds) Description copied from interface:RemoteCache
A overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan and maximum idle time parameters.- Specified by:
replaceWithVersion
in interfaceRemoteCache<K,
V> - Parameters:
key
- key to usenewValue
- new value to be associated with the keyversion
- numeric version that should match the one in the server for the operation to succeedlifespanSeconds
- lifespan of the entrymaxIdleTimeSeconds
- the maximum amount of time this key is allowed to be idle for before it is considered as expired- Returns:
- true if the value was replaced
-
replaceWithVersion
public final boolean replaceWithVersion(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit) Description copied from interface:RemoteCache
A overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan and maximum idle time parameters.- Specified by:
replaceWithVersion
in interfaceRemoteCache<K,
V> - Parameters:
key
- key to usenewValue
- new value to be associated with the keyversion
- numeric version that should match the one in the server for the operation to succeedlifespan
- lifespan of the entrylifespanTimeUnit
-TimeUnit
for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit
-TimeUnit
for maxIdle- Returns:
- true if the value was replaced
-
replaceWithVersionAsync
- Specified by:
replaceWithVersionAsync
in interfaceRemoteCache<K,
V> - See Also:
-
replaceWithVersionAsync
public final CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds) - Specified by:
replaceWithVersionAsync
in interfaceRemoteCache<K,
V> - See Also:
-
replaceWithVersionAsync
public final CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds, int maxIdleSeconds) - Specified by:
replaceWithVersionAsync
in interfaceRemoteCache<K,
V> - See Also:
-
remove
Description copied from interface:RemoteCache
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).The returned value is only sent back if
Flag.FORCE_RETURN_VALUE
is enabled. -
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> - Parameters:
key
- key to remove- Returns:
- a future containing the value removed
-
remove
Description copied from interface:RemoteCache
This method requires 2 round trips to the server. The first to retrieve the value and version and a second to remove the key with the version if the value matches. If possible user should use
RemoteCache.getWithMetadata(Object)
andRemoteCache.removeWithVersion(Object, long)
. -
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> - Parameters:
key
- key to removevalue
- value to match on- Returns:
- a future containing a boolean, indicating whether the entry was removed or not
-
removeWithVersion
Description copied from interface:RemoteCache
Removes the given entry only if its version matches the supplied version. A typical use case looks like this:VersionedEntry ve = remoteCache.getVersioned(key); //some processing remoteCache.removeWithVersion(key, ve.getVersion();
Lat call (removeWithVersion) will make sure that the entry will only be removed if it hasn't been changed in between.- Specified by:
removeWithVersion
in interfaceRemoteCache<K,
V> - Returns:
- true if the entry has been removed
- See Also:
-
removeWithVersionAsync
- Specified by:
removeWithVersionAsync
in interfaceRemoteCache<K,
V> - See Also:
-
merge
-
merge
public final 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> - 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 final 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> - 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
-
mergeAsync
public final 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>
-
mergeAsync
public final 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>
-
mergeAsync
public abstract 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>
-
clear
public final void clear() -
compute
-
compute
public final 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> - 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 final 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> - 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
-
computeAsync
public final 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>
-
computeAsync
public final 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>
-
computeAsync
public abstract 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>
-
computeIfAbsent
- Specified by:
computeIfAbsent
in interfaceConcurrentMap<K,
V> - Specified by:
computeIfAbsent
in interfaceMap<K,
V>
-
computeIfAbsent
public final 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> - 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 final 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> - 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
-
computeIfAbsentAsync
public final 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>
-
computeIfAbsentAsync
public final 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>
-
computeIfAbsentAsync
public abstract 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>
-
computeIfPresent
public final V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) - Specified by:
computeIfPresent
in interfaceConcurrentMap<K,
V> - Specified by:
computeIfPresent
in interfaceMap<K,
V>
-
computeIfPresent
public final 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> - 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 final 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> - 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
-
computeIfPresentAsync
public final 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>
-
computeIfPresentAsync
public final 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>
-
computeIfPresentAsync
public abstract 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>
-
replaceAll
- Specified by:
replaceAll
in interfaceConcurrentMap<K,
V> - Specified by:
replaceAll
in interfaceMap<K,
V>
-
size
public final int size() -
sizeAsync
Description copied from interface:AsyncCache
Asynchronous version ofMap.size()
. This method does not block on remote calls, even if your cache mode is synchronous.- Specified by:
sizeAsync
in interfaceAsyncCache<K,
V> - Returns:
- a future containing the count of the cache
-