public abstract class AbstractDelegatingCache<K,V> extends java.lang.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(java.lang.Object listener)
Adds a listener to the component.
|
void |
addListener(java.lang.Object listener,
org.infinispan.notifications.KeyFilter filter)
Adds a listener to the component.
|
void |
clear() |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
clearAsync()
Asynchronous version of
#clear() . |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
void |
endBatch(boolean successful) |
java.util.Set< |
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(java.lang.Object key) |
AdvancedCache<K,V> |
getAdvancedCache() |
org.infinispan.util.concurrent.NotifyingFuture<V> |
getAsync(K key)
Asynchronous version of
#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() |
org.infinispan.manager.EmbeddedCacheManager |
getCacheManager()
Retrieves the cache manager responsible for creating this cache instance.
|
Cache<K,V> |
getDelegate() |
java.util.Set<java.lang.Object> |
getListeners() |
java.lang.String |
getName() |
org.infinispan.lifecycle.ComponentStatus |
getStatus() |
java.lang.String |
getVersion() |
boolean |
isEmpty() |
java.util.Set<K> |
keySet()
Returns a set view of the keys contained in this cache and cache loader.
|
V |
put(K key,
V value) |
V |
put(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit) |
V |
put(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit maxIdleTimeUnit) |
void |
putAll(java.util.Map<? extends K,? extends V> t) |
void |
putAll(java.util.Map<? extends K,? extends V> map,
long lifespan,
java.util.concurrent.TimeUnit unit) |
void |
putAll(java.util.Map<? extends K,? extends V> map,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit maxIdleTimeUnit) |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
putAllAsync(java.util.Map<? extends K,? extends V> data)
Asynchronous version of
#putAll(Map) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
putAllAsync(java.util.Map<? extends K,? extends V> data,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#putAll(Map, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> |
putAllAsync(java.util.Map<? extends K,? extends V> data,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#putAll(Map, long, TimeUnit, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putAsync(K key,
V value)
Asynchronous version of
#put(Object, Object) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#put(Object, Object, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#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,
java.util.concurrent.TimeUnit unit) |
V |
putIfAbsent(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit maxIdleTimeUnit) |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value)
Asynchronous version of
#putIfAbsent(Object, Object) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#putIfAbsent(Object, Object, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
putIfAbsentAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit) . |
V |
remove(java.lang.Object key) |
boolean |
remove(java.lang.Object key,
java.lang.Object value) |
org.infinispan.util.concurrent.NotifyingFuture<V> |
removeAsync(java.lang.Object key)
Asynchronous version of
#remove(Object) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
removeAsync(java.lang.Object key,
java.lang.Object value)
Asynchronous version of
#remove(Object, Object) . |
void |
removeListener(java.lang.Object listener)
Removes a listener from the component.
|
V |
replace(K key,
V value) |
V |
replace(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit) |
V |
replace(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit maxIdleTimeUnit) |
boolean |
replace(K key,
V oldValue,
V newValue) |
boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit) |
boolean |
replace(K key,
V oldValue,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdleTime,
java.util.concurrent.TimeUnit maxIdleTimeUnit) |
org.infinispan.util.concurrent.NotifyingFuture<V> |
replaceAsync(K key,
V value)
Asynchronous version of
#replace(Object, Object) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#replace(Object, Object, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<V> |
replaceAsync(K key,
V value,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#replace(Object, Object, long, TimeUnit, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
replaceAsync(K key,
V oldValue,
V newValue)
Asynchronous version of
#replace(Object, Object, Object) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
java.util.concurrent.TimeUnit unit)
Asynchronous version of
#replace(Object, Object, Object, long, TimeUnit) . |
org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> |
replaceAsync(K key,
V oldValue,
V newValue,
long lifespan,
java.util.concurrent.TimeUnit lifespanUnit,
long maxIdle,
java.util.concurrent.TimeUnit maxIdleUnit)
Asynchronous version of
#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() |
void |
stop() |
java.lang.String |
toString() |
java.util.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
#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()
public void endBatch(boolean successful)
public java.lang.String getName()
public java.lang.String getVersion()
public org.infinispan.manager.EmbeddedCacheManager getCacheManager()
Cache
getCacheManager
in interface Cache<K,V>
protected void set(K key, V value)
org.infinispan.CacheSupport#set(Object, Object)}
public void putAll(java.util.Map<? extends K,? extends V> map, long lifespan, java.util.concurrent.TimeUnit unit)
public boolean replace(K key, V oldValue, V value, long lifespan, java.util.concurrent.TimeUnit unit)
public V put(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit maxIdleTimeUnit)
public V putIfAbsent(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit maxIdleTimeUnit)
public void putAll(java.util.Map<? extends K,? extends V> map, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit maxIdleTimeUnit)
public V replace(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit maxIdleTimeUnit)
public boolean replace(K key, V oldValue, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdleTime, java.util.concurrent.TimeUnit maxIdleTimeUnit)
public org.infinispan.util.concurrent.NotifyingFuture<V> putAsync(K key, V value)
org.infinispan.api.BasicCache
#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.
public org.infinispan.util.concurrent.NotifyingFuture<V> putAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.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 #put(Object, Object, long, TimeUnit)
if used in LOCAL mode.public org.infinispan.util.concurrent.NotifyingFuture<V> putAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.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 #put(Object, Object, long,
TimeUnit, long, TimeUnit)
if used in LOCAL mode.putAsync
in interface org.infinispan.api.BasicCache<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 org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> putAllAsync(java.util.Map<? extends K,? extends V> data)
org.infinispan.api.BasicCache
#putAll(Map)
. This method does not block on remote calls, even if your cache mode
is synchronous. Has no benefit over #putAll(Map)
if used in LOCAL mode.public org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> putAllAsync(java.util.Map<? extends K,? extends V> data, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.BasicCache
#putAll(Map, long, TimeUnit)
. This method does not block on remote calls, even if
your cache mode is synchronous. Has no benefit over #putAll(Map, long, TimeUnit)
if used in LOCAL mode.public org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> putAllAsync(java.util.Map<? extends K,? extends V> data, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.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 #putAll(Map, long, TimeUnit,
long, TimeUnit)
if used in LOCAL mode.putAllAsync
in interface org.infinispan.api.BasicCache<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 org.infinispan.util.concurrent.NotifyingFuture<java.lang.Void> clearAsync()
org.infinispan.api.BasicCache
#clear()
. This method does not block on remote calls, even if your cache mode is
synchronous. Has no benefit over #clear()
if used in LOCAL mode.public org.infinispan.util.concurrent.NotifyingFuture<V> putIfAbsentAsync(K key, V value)
org.infinispan.api.BasicCache
#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.
public org.infinispan.util.concurrent.NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.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 #putIfAbsent(Object, Object,
long, TimeUnit)
if used in LOCAL mode.public org.infinispan.util.concurrent.NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.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 #putIfAbsent(Object, Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.putIfAbsentAsync
in interface org.infinispan.api.BasicCache<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 org.infinispan.util.concurrent.NotifyingFuture<V> removeAsync(java.lang.Object key)
org.infinispan.api.BasicCache
#remove(Object)
. This method does not block on remote calls, even if your cache
mode is synchronous. Has no benefit over #remove(Object)
if used in LOCAL mode.public org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> removeAsync(java.lang.Object key, java.lang.Object value)
org.infinispan.api.BasicCache
#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.public org.infinispan.util.concurrent.NotifyingFuture<V> replaceAsync(K key, V value)
org.infinispan.api.BasicCache
#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.public org.infinispan.util.concurrent.NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.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 #replace(Object, Object, long,
TimeUnit)
if used in LOCAL mode.public org.infinispan.util.concurrent.NotifyingFuture<V> replaceAsync(K key, V value, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.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 #replace(Object,
Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.replaceAsync
in interface org.infinispan.api.BasicCache<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 org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> replaceAsync(K key, V oldValue, V newValue)
org.infinispan.api.BasicCache
#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.public org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, java.util.concurrent.TimeUnit unit)
org.infinispan.api.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 #replace(Object, Object, Object,
long, TimeUnit)
if used in LOCAL mode.replaceAsync
in interface org.infinispan.api.BasicCache<K,V>
key
- key to removeoldValue
- value to overwritenewValue
- value to storelifespan
- lifespan of entryunit
- time unit for lifespanpublic org.infinispan.util.concurrent.NotifyingFuture<java.lang.Boolean> replaceAsync(K key, V oldValue, V newValue, long lifespan, java.util.concurrent.TimeUnit lifespanUnit, long maxIdle, java.util.concurrent.TimeUnit maxIdleUnit)
org.infinispan.api.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 #replace(Object, Object, Object, long, TimeUnit, long, TimeUnit)
if used in LOCAL mode.replaceAsync
in interface org.infinispan.api.BasicCache<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 org.infinispan.lifecycle.ComponentStatus getStatus()
public boolean remove(java.lang.Object key, java.lang.Object value)
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 isEmpty()
public boolean containsKey(java.lang.Object key)
public boolean containsValue(java.lang.Object value)
public V get(java.lang.Object key)
public V remove(java.lang.Object key)
public void clear()
public java.util.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 java.util.Set<> 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 java.util.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 start()
public void stop()
public void addListener(java.lang.Object listener)
org.infinispan.notifications.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 org.infinispan.notifications.Listenable
listener
- must not be null.public void addListener(java.lang.Object listener, org.infinispan.notifications.KeyFilter filter)
org.infinispan.notifications.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 org.infinispan.notifications.FilteringListenable
listener
- must not be null.public void removeListener(java.lang.Object listener)
org.infinispan.notifications.Listenable
removeListener
in interface org.infinispan.notifications.Listenable
listener
- listener to remove. Must not be null.public java.util.Set<java.lang.Object> getListeners()
getListeners
in interface org.infinispan.notifications.Listenable
public org.infinispan.util.concurrent.NotifyingFuture<V> getAsync(K key)
org.infinispan.api.BasicCache
#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 #get(Object)
.public java.lang.String toString()
toString
in class java.lang.Object