Class RemoteCacheSupport<K,V>
- All Implemented Interfaces:
ConcurrentMap<K,,V> Map<K,,V> RemoteCache<K,,V> org.infinispan.commons.api.AsyncCache<K,,V> org.infinispan.commons.api.BasicCache<K,,V> org.infinispan.commons.api.Lifecycle,org.infinispan.commons.api.TransactionalCache
- Direct Known Subclasses:
DelegatingRemoteCache,RemoteCacheImpl
- Since:
- 4.1
- Author:
- Mircea.Markus@jboss.com
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected long -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedRemoteCacheSupport(long defaultLifespan, long defaultMaxIdleTime) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclear()final Vfinal Vcompute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) final Vcompute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) final CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) final CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) abstract CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) final VcomputeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) final VcomputeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) final VcomputeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) final CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction) final CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit) abstract CompletableFuture<V> computeIfAbsentAsync(K key, Function<? super K, ? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) final VcomputeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) final VcomputeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) final VcomputeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) final CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) final CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) abstract CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) final booleancontainsKey(Object key) abstract CompletableFuture<Boolean> containsKeyAsync(K key) final VRetrieves all of the entries for the provided keys.abstract CompletableFuture<Map<K, V>> getAllAsync(Set<?> keys) abstract CompletableFuture<V> final MetadataValue<V> getWithMetadata(K key) Returns theMetadataValueassociated to the supplied key param, or null if it doesn't exist.abstract CompletableFuture<MetadataValue<V>> getWithMetadataAsync(K key) Asynchronously returns theMetadataValueassociated to the supplied key param, or null if it doesn't exist.final Vfinal Vmerge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) final Vmerge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) final CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) final CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) abstract CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) final Vfinal Vfinal Vput(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) final voidAdds or overrides each specified entry in the remote cache.final voidAdds or overrides each specified entry in the remote cache.final voidputAll(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> final CompletableFuture<V> abstract CompletableFuture<V> final VputIfAbsent(K key, V value) final VputIfAbsent(K key, V value, long lifespan, TimeUnit unit) final VputIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) final CompletableFuture<V> putIfAbsentAsync(K key, V value) final CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit) abstract CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) final Vfinal booleanabstract CompletableFuture<V> removeAsync(Object key) abstract CompletableFuture<Boolean> removeAsync(Object key, Object value) final booleanremoveWithVersion(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 Vfinal Vfinal Vreplace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) final booleanfinal booleanfinal booleanreplace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) abstract voidreplaceAll(BiFunction<? super K, ? super V, ? extends V> function) final CompletableFuture<V> replaceAsync(K key, V value) final CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit unit) abstract CompletableFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) final CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue) final CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit) abstract CompletableFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) final booleanreplaceWithVersion(K key, V newValue, long version) Replaces the given value only if its version matches the supplied version.final booleanreplaceWithVersion(K key, V newValue, long version, int lifespanSeconds) A overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)which takes in lifespan parameters.final booleanreplaceWithVersion(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 booleanreplaceWithVersion(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 intsize()abstract CompletableFuture<Long> Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.commons.api.AsyncCache
clearAsyncMethods inherited from interface org.infinispan.commons.api.BasicCache
continuousQuery, getName, getVersion, queryMethods inherited from interface java.util.concurrent.ConcurrentMap
forEach, getOrDefaultMethods inherited from interface org.infinispan.commons.api.Lifecycle
start, stopMethods inherited from interface java.util.Map
containsValue, equals, hashCode, isEmptyMethods inherited from interface org.infinispan.client.hotrod.RemoteCache
addClientListener, addClientListener, clientStatistics, entrySet, entrySet, execute, execute, execute, getCacheTopologyInfo, getDataFormat, getProtocolVersion, getRemoteCacheContainer, getRemoteCacheManager, isTransactional, keySet, keySet, publishEntries, publishEntriesByQuery, publishEntriesWithMetadata, removeClientListener, replaceWithVersionAsync, retrieveEntries, retrieveEntries, retrieveEntries, retrieveEntriesByQuery, retrieveEntriesWithMetadata, serverStatistics, serverStatisticsAsync, streaming, values, values, withDataFormat, withFlagsMethods 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:RemoteCacheAdds 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:RemoteCacheAdds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry. -
putAll
public final void putAll(Map<? extends K, ? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:RemoteCacheAdds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry. -
putAllAsync
Description copied from interface:RemoteCacheAdds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAllAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Specified by:
putAllAsyncin interfaceRemoteCache<K,V> - See Also:
-
putAllAsync
public final CompletableFuture<Void> putAllAsync(Map<? extends K, ? extends V> data, long lifespan, TimeUnit unit) Description copied from interface:RemoteCacheAdds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAllAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Specified by:
putAllAsyncin interfaceRemoteCache<K,V> - 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:RemoteCacheAdds or overrides each specified entry in the remote cache. This operation provides better performance than calling put() for each entry.- Specified by:
putAllAsyncin interfaceorg.infinispan.commons.api.AsyncCache<K,V> - Specified by:
putAllAsyncin interfaceRemoteCache<K,V> - See Also:
-
putIfAbsent
- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
putIfAbsentin interfaceMap<K,V>
-
putIfAbsent
-
putIfAbsent
-
putIfAbsentAsync
-
putIfAbsentAsync
public final CompletableFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit) -
putIfAbsentAsync
-
replace
Description copied from interface:RemoteCacheThis 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:RemoteCacheThis 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). -
replace
public final boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit) Description copied from interface:RemoteCacheThis 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. -
replaceAsync
-
replaceAsync
-
replaceAsync
-
replace
-
replace
-
replace
-
replaceAsync
-
replaceAsync
-
replaceAsync
-
get
-
getAsync
-
getAll
Description copied from interface:RemoteCacheRetrieves 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:
getAllin interfaceRemoteCache<K,V> - Parameters:
keys- The keys to find values for- Returns:
- The entries that were present for the given keys
-
getAllAsync
-
getWithMetadata
Description copied from interface:RemoteCacheReturns theMetadataValueassociated to the supplied key param, or null if it doesn't exist.- Specified by:
getWithMetadatain interfaceRemoteCache<K,V>
-
getWithMetadataAsync
Description copied from interface:RemoteCacheAsynchronously returns theMetadataValueassociated to the supplied key param, or null if it doesn't exist.- Specified by:
getWithMetadataAsyncin interfaceRemoteCache<K,V>
-
containsKey
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsKeyAsync
-
put
-
put
-
put
-
putAsync
-
putAsync
-
putAsync
-
replaceWithVersion
Description copied from interface:RemoteCacheReplaces 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:
replaceWithVersionin interfaceRemoteCache<K,V> - Parameters:
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:RemoteCacheA overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)which takes in lifespan parameters.- Specified by:
replaceWithVersionin 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:RemoteCacheA overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)which takes in lifespan and maximum idle time parameters.- Specified by:
replaceWithVersionin 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:RemoteCacheA overloaded form ofRemoteCache.replaceWithVersion(Object, Object, long)which takes in lifespan and maximum idle time parameters.- Specified by:
replaceWithVersionin 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-TimeUnitfor lifespanmaxIdle- the maximum amount of time this key is allowed to be idle for before it is considered as expiredmaxIdleTimeUnit-TimeUnitfor maxIdle- Returns:
- true if the value was replaced
-
replaceWithVersionAsync
- Specified by:
replaceWithVersionAsyncin interfaceRemoteCache<K,V> - See Also:
-
replaceWithVersionAsync
public final CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds) - Specified by:
replaceWithVersionAsyncin interfaceRemoteCache<K,V> - See Also:
-
replaceWithVersionAsync
public final CompletableFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds, int maxIdleSeconds) - Specified by:
replaceWithVersionAsyncin interfaceRemoteCache<K,V> - See Also:
-
remove
Description copied from interface:RemoteCacheThe returned value is only sent back if
Flag.FORCE_RETURN_VALUEis enabled. -
removeAsync
-
remove
Description copied from interface:RemoteCacheThis 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
-
removeWithVersion
Description copied from interface:RemoteCacheRemoves 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:
removeWithVersionin interfaceRemoteCache<K,V> - Returns:
- true if the entry has been removed
- See Also:
-
removeWithVersionAsync
- Specified by:
removeWithVersionAsyncin interfaceRemoteCache<K,V> - See Also:
-
merge
-
merge
-
merge
-
mergeAsync
public final CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) -
mergeAsync
public final CompletableFuture<V> mergeAsync(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) -
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) -
clear
public final void clear() -
compute
-
compute
-
compute
-
computeAsync
public final CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) -
computeAsync
public final CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) -
computeAsync
public abstract CompletableFuture<V> computeAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) -
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceConcurrentMap<K,V> - Specified by:
computeIfAbsentin interfaceMap<K,V>
-
computeIfAbsent
-
computeIfAbsent
-
computeIfAbsentAsync
-
computeIfAbsentAsync
-
computeIfAbsentAsync
-
computeIfPresent
public final V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) - Specified by:
computeIfPresentin interfaceConcurrentMap<K,V> - Specified by:
computeIfPresentin interfaceMap<K,V>
-
computeIfPresent
-
computeIfPresent
-
computeIfPresentAsync
public final CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) -
computeIfPresentAsync
public final CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit) -
computeIfPresentAsync
public abstract CompletableFuture<V> computeIfPresentAsync(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit) -
replaceAll
- Specified by:
replaceAllin interfaceConcurrentMap<K,V> - Specified by:
replaceAllin interfaceMap<K,V>
-
size
public final int size() -
sizeAsync
-