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 |
---|---|
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
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. |
void |
putAll(Map<? extends K,? extends V> map)
Synthetic operation.
|
void |
putAll(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit unit)
Synthetic operation.
|
NotifyingFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data)
Synthetic operation.
|
NotifyingFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data,
long lifespan,
TimeUnit unit)
Synthetic operation.
|
NotifyingFuture<V> |
putAsync(K key,
V value)
Asynchronous version of
#put(Object, Object) . |
NotifyingFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of
#put(Object, Object, 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. |
NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value)
Asynchronous version of
#putIfAbsent(Object, Object) . |
NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit lifespanUnit)
Asynchronous version of
#putIfAbsent(Object, Object, long, TimeUnit) . |
boolean |
remove(Object key,
Object value) |
NotifyingFuture<Boolean> |
removeAsync(Object key,
Object value)
Asynchronous version of
#remove(Object, Object) . |
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. |
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. |
NotifyingFuture<V> |
replaceAsync(K key,
V value)
Asynchronous version of
#replace(Object, Object) . |
NotifyingFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of
#replace(Object, Object, long, TimeUnit) . |
NotifyingFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Asynchronous version of
#replace(Object, Object, Object) . |
NotifyingFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit unit)
Asynchronous version of
#replace(Object, Object, Object, long, TimeUnit) . |
NotifyingFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of
#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. |
NotifyingFuture<Boolean> |
replaceWithVersionAsync(K key,
V newValue,
long version) |
NotifyingFuture<Boolean> |
replaceWithVersionAsync(K key,
V newValue,
long version,
int lifespanSeconds) |
protected abstract void |
set(K key,
V value)
This is intentionally a non-public method meant as an integration point for bytecode manipulation.
|
Collection<V> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBulk, getBulk, getProtocolVersion, getRemoteCacheManager, getVersioned, getWithMetadata, isEmpty, keySet, putAll, putAllAsync, removeWithVersion, removeWithVersionAsync, replaceWithVersion, replaceWithVersionAsync, size, stats, withFlags
getName, getVersion, put, putIfAbsent, remove, replace
clearAsync, getAsync, putAsync, putIfAbsentAsync, removeAsync, replaceAsync
protected long defaultLifespan
protected long defaultMaxIdleTime
protected RemoteCacheSupport()
protected RemoteCacheSupport(long defaultLifespan, long defaultMaxIdleTime)
public 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 NotifyingFuture<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 NotifyingFuture<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 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 V putIfAbsent(K key, V value)
putIfAbsent
in interface ConcurrentMap<K,V>
public 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 boolean replace(K key, V oldValue, V newValue)
replace
in interface ConcurrentMap<K,V>
public 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 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).protected abstract void set(K key, V value)
public final NotifyingFuture<V> putAsync(K key, V value)
AsyncCache
#put(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous. Has no benefit over #put(Object, Object)
if used in LOCAL mode.
putAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storepublic NotifyingFuture<V> putAsync(K key, V value, long lifespan, TimeUnit unit)
AsyncCache
#put(Object, Object, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous. Has no benefit over #put(Object, Object, long, TimeUnit)
if used in LOCAL mode.putAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic NotifyingFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version)
replaceWithVersionAsync
in interface RemoteCache<K,V>
RemoteCache.replaceWithVersion(Object, Object, long)
public NotifyingFuture<Boolean> replaceWithVersionAsync(K key, V newValue, long version, int lifespanSeconds)
replaceWithVersionAsync
in interface RemoteCache<K,V>
RemoteCache.replaceWithVersion(Object, Object, long)
public 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.getVersioned(Object)
,
VersionedValue
public 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 NotifyingFuture<V> replaceAsync(K key, V value)
AsyncCache
#replace(Object, Object)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over #replace(Object, Object)
if used in LOCAL mode.replaceAsync
in interface AsyncCache<K,V>
key
- key to removevalue
- value to storepublic 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 NotifyingFuture<V> putIfAbsentAsync(K key, V value)
AsyncCache
#putIfAbsent(Object, Object)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over #putIfAbsent(Object, Object)
if used in LOCAL mode.
putIfAbsentAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storepublic NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit)
AsyncCache
#putIfAbsent(Object, Object, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous. Has no benefit over #putIfAbsent(Object, Object,
long, TimeUnit)
if used in LOCAL mode.putIfAbsentAsync
in interface AsyncCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entrylifespanUnit
- time unit for lifespanpublic boolean containsValue(Object value)
containsValue
in interface Map<K,V>
containsValue
in interface RemoteCache<K,V>
public Collection<V> values()
public boolean remove(Object key, Object value)
remove
in interface ConcurrentMap<K,V>
public NotifyingFuture<Boolean> removeAsync(Object key, Object value)
AsyncCache
#remove(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous. Has no benefit over #remove(Object, Object)
if used in LOCAL mode.removeAsync
in interface AsyncCache<K,V>
key
- key to removevalue
- value to match onpublic NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit unit)
AsyncCache
#replace(Object, Object, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous. Has no benefit over #replace(Object, Object, long,
TimeUnit)
if used in LOCAL mode.replaceAsync
in interface AsyncCache<K,V>
key
- key to removevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
AsyncCache
#replace(Object, Object, Object)
. This method does not block on remote calls,
even if your cache mode is synchronous. Has no benefit over #replace(Object, Object, Object)
if used in
LOCAL mode.replaceAsync
in interface AsyncCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storepublic NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit)
AsyncCache
#replace(Object, Object, Object, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous. Has no benefit over #replace(Object, Object, Object,
long, TimeUnit)
if used in LOCAL mode.replaceAsync
in interface AsyncCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
AsyncCache
#replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
. This method
does not block on remote calls, even if your cache mode is synchronous. Has no benefit over #replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.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 boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit unit)
BasicCache
ConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.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 boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
ConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.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 timeCopyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.