public abstract class RemoteCacheSupport<K,V> extends Object implements RemoteCache<K,V>
Modifier and Type | Field and Description |
---|---|
protected long |
defaultLifespan |
protected long |
defaultMaxIdleTime |
Modifier | Constructor and Description |
---|---|
protected |
RemoteCacheSupport() |
protected |
RemoteCacheSupport(long defaultLifespan,
long defaultMaxIdleTime) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.compute(Object, BiFunction) which takes in lifespan parameters. |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.compute(Object, BiFunction) which takes in lifespan and maxIdleTime parameters. |
CompletableFuture<V> |
computeAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction)
Asynchronous version of
ConcurrentMap.compute(Object, BiFunction) . |
CompletableFuture<V> |
computeAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.compute(Object, BiFunction, long, TimeUnit) . |
abstract CompletableFuture<V> |
computeAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.compute(Object, BiFunction, long, TimeUnit, long, TimeUnit) . |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction) |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan parameters. |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan and maxIdleTime parameters. |
CompletableFuture<V> |
computeIfAbsentAsync(K key,
Function<? super K,? extends V> mappingFunction)
Asynchronous version of
ConcurrentMap.computeIfAbsent(Object, Function) . |
CompletableFuture<V> |
computeIfAbsentAsync(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.computeIfAbsent(Object, Function, long, TimeUnit) . |
abstract CompletableFuture<V> |
computeIfAbsentAsync(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit) . |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction) |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan parameters. |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan and maxIdleTime parameters. |
CompletableFuture<V> |
computeIfPresentAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction)
Asynchronous version of
ConcurrentMap.computeIfPresent(Object, BiFunction) . |
CompletableFuture<V> |
computeIfPresentAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit) . |
abstract CompletableFuture<V> |
computeIfPresentAsync(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit) . |
boolean |
containsKey(Object key) |
abstract CompletableFuture<Boolean> |
containsKeyAsync(K key)
Asynchronous version of
Map.containsKey(Object) |
V |
get(Object key) |
Map<K,V> |
getAll(Set<? extends K> keys)
Retrieves all of the entries for the provided keys.
|
abstract CompletableFuture<Map<K,V>> |
getAllAsync(Set<?> keys)
TODO This should be in AdvancedCache with getAll
|
abstract CompletableFuture<V> |
getAsync(K key)
Asynchronous version of
Map.get(Object) that allows user code to
retrieve the value associated with a key at a later stage, hence allowing
multiple parallel get requests to be sent. |
MetadataValue<V> |
getWithMetadata(K key)
Returns the
MetadataValue associated to the supplied key param, or null if it doesn't exist. |
abstract CompletableFuture<MetadataValue<V>> |
getWithMetadataAsync(K key)
Asynchronously returns the
MetadataValue associated to the supplied key param, or null if it doesn't exist. |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction) |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters. |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters. |
CompletableFuture<V> |
mergeAsync(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction)
Asynchronous version of
ConcurrentMap.merge(Object, Object, BiFunction) . |
CompletableFuture<V> |
mergeAsync(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.merge(Object, Object, BiFunction, long, TimeUnit) . |
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 of
BasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit) . |
V |
put(K key,
V value)
If the return value of this operation will be ignored by the application,
the user is strongly encouraged to use the
Flag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently
as possible (i.e. |
V |
put(K key,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
BasicCache.put(Object, Object) , which takes in lifespan parameters. |
V |
put(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
BasicCache.put(Object, Object) , which takes in lifespan parameters. |
void |
putAll(Map<? extends K,? extends V> map)
Adds or overrides each specified entry in the remote cache.
|
void |
putAll(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit unit)
Adds or overrides each specified entry in the remote cache.
|
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.
|
CompletableFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data)
Adds or overrides each specified entry in the remote cache.
|
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.
|
CompletableFuture<V> |
putAsync(K key,
V value)
Asynchronous version of
BasicCache.put(Object, Object) . |
CompletableFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of
BasicCache.put(Object, Object, long, TimeUnit) . |
abstract CompletableFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit) . |
V |
putIfAbsent(K key,
V value) |
V |
putIfAbsent(K key,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
ConcurrentMap.putIfAbsent(Object, Object) , which takes in lifespan parameters. |
V |
putIfAbsent(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.putIfAbsent(Object, Object) , which takes in lifespan parameters. |
CompletableFuture<V> |
putIfAbsentAsync(K key,
V value)
Asynchronous version of
ConcurrentMap.putIfAbsent(Object, Object) . |
CompletableFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
BasicCache.putIfAbsent(Object, Object, long, TimeUnit) . |
abstract CompletableFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit) . |
V |
remove(Object key)
If the return value of this operation will be ignored by the application,
the user is strongly encouraged to use the
Flag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently
as possible (i.e. |
boolean |
remove(Object key,
Object value) |
abstract CompletableFuture<V> |
removeAsync(Object key)
Asynchronous version of
BasicCache.remove(Object) . |
abstract CompletableFuture<Boolean> |
removeAsync(Object key,
Object value)
Asynchronous version of
ConcurrentMap.remove(Object, Object) . |
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) |
V |
replace(K key,
V value) |
V |
replace(K key,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
ConcurrentMap.replace(Object, Object) , which takes in lifespan parameters. |
V |
replace(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.replace(Object, Object) , which takes in lifespan parameters. |
boolean |
replace(K key,
V oldValue,
V newValue) |
boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of
ConcurrentMap.replace(Object, Object, Object) , which takes in lifespan parameters. |
boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.replace(Object, Object, Object) , which takes in lifespan parameters. |
abstract void |
replaceAll(BiFunction<? super K,? super V,? extends V> function) |
CompletableFuture<V> |
replaceAsync(K key,
V value)
Asynchronous version of
ConcurrentMap.replace(Object, Object) . |
CompletableFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of
BasicCache.replace(Object, Object, long, TimeUnit) . |
abstract CompletableFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit) . |
CompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Asynchronous version of
ConcurrentMap.replace(Object, Object, Object) . |
CompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit unit)
Asynchronous version of
BasicCache.replace(Object, Object, Object, long, TimeUnit) . |
abstract CompletableFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
BasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit) . |
boolean |
replaceWithVersion(K key,
V newValue,
long version)
Replaces the given value only if its version matches the supplied version.
|
boolean |
replaceWithVersion(K key,
V newValue,
long version,
int lifespanSeconds)
A overloaded form of
RemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan parameters. |
boolean |
replaceWithVersion(K key,
V newValue,
long version,
int lifespanSeconds,
int maxIdleTimeSeconds)
A overloaded form of
RemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan and maximum idle time parameters. |
boolean |
replaceWithVersion(K key,
V newValue,
long version,
long lifespan,
TimeUnit lifespanTimeUnit,
long maxIdle,
TimeUnit maxIdleTimeUnit)
A overloaded form of
RemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan and maximum idle time parameters. |
CompletableFuture<Boolean> |
replaceWithVersionAsync(K key,
V newValue,
long version) |
CompletableFuture<Boolean> |
replaceWithVersionAsync(K key,
V newValue,
long version,
int lifespanSeconds) |
CompletableFuture<Boolean> |
replaceWithVersionAsync(K key,
V newValue,
long version,
int lifespanSeconds,
int maxIdleSeconds) |
int |
size() |
abstract CompletableFuture<Long> |
sizeAsync()
Asynchronous version of
Map.size() . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addClientListener, addClientListener, clientStatistics, entrySet, entrySet, execute, execute, getCacheTopologyInfo, getDataFormat, getListeners, getProtocolVersion, getRemoteCacheManager, isTransactional, keySet, keySet, publishEntries, publishEntriesByQuery, publishEntriesWithMetadata, removeClientListener, replaceWithVersionAsync, retrieveEntries, retrieveEntries, retrieveEntries, retrieveEntriesByQuery, retrieveEntriesWithMetadata, serverStatistics, stats, streaming, values, values, withDataFormat, withFlags
getName, getVersion
clearAsync
forEach, getOrDefault
containsValue, equals, hashCode, isEmpty
getTransactionManager
protected long defaultLifespan
protected long defaultMaxIdleTime
protected RemoteCacheSupport()
protected RemoteCacheSupport(long defaultLifespan, long defaultMaxIdleTime)
public final void putAll(Map<? extends K,? extends V> map)
RemoteCache
putAll
in interface Map<K,V>
putAll
in interface RemoteCache<K,V>
RemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
public final void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit)
RemoteCache
putAll
in interface RemoteCache<K,V>
putAll
in interface BasicCache<K,V>
map
- map containing mappings to enterlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanpublic final void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
RemoteCache
putAll
in interface RemoteCache<K,V>
putAll
in interface BasicCache<K,V>
map
- map containing mappings to enterlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timeRemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
public final CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> data)
RemoteCache
putAllAsync
in interface RemoteCache<K,V>
putAllAsync
in interface AsyncCache<K,V>
data
- to storeRemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
public final CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit unit)
RemoteCache
putAllAsync
in interface RemoteCache<K,V>
putAllAsync
in interface AsyncCache<K,V>
data
- to storelifespan
- lifespan of entryunit
- time unit for lifespanRemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
public abstract CompletableFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
RemoteCache
putAllAsync
in interface RemoteCache<K,V>
putAllAsync
in interface AsyncCache<K,V>
data
- to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timeRemoteCache.putAll(java.util.Map, long, java.util.concurrent.TimeUnit)
public final V putIfAbsent(K key, V value)
putIfAbsent
in interface ConcurrentMap<K,V>
putIfAbsent
in interface Map<K,V>
public final V putIfAbsent(K key, V value, long lifespan, TimeUnit unit)
BasicCache
ConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.putIfAbsent
in interface BasicCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanpublic final V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
ConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.putIfAbsent
in interface BasicCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic final CompletableFuture<V> putIfAbsentAsync(K key, V value)
AsyncCache
ConcurrentMap.putIfAbsent(Object, Object)
. This method does not block on remote calls, even if
your cache mode is synchronous.putIfAbsentAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storepublic final CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit)
AsyncCache
BasicCache.putIfAbsent(Object, Object, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous.putIfAbsentAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanpublic abstract CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCache
BasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does
not block on remote calls, even if your cache mode is synchronous.putIfAbsentAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timepublic final boolean replace(K key, V oldValue, V newValue)
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)
and
RemoteCache.replaceWithVersion(Object, Object, long)
.
public final boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit unit)
RemoteCache
ConcurrentMap.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)
and
RemoteCache.replaceWithVersion(Object, Object, long, long, TimeUnit, long, TimeUnit)
.
replace
in interface RemoteCache<K,V>
replace
in interface BasicCache<K,V>
key
- key to useoldValue
- value to replacevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanpublic final boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
RemoteCache
ConcurrentMap.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)
and
RemoteCache.replaceWithVersion(Object, Object, long, long, TimeUnit, long, TimeUnit)
if possible.
replace
in interface RemoteCache<K,V>
replace
in interface BasicCache<K,V>
key
- key to useoldValue
- value to replacevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic final CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
AsyncCache
ConcurrentMap.replace(Object, Object, Object)
. This method does not block on remote calls,
even if your cache mode is synchronous.replaceAsync
in interface AsyncCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storepublic final CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit)
AsyncCache
BasicCache.replace(Object, Object, Object, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous.replaceAsync
in interface AsyncCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic abstract CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCache
BasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
. This method
does not block on remote calls, even if your cache mode is synchronous.replaceAsync
in interface AsyncCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timepublic final V replace(K key, V value, long lifespan, TimeUnit unit)
BasicCache
ConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.replace
in interface BasicCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanpublic final V replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
ConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.replace
in interface BasicCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic final CompletableFuture<V> replaceAsync(K key, V value)
AsyncCache
ConcurrentMap.replace(Object, Object)
. This method does not block on remote calls, even if
your cache mode is synchronous.replaceAsync
in interface AsyncCache<K,V>
key
- key to removevalue
- value to storepublic final CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit unit)
AsyncCache
BasicCache.replace(Object, Object, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous.replaceAsync
in interface AsyncCache<K,V>
key
- key to removevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic abstract CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCache
BasicCache.replace(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not
block on remote calls, even if your cache mode is synchronous.replaceAsync
in interface AsyncCache<K,V>
key
- key to removevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timepublic abstract CompletableFuture<V> getAsync(K key)
AsyncCache
Map.get(Object)
that allows user code to
retrieve the value associated with a key at a later stage, hence allowing
multiple parallel get requests to be sent. Normally, when this method
detects that the value is likely to be retrieved from from a remote
entity, it will span a different thread in order to allow the
asynchronous get call to return immediately. If the call will definitely
resolve locally, for example when the cache is configured with LOCAL mode
and no stores are configured, the get asynchronous call will act
sequentially and will have no different to Map.get(Object)
.getAsync
in interface AsyncCache<K,V>
key
- key to retrieveMap.get(Object)
public final Map<K,V> getAll(Set<? extends K> keys)
RemoteCache
getAll
in interface RemoteCache<K,V>
keys
- The keys to find values forpublic abstract CompletableFuture<Map<K,V>> getAllAsync(Set<?> keys)
AsyncCache
getAllAsync
in interface AsyncCache<K,V>
public final MetadataValue<V> getWithMetadata(K key)
RemoteCache
MetadataValue
associated to the supplied key param, or null if it doesn't exist.getWithMetadata
in interface RemoteCache<K,V>
public abstract CompletableFuture<MetadataValue<V>> getWithMetadataAsync(K key)
RemoteCache
MetadataValue
associated to the supplied key param, or null if it doesn't exist.getWithMetadataAsync
in interface RemoteCache<K,V>
public final boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public abstract CompletableFuture<Boolean> containsKeyAsync(K key)
AsyncCache
Map.containsKey(Object)
containsKeyAsync
in interface AsyncCache<K,V>
key
- key to retrievepublic final V put(K key, V value)
BasicCache
Flag.IGNORE_RETURN_VALUES
flag when invoking this method in order to make it behave as efficiently
as possible (i.e. avoiding needless remote or network calls).public final V put(K key, V value, long lifespan, TimeUnit unit)
BasicCache
BasicCache.put(Object, Object)
, which takes in lifespan parameters.put
in interface BasicCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanpublic final V put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
BasicCache.put(Object, Object)
, which takes in lifespan parameters.put
in interface BasicCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic final CompletableFuture<V> putAsync(K key, V value)
AsyncCache
BasicCache.put(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous.putAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storepublic final CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit unit)
AsyncCache
BasicCache.put(Object, Object, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous.putAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic abstract CompletableFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCache
BasicCache.put(Object, Object, long, TimeUnit, long, TimeUnit)
. This method does not block
on remote calls, even if your cache mode is synchronous.putAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanmaxIdle
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleUnit
- time unit for max idle timepublic final boolean replaceWithVersion(K key, V newValue, long version)
RemoteCache
RemoteCache.removeWithVersion(Object, long)
for a sample usage of the
version-based methods.replaceWithVersion
in interface RemoteCache<K,V>
version
- numeric version that should match the one in the server
for the operation to succeedRemoteCache.getWithMetadata(Object)
,
VersionedValue
public final boolean replaceWithVersion(K key, V newValue, long version, int lifespanSeconds)
RemoteCache
RemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan parameters.replaceWithVersion
in interface RemoteCache<K,V>
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 entrypublic final boolean replaceWithVersion(K key, V newValue, long version, int lifespanSeconds, int maxIdleTimeSeconds)
RemoteCache
RemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan and maximum idle time parameters.replaceWithVersion
in interface RemoteCache<K,V>
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 expiredpublic final boolean replaceWithVersion(K key, V newValue, long version, long lifespan, TimeUnit lifespanTimeUnit, long maxIdle, TimeUnit maxIdleTimeUnit)
RemoteCache
RemoteCache.replaceWithVersion(Object, Object, long)
which takes in lifespan and maximum idle time parameters.replaceWithVersion
in interface RemoteCache<K,V>
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 maxIdlepublic final CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version)
replaceWithVersionAsync
in interface RemoteCache<K,V>
RemoteCache.replaceWithVersion(Object, Object, long)
public final CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds)
replaceWithVersionAsync
in interface RemoteCache<K,V>
RemoteCache.replaceWithVersion(Object, Object, long)
public final CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds, int maxIdleSeconds)
replaceWithVersionAsync
in interface RemoteCache<K,V>
RemoteCache.replaceWithVersion(Object, Object, long)
public final V remove(Object key)
RemoteCache
Flag.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.
public abstract CompletableFuture<V> removeAsync(Object key)
AsyncCache
BasicCache.remove(Object)
. This method does not block on remote calls, even if your cache
mode is synchronous.removeAsync
in interface AsyncCache<K,V>
key
- key to removepublic final boolean remove(Object key, Object value)
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)
and RemoteCache.removeWithVersion(Object, long)
.
public abstract CompletableFuture<Boolean> removeAsync(Object key, Object value)
AsyncCache
ConcurrentMap.remove(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous.removeAsync
in interface AsyncCache<K,V>
key
- key to removevalue
- value to match onpublic final boolean removeWithVersion(K key, long version)
RemoteCache
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.
removeWithVersion
in interface RemoteCache<K,V>
VersionedValue
,
RemoteCache.getWithMetadata(Object)
public abstract CompletableFuture<Boolean> removeWithVersionAsync(K key, long version)
removeWithVersionAsync
in interface RemoteCache<K,V>
RemoteCache.remove(Object, Object)
public final V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
public final V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
BasicCache
ConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.merge
in interface BasicCache<K,V>
key
- key to usevalue
- new value to merge with existing valueremappingFunction
- function to use to merge new and existing values into a merged value to store under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanpublic final V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
ConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.merge
in interface BasicCache<K,V>
key
- key to usevalue
- new value to merge with existing valueremappingFunction
- function to use to merge new and existing values into a merged value to store under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic final CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)
AsyncCache
ConcurrentMap.merge(Object, Object, BiFunction)
. This method does not block on remote
calls, even if your cache mode is synchronous.mergeAsync
in interface AsyncCache<K,V>
public final CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
AsyncCache
BasicCache.merge(Object, Object, BiFunction, long, TimeUnit)
. This method does not
block on remote calls, even if your cache mode is synchronous.mergeAsync
in interface AsyncCache<K,V>
public abstract CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
AsyncCache
BasicCache.merge(Object, Object, BiFunction, long, TimeUnit, long, TimeUnit)
. This
method does not block on remote calls, even if your cache mode is synchronous.mergeAsync
in interface AsyncCache<K,V>
public final V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
public final V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
BasicCache
ConcurrentMap.compute(Object, BiFunction)
which takes in lifespan parameters.compute
in interface BasicCache<K,V>
key
- key to useremappingFunction
- function to use to compute and store the value under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanpublic final V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
ConcurrentMap.compute(Object, BiFunction)
which takes in lifespan and maxIdleTime parameters.compute
in interface BasicCache<K,V>
key
- key to useremappingFunction
- function to use to compute and store the value under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic final CompletableFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
AsyncCache
ConcurrentMap.compute(Object, BiFunction)
. This method does not block on remote
calls, even if your cache mode is synchronous.computeAsync
in interface AsyncCache<K,V>
public final CompletableFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
AsyncCache
BasicCache.compute(Object, BiFunction, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous.computeAsync
in interface AsyncCache<K,V>
public abstract CompletableFuture<V> computeAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCache
BasicCache.compute(Object, BiFunction, long, TimeUnit, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous.computeAsync
in interface AsyncCache<K,V>
public final V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)
computeIfAbsent
in interface ConcurrentMap<K,V>
computeIfAbsent
in interface Map<K,V>
public final V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit)
BasicCache
ConcurrentMap.computeIfAbsent(Object, Function)
which takes in lifespan parameters.computeIfAbsent
in interface BasicCache<K,V>
key
- key to usemappingFunction
- function to use to compute and store the value under key, if the key is absentlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanpublic final V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
ConcurrentMap.computeIfAbsent(Object, Function)
which takes in lifespan and maxIdleTime parameters.computeIfAbsent
in interface BasicCache<K,V>
key
- key to usemappingFunction
- function to use to compute and store the value under key, if the key is absentlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic final CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction)
AsyncCache
ConcurrentMap.computeIfAbsent(Object, Function)
. This method does not block on remote
calls, even if your cache mode is synchronous.computeIfAbsentAsync
in interface AsyncCache<K,V>
public final CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit)
AsyncCache
BasicCache.computeIfAbsent(Object, Function, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous.computeIfAbsentAsync
in interface AsyncCache<K,V>
public abstract CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCache
BasicCache.computeIfAbsent(Object, Function, long, TimeUnit, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous.computeIfAbsentAsync
in interface AsyncCache<K,V>
public final V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
computeIfPresent
in interface ConcurrentMap<K,V>
computeIfPresent
in interface Map<K,V>
public final V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
BasicCache
ConcurrentMap.computeIfPresent(Object, BiFunction)
which takes in lifespan parameters.computeIfPresent
in interface BasicCache<K,V>
key
- key to useremappingFunction
- function to use to compute and store the value under key, if such existslifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanpublic final V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
ConcurrentMap.computeIfPresent(Object, BiFunction)
which takes in lifespan and maxIdleTime parameters.computeIfPresent
in interface BasicCache<K,V>
key
- key to useremappingFunction
- function to use to compute and store the value under key, if such existslifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanmaxIdleTime
- the maximum amount of time this key is allowed to be idle for before it is considered as
expiredmaxIdleTimeUnit
- time unit for max idle timepublic final CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)
AsyncCache
ConcurrentMap.computeIfPresent(Object, BiFunction)
. This method does not block on
remote calls, even if your cache mode is synchronous.computeIfPresentAsync
in interface AsyncCache<K,V>
public final CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
AsyncCache
BasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous.computeIfPresentAsync
in interface AsyncCache<K,V>
public abstract CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCache
BasicCache.computeIfPresent(Object, BiFunction, long, TimeUnit, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous.computeIfPresentAsync
in interface AsyncCache<K,V>
public abstract void replaceAll(BiFunction<? super K,? super V,? extends V> function)
replaceAll
in interface ConcurrentMap<K,V>
replaceAll
in interface Map<K,V>
public abstract CompletableFuture<Long> sizeAsync()
AsyncCache
Map.size()
. This method does not block on remote calls, even if your cache mode is
synchronous.sizeAsync
in interface AsyncCache<K,V>
Copyright © 2021 JBoss by Red Hat. All rights reserved.