public abstract class AbstractDelegatingCache<K,V> extends Object implements Cache<K,V>
Cache
argument, to which each method call is delegated. One can extend this class and override the method sub-set it is
interested in. There is also an similar implementation for AdvancedCache
: AbstractDelegatingAdvancedCache
.AbstractDelegatingAdvancedCache
Constructor and Description |
---|
AbstractDelegatingCache(Cache<K,V> cache) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(Object listener)
Adds a listener to the component.
|
void |
addListener(Object listener,
KeyFilter filter)
Adds a listener to the component.
|
void |
clear() |
NotifyingFuture<Void> |
clearAsync()
Asynchronous version of
Map.clear() . |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
void |
endBatch(boolean successful)
Completes a batch if one has been started using
BatchingCache.startBatch() . |
Set<Map.Entry<K,V>> |
entrySet()
Returns a set view of the mappings contained in this cache and cache loader.
|
void |
evict(K key)
Evicts an entry from the memory of the cache.
|
V |
get(Object key) |
AdvancedCache<K,V> |
getAdvancedCache() |
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. |
Configuration |
getCacheConfiguration() |
EmbeddedCacheManager |
getCacheManager()
Retrieves the cache manager responsible for creating this cache instance.
|
Cache<K,V> |
getDelegate() |
Set<Object> |
getListeners() |
String |
getName()
Retrieves the name of the cache
|
ComponentStatus |
getStatus() |
String |
getVersion()
Retrieves the version of Infinispan
|
boolean |
isEmpty() |
Set<K> |
keySet()
Returns a set view of the keys contained in this cache and cache loader.
|
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> t) |
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
BasicCache.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)
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) |
NotifyingFuture<V> |
removeAsync(Object key)
Asynchronous version of
BasicCache.remove(Object) . |
NotifyingFuture<Boolean> |
removeAsync(Object key,
Object value)
Asynchronous version of
ConcurrentMap.remove(Object, Object) . |
void |
removeListener(Object listener)
Removes a listener from the component.
|
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) . |
protected void |
set(K key,
V value)
Don't remove.
|
int |
size()
Returns a count of all elements in this cache and cache loader.
|
void |
start() |
boolean |
startBatch()
Starts a batch.
|
void |
stop() |
String |
toString() |
Collection<V> |
values()
Returns a collection view of the values contained in this cache.
|
public void putForExternalRead(K key, V value)
Cache
ConcurrentMap.putIfAbsent(Object, Object)
)
putForExternalRead
in interface Cache<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
BasicCache.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.public Configuration getCacheConfiguration()
getCacheConfiguration
in interface Cache<K,V>
public boolean startBatch()
BatchingCache
startBatch
in interface BatchingCache
public void endBatch(boolean successful)
BatchingCache
BatchingCache.startBatch()
. If no batch has been started, this is a
no-op.
endBatch
in interface BatchingCache
successful
- if true, the batch completes, otherwise the batch is aborted and changes are not committed.public String getName()
BasicCache
getName
in interface BasicCache<K,V>
public String getVersion()
BasicCache
getVersion
in interface BasicCache<K,V>
public EmbeddedCacheManager getCacheManager()
Cache
getCacheManager
in interface Cache<K,V>
public 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 lifespanprotected void set(K key, V value)
org.infinispan.CacheSupport#set(Object, Object)}
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 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>
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>
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 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 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 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 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>
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>
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 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 timepublic NotifyingFuture<V> putAsync(K key, V value)
BasicCache
BasicCache.put(Object, Object)
. This method does not block on remote calls, even if your
cache mode is synchronous. Has no benefit over BasicCache.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)
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 AsyncCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic 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 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 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 AsyncCache<K,V>
data
- to storepublic 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 AsyncCache<K,V>
data
- to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic 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 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 timepublic 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 AsyncCache<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 AsyncCache<K,V>
key
- key to usevalue
- value to storepublic 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 AsyncCache<K,V>
key
- key to usevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic 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 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 NotifyingFuture<V> removeAsync(Object key)
BasicCache
BasicCache.remove(Object)
. This method does not block on remote calls, even if your cache
mode is synchronous. Has no benefit over BasicCache.remove(Object)
if used in LOCAL mode.removeAsync
in interface AsyncCache<K,V>
key
- key to removepublic 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 AsyncCache<K,V>
key
- key to removevalue
- value to match onpublic 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 AsyncCache<K,V>
key
- key to removevalue
- value to storepublic 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 AsyncCache<K,V>
key
- key to removevalue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic 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 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 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 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)
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 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)
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 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 AdvancedCache<K,V> getAdvancedCache()
getAdvancedCache
in interface Cache<K,V>
public ComponentStatus getStatus()
public V putIfAbsent(K key, V value)
putIfAbsent
in interface ConcurrentMap<K,V>
public boolean remove(Object key, Object value)
remove
in interface ConcurrentMap<K,V>
public boolean replace(K key, V oldValue, V newValue)
replace
in interface ConcurrentMap<K,V>
public int size()
Cache
org.infinispan.context.Flag.SKIP_CACHE_LOAD
flag should be used to
avoid hitting the cache store as all local keys will be loaded into memory at once.
This method should only be used for debugging purposes such as to verify that the cache contains all the keys
entered. Any other use involving execution of this method on a production system is not recommended.
public boolean containsKey(Object key)
containsKey
in interface Map<K,V>
public boolean containsValue(Object value)
containsValue
in interface Map<K,V>
public 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 V remove(Object key)
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 Set<K> keySet()
Cache
org.infinispan.context.Flag.SKIP_CACHE_LOAD
flag should be used to
avoid hitting the cache store as all local keys will be in memory at once.
This method should only be used for debugging purposes such as to verify that the cache contains all the keys
entered. Any other use involving execution of this method on a production system is not recommended.
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.
If there are memory concerns then the org.infinispan.context.Flag.SKIP_CACHE_LOAD
flag should be used to
avoid hitting the cache store as all local entries will be in memory at once.
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.
public Collection<V> values()
Cache
org.infinispan.context.Flag.SKIP_CACHE_LOAD
flag should be used to
avoid hitting the cache store as all local values will be in memory at once.
This method should only be used for testing or debugging purposes such as to verify that the cache contains all the
values entered. Any other use involving execution of this method on a production system is not recommended.
public void addListener(Object listener)
Listenable
Listener
and
further to that, contain methods annotated appropriately, otherwise the listener will not be registered.
See the Listener
annotation for more information.
addListener
in interface Listenable
listener
- must not be null.public void addListener(Object listener, KeyFilter filter)
FilteringListenable
Listener
and
further to that, contain methods annotated appropriately, otherwise the listener will not be registered.
See the Listener
annotation for more information.
addListener
in interface FilteringListenable
listener
- must not be null.public void removeListener(Object listener)
Listenable
removeListener
in interface Listenable
listener
- listener to remove. Must not be null.public Set<Object> getListeners()
getListeners
in interface Listenable
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 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)
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.