|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.infinispan.AbstractDelegatingCache<K,V> org.infinispan.AbstractDelegatingAdvancedCache<K,V> org.infinispan.DecoratedCache<K,V>
public class DecoratedCache<K,V>
A decorator to a cache, which can be built with a specific ClassLoader
and a set of Flag
s. This
ClassLoader
and set of Flag
s will be applied to all cache invocations made via this decorator.
AdvancedCache.with(ClassLoader)
or AdvancedCache.withFlags(org.infinispan.context.Flag...)
APIs, thanks to
internal optimizations that can be made when the ClassLoader
and Flag
set is unchanging.
AdvancedCache.with(ClassLoader)
,
AdvancedCache.withFlags(org.infinispan.context.Flag...)
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Field Summary |
---|
Fields inherited from class org.infinispan.AbstractDelegatingAdvancedCache |
---|
cache |
Constructor Summary | |
---|---|
DecoratedCache(AdvancedCache<K,V> delegate,
ClassLoader classLoader)
|
|
DecoratedCache(AdvancedCache<K,V> delegate,
ClassLoader classLoader,
Flag... flags)
|
|
DecoratedCache(AdvancedCache<K,V> delegate,
Flag... flags)
|
Method Summary | |
---|---|
void |
clear()
|
NotifyingFuture<Void> |
clearAsync()
Asynchronous version of Map.clear() . |
boolean |
containsKey(Object key)
|
Set<Map.Entry<K,V>> |
entrySet()
Returns a set view of the mappings contained in this cache. |
void |
evict(K key)
Evicts an entry from the memory of the cache. |
V |
get(Object key)
|
NotifyingFuture<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. |
ClassLoader |
getClassLoader()
Returns the cache loader associated associated with this cache. |
EnumSet<Flag> |
getFlags()
|
boolean |
isEmpty()
|
Set<K> |
keySet()
Returns a set view of the keys contained in this cache. |
boolean |
lock(Collection<? extends K> keys)
Locks collections of keys eagerly across cache nodes in a cluster. |
boolean |
lock(K... keys)
Locks a given key or keys eagerly across cache nodes in a cluster. |
V |
put(K key,
V value)
|
V |
put(K key,
V value,
long lifespan,
TimeUnit unit)
An overloaded form of Map.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 Map.put(Object, Object) , which takes in lifespan parameters. |
void |
putAll(Map<? extends K,? extends V> m)
|
void |
putAll(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit unit)
An overloaded form of Map.putAll(Map) , which takes in lifespan parameters. |
void |
putAll(Map<? extends K,? extends V> map,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of Map.putAll(Map) , which takes in lifespan parameters. |
NotifyingFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data)
Asynchronous version of Map.putAll(Map) . |
NotifyingFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data,
long lifespan,
TimeUnit unit)
Asynchronous version of BasicCache.putAll(Map, long, TimeUnit) . |
NotifyingFuture<Void> |
putAllAsync(Map<? extends K,? extends V> data,
long lifespan,
TimeUnit lifespanUnit,
long maxIdle,
TimeUnit maxIdleUnit)
Asynchronous version of BasicCache.putAll(Map, long, TimeUnit, long, TimeUnit) . |
NotifyingFuture<V> |
putAsync(K key,
V value)
Asynchronous version of Map.put(Object, Object) . |
NotifyingFuture<V> |
putAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of BasicCache.put(Object, Object, long, TimeUnit) . |
NotifyingFuture<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) . |
void |
putForExternalRead(K key,
V value)
Under special operating behavior, associates the value with the specified key. |
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. |
NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value)
Asynchronous version of ConcurrentMap.putIfAbsent(Object, Object) . |
NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of BasicCache.putIfAbsent(Object, Object, long, TimeUnit) . |
NotifyingFuture<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)
|
boolean |
remove(Object key,
Object value)
|
NotifyingFuture<V> |
removeAsync(Object key)
Asynchronous version of Map.remove(Object) . |
NotifyingFuture<Boolean> |
removeAsync(Object key,
Object value)
Asynchronous version of ConcurrentMap.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. |
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. |
NotifyingFuture<V> |
replaceAsync(K key,
V value)
Asynchronous version of ConcurrentMap.replace(Object, Object) . |
NotifyingFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
TimeUnit unit)
Asynchronous version of BasicCache.replace(Object, Object, long, TimeUnit) . |
NotifyingFuture<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) . |
NotifyingFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Asynchronous version of ConcurrentMap.replace(Object, Object, Object) . |
NotifyingFuture<Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
TimeUnit unit)
Asynchronous version of BasicCache.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 BasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit) . |
int |
size()
|
void |
stop()
|
Collection<V> |
values()
Returns a collection view of the values contained in this cache. |
AdvancedCache<K,V> |
with(ClassLoader classLoader)
Using this operation, users can call any AdvancedCache operation
with a given ClassLoader . |
AdvancedCache<K,V> |
withFlags(Flag... flags)
A method that adds flags to any API call. |
Methods inherited from class org.infinispan.AbstractDelegatingCache |
---|
addListener, compact, containsValue, endBatch, getCacheConfiguration, getCacheManager, getConfiguration, getDelegate, getListeners, getName, getStatus, getVersion, removeListener, set, start, startBatch, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.infinispan.Cache |
---|
compact, endBatch, getCacheConfiguration, getCacheManager, getConfiguration, getStatus, startBatch |
Methods inherited from interface org.infinispan.api.BasicCache |
---|
getName, getVersion |
Methods inherited from interface java.util.Map |
---|
containsValue, equals, hashCode |
Methods inherited from interface org.infinispan.lifecycle.Lifecycle |
---|
start |
Methods inherited from interface org.infinispan.notifications.Listenable |
---|
addListener, getListeners, removeListener |
Constructor Detail |
---|
public DecoratedCache(AdvancedCache<K,V> delegate, ClassLoader classLoader)
public DecoratedCache(AdvancedCache<K,V> delegate, Flag... flags)
public DecoratedCache(AdvancedCache<K,V> delegate, ClassLoader classLoader, Flag... flags)
Method Detail |
---|
public AdvancedCache<K,V> with(ClassLoader classLoader)
AdvancedCache
AdvancedCache
operation
with a given ClassLoader
. This means that any ClassLoader
happening
as a result of the cache operation will be done using the ClassLoader
given. For example:
When users store POJO instances in caches configured with Configuration.storeAsBinary
,
these instances are transformed into byte arrays. When these entries are
read from the cache, a lazy unmarshalling process happens where these byte
arrays are transformed back into POJO instances. Using AdvancedCache.with(ClassLoader)
when reading that enables users to provide the class loader that should
be used when trying to locate the classes that are constructed as a result
of the unmarshalling process.
cache.with(classLoader).get(key);Note that for the flag to take effect, the cache operation must be invoked on the instance returned by this method. As an alternative to setting this on every invocation, users could also consider using the
DecoratedCache
wrapper, as this allows for more readable
code. E.g.:
Cache classLoaderSpecificCache = new DecoratedCache(cache, classLoader); classLoaderSpecificCache.get(key1); classLoaderSpecificCache.get(key2); classLoaderSpecificCache.get(key3);
with
in interface AdvancedCache<K,V>
with
in class AbstractDelegatingAdvancedCache<K,V>
AdvancedCache
instance upon which operations can be called
with a particular ClassLoader
.public AdvancedCache<K,V> withFlags(Flag... flags)
AdvancedCache
cache.withFlags(Flag.FORCE_WRITE_LOCK).get(key);will invoke a cache.get() with a write lock forced. Note that for the flag to take effect, the cache operation must be invoked on the instance returned by this method. As an alternative to setting this on every invocation, users could also consider using the
DecoratedCache
wrapper, as this allows for more readable
code. E.g.:
Cache forceWriteLockCache = new DecoratedCache(cache, Flag.FORCE_WRITE_LOCK); forceWriteLockCache.get(key1); forceWriteLockCache.get(key2); forceWriteLockCache.get(key3);
withFlags
in interface AdvancedCache<K,V>
withFlags
in class AbstractDelegatingAdvancedCache<K,V>
flags
- a set of flags to apply. See the Flag
documentation.
AdvancedCache
instance on which a real operation is to be invoked, if the flags are
to be applied.public ClassLoader getClassLoader()
AdvancedCache
DecoratedCache
wrapper.
getClassLoader
in interface AdvancedCache<K,V>
getClassLoader
in class AbstractDelegatingAdvancedCache<K,V>
public void stop()
stop
in interface Lifecycle
stop
in class AbstractDelegatingCache<K,V>
public boolean lock(K... keys)
AdvancedCache
Keys can be locked eagerly in the context of a transaction only.
lock
in interface AdvancedCache<K,V>
lock
in class AbstractDelegatingAdvancedCache<K,V>
keys
- the keys to lock
Flag.FAIL_SILENTLY
.public boolean lock(Collection<? extends K> keys)
AdvancedCache
Collections of keys can be locked eagerly in the context of a transaction only.
lock
in interface AdvancedCache<K,V>
lock
in class AbstractDelegatingAdvancedCache<K,V>
keys
- collection of keys to lock
Flag.FAIL_SILENTLY
.public void putForExternalRead(K key, V value)
Cache
ConcurrentMap.putIfAbsent(Object, Object)
)
putForExternalRead
in interface Cache<K,V>
putForExternalRead
in class AbstractDelegatingCache<K,V>
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.public void evict(K key)
Cache
Map.remove(Object)
to remove an
entry from the entire cache system.
This method is designed to evict an entry from memory to free up memory used by the application. This method uses
a 0 lock acquisition timeout so it does not block in attempting to acquire locks. It behaves as a no-op if the
lock on the entry cannot be acquired immediately.
Important: this method should not be called from within a transaction scope.
evict
in interface Cache<K,V>
evict
in class AbstractDelegatingCache<K,V>
key
- key to evictpublic V put(K key, V value, long lifespan, TimeUnit unit)
BasicCache
Map.put(Object, Object)
, which takes in lifespan parameters.
put
in interface BasicCache<K,V>
put
in class AbstractDelegatingCache<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 lifespan
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>
putIfAbsent
in class AbstractDelegatingCache<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 lifespan
public void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit)
BasicCache
Map.putAll(Map)
, which takes in lifespan parameters. Note that the lifespan is applied
to all mappings in the map passed in.
putAll
in interface BasicCache<K,V>
putAll
in class AbstractDelegatingCache<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 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>
replace
in class AbstractDelegatingCache<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 lifespan
public 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>
replace
in class AbstractDelegatingCache<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 lifespan
public V put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
Map.put(Object, Object)
, which takes in lifespan parameters.
put
in interface BasicCache<K,V>
put
in class AbstractDelegatingCache<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 time
public 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>
putIfAbsent
in class AbstractDelegatingCache<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 time
public void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
BasicCache
Map.putAll(Map)
, which takes in lifespan parameters. Note that the lifespan is applied
to all mappings in the map passed in.
putAll
in interface BasicCache<K,V>
putAll
in class AbstractDelegatingCache<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 timepublic 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>
replace
in class AbstractDelegatingCache<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 time
public 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>
replace
in class AbstractDelegatingCache<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 time
public NotifyingFuture<V> putAsync(K key, V value)
BasicCache
Map.put(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous. Has no benefit over Map.put(Object, Object)
if used in LOCAL mode.
putAsync
in interface BasicCache<K,V>
putAsync
in class AbstractDelegatingCache<K,V>
key
- key to usevalue
- value to store
public NotifyingFuture<V> putAsync(K key, V value, long lifespan, TimeUnit unit)
BasicCache
BasicCache.put(Object, Object, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous. Has no benefit over BasicCache.put(Object, Object, long, TimeUnit)
if used in LOCAL mode.
putAsync
in interface BasicCache<K,V>
putAsync
in class AbstractDelegatingCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan
public NotifyingFuture<V> putAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
BasicCache
BasicCache.put(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 BasicCache.put(Object, Object, long,
TimeUnit, long, TimeUnit)
if used in LOCAL mode.
putAsync
in interface BasicCache<K,V>
putAsync
in class AbstractDelegatingCache<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 time
public NotifyingFuture<Void> putAllAsync(Map<? extends K,? extends V> data)
BasicCache
Map.putAll(Map)
. This method does not block on remote calls, even if your cache mode
is synchronous. Has no benefit over Map.putAll(Map)
if used in LOCAL mode.
putAllAsync
in interface BasicCache<K,V>
putAllAsync
in class AbstractDelegatingCache<K,V>
data
- to store
public NotifyingFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit unit)
BasicCache
BasicCache.putAll(Map, long, TimeUnit)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over BasicCache.putAll(Map, long, TimeUnit)
if used in LOCAL mode.
putAllAsync
in interface BasicCache<K,V>
putAllAsync
in class AbstractDelegatingCache<K,V>
data
- to storelifespan
- lifespan of entryunit
- time unit for lifespan
public NotifyingFuture<Void> putAllAsync(Map<? extends K,? extends V> data, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
BasicCache
BasicCache.putAll(Map, long, TimeUnit, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous. Has no benefit over BasicCache.putAll(Map, long, TimeUnit,
long, TimeUnit)
if used in LOCAL mode.
putAllAsync
in interface BasicCache<K,V>
putAllAsync
in class AbstractDelegatingCache<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 time
public NotifyingFuture<Void> clearAsync()
BasicCache
Map.clear()
. This method does not block on remote calls, even if your cache mode is
synchronous. Has no benefit over Map.clear()
if used in LOCAL mode.
clearAsync
in interface BasicCache<K,V>
clearAsync
in class AbstractDelegatingCache<K,V>
public NotifyingFuture<V> putIfAbsentAsync(K key, V value)
BasicCache
ConcurrentMap.putIfAbsent(Object, Object)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over ConcurrentMap.putIfAbsent(Object, Object)
if used in LOCAL mode.
putIfAbsentAsync
in interface BasicCache<K,V>
putIfAbsentAsync
in class AbstractDelegatingCache<K,V>
key
- key to usevalue
- value to store
public NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit unit)
BasicCache
BasicCache.putIfAbsent(Object, Object, long, TimeUnit)
. This method does not block on
remote calls, even if your cache mode is synchronous. Has no benefit over BasicCache.putIfAbsent(Object, Object,
long, TimeUnit)
if used in LOCAL mode.
putIfAbsentAsync
in interface BasicCache<K,V>
putIfAbsentAsync
in class AbstractDelegatingCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan
public NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
BasicCache
BasicCache.putIfAbsent(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 BasicCache.putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.
putIfAbsentAsync
in interface BasicCache<K,V>
putIfAbsentAsync
in class AbstractDelegatingCache<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 time
public NotifyingFuture<V> removeAsync(Object key)
BasicCache
Map.remove(Object)
. This method does not block on remote calls, even if your cache
mode is synchronous. Has no benefit over Map.remove(Object)
if used in LOCAL mode.
removeAsync
in interface BasicCache<K,V>
removeAsync
in class AbstractDelegatingCache<K,V>
key
- key to remove
public NotifyingFuture<Boolean> removeAsync(Object key, Object value)
BasicCache
ConcurrentMap.remove(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous. Has no benefit over ConcurrentMap.remove(Object, Object)
if used in LOCAL mode.
removeAsync
in interface BasicCache<K,V>
removeAsync
in class AbstractDelegatingCache<K,V>
key
- key to removevalue
- value to match on
public NotifyingFuture<V> replaceAsync(K key, V value)
BasicCache
ConcurrentMap.replace(Object, Object)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over ConcurrentMap.replace(Object, Object)
if used in LOCAL mode.
replaceAsync
in interface BasicCache<K,V>
replaceAsync
in class AbstractDelegatingCache<K,V>
key
- key to removevalue
- value to store
public NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit unit)
BasicCache
BasicCache.replace(Object, Object, long, TimeUnit)
. This method does not block on remote
calls, even if your cache mode is synchronous. Has no benefit over BasicCache.replace(Object, Object, long,
TimeUnit)
if used in LOCAL mode.
replaceAsync
in interface BasicCache<K,V>
replaceAsync
in class AbstractDelegatingCache<K,V>
key
- key to removevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan
public NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
BasicCache
BasicCache.replace(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 BasicCache.replace(Object,
Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.
replaceAsync
in interface BasicCache<K,V>
replaceAsync
in class AbstractDelegatingCache<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 time
public NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue)
BasicCache
ConcurrentMap.replace(Object, Object, Object)
. This method does not block on remote calls,
even if your cache mode is synchronous. Has no benefit over ConcurrentMap.replace(Object, Object, Object)
if used in
LOCAL mode.
replaceAsync
in interface BasicCache<K,V>
replaceAsync
in class AbstractDelegatingCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to store
public NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit unit)
BasicCache
BasicCache.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 BasicCache.replace(Object, Object, Object,
long, TimeUnit)
if used in LOCAL mode.
replaceAsync
in interface BasicCache<K,V>
replaceAsync
in class AbstractDelegatingCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespan
public NotifyingFuture<Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, TimeUnit lifespanUnit, long maxIdle, TimeUnit maxIdleUnit)
BasicCache
BasicCache.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 BasicCache.replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.
replaceAsync
in interface BasicCache<K,V>
replaceAsync
in class AbstractDelegatingCache<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 time
public NotifyingFuture<V> getAsync(K key)
BasicCache
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 cache loaders are configured, the get asynchronous call will act
sequentially and will have no different to Map.get(Object)
.
getAsync
in interface BasicCache<K,V>
getAsync
in class AbstractDelegatingCache<K,V>
key
- key to retrieve
Map.get(Object)
public int size()
size
in interface Map<K,V>
size
in class AbstractDelegatingCache<K,V>
public boolean isEmpty()
isEmpty
in interface Map<K,V>
isEmpty
in class AbstractDelegatingCache<K,V>
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
containsKey
in class AbstractDelegatingCache<K,V>
public V get(Object key)
get
in interface Map<K,V>
get
in class AbstractDelegatingCache<K,V>
public V put(K key, V value)
put
in interface Map<K,V>
put
in class AbstractDelegatingCache<K,V>
public V remove(Object key)
remove
in interface Map<K,V>
remove
in class AbstractDelegatingCache<K,V>
public void putAll(Map<? extends K,? extends V> m)
putAll
in interface Map<K,V>
putAll
in class AbstractDelegatingCache<K,V>
public void clear()
clear
in interface Map<K,V>
clear
in class AbstractDelegatingCache<K,V>
public Set<K> keySet()
Cache
keySet
in interface Map<K,V>
keySet
in interface Cache<K,V>
keySet
in class AbstractDelegatingCache<K,V>
public Collection<V> values()
Cache
values
in interface Map<K,V>
values
in interface Cache<K,V>
values
in class AbstractDelegatingCache<K,V>
public Set<Map.Entry<K,V>> entrySet()
Cache
Map.Entry
. When this method is called on a cache configured with distribution mode, the set returned only
contains the mappings locally available in the cache instance. To avoid memory issues, there will be not attempt
to bring mappings from other nodes.
This method should only be used for debugging purposes such as to verify that the cache contains all the mappings
entered. Any other use involving execution of this method on a production system is not recommended.
entrySet
in interface Map<K,V>
entrySet
in interface Cache<K,V>
entrySet
in class AbstractDelegatingCache<K,V>
public V putIfAbsent(K key, V value)
putIfAbsent
in interface ConcurrentMap<K,V>
putIfAbsent
in class AbstractDelegatingCache<K,V>
public boolean remove(Object key, Object value)
remove
in interface ConcurrentMap<K,V>
remove
in class AbstractDelegatingCache<K,V>
public boolean replace(K key, V oldValue, V newValue)
replace
in interface ConcurrentMap<K,V>
replace
in class AbstractDelegatingCache<K,V>
public V replace(K key, V value)
replace
in interface ConcurrentMap<K,V>
replace
in class AbstractDelegatingCache<K,V>
public EnumSet<Flag> getFlags()
|
--> | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |