org.infinispan
Class CacheSupport<K,V>

java.lang.Object
  extended by org.infinispan.CacheSupport<K,V>
All Implemented Interfaces:
ConcurrentMap<K,V>, Map<K,V>, Cache<K,V>, Lifecycle, Listenable
Direct Known Subclasses:
CacheDelegate, RemoteCacheSupport

public abstract class CacheSupport<K,V>
extends Object
implements Cache<K,V>

Since:
4.1
Author:
Mircea.Markus@jboss.com

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  long defaultLifespan
           
protected  long defaultMaxIdleTime
           
 
Constructor Summary
protected CacheSupport()
           
protected CacheSupport(long defaultLifespan, long defaultMaxIdleTime)
           
 
Method Summary
 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.
 void putAll(Map<? extends K,? extends V> map)
           
 void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit)
          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 Cache.putAll(Map, 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 Cache.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 ConcurrentMap.putIfAbsent(Object, Object).
 NotifyingFuture<V> putIfAbsentAsync(K key, V value, long lifespan, TimeUnit unit)
          Asynchronous version of Cache.putIfAbsent(Object, Object, long, TimeUnit) .
 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.
 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 Cache.replace(Object, Object, 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 Cache.replace(Object, Object, Object, long, TimeUnit).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.infinispan.Cache
clearAsync, compact, endBatch, entrySet, evict, getAdvancedCache, getCacheManager, getConfiguration, getName, getStatus, getVersion, keySet, put, putAll, putAllAsync, putAsync, putForExternalRead, putIfAbsent, putIfAbsentAsync, removeAsync, removeAsync, replace, replace, replaceAsync, replaceAsync, startBatch, values
 
Methods inherited from interface java.util.concurrent.ConcurrentMap
remove
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, equals, get, hashCode, isEmpty, remove, size
 
Methods inherited from interface org.infinispan.lifecycle.Lifecycle
start, stop
 
Methods inherited from interface org.infinispan.notifications.Listenable
addListener, getListeners, removeListener
 

Field Detail

defaultLifespan

protected long defaultLifespan

defaultMaxIdleTime

protected long defaultMaxIdleTime
Constructor Detail

CacheSupport

protected CacheSupport()

CacheSupport

protected CacheSupport(long defaultLifespan,
                       long defaultMaxIdleTime)
Method Detail

put

public final V put(K key,
                   V value)
Specified by:
put in interface Map<K,V>

putAll

public final void putAll(Map<? extends K,? extends V> map)
Specified by:
putAll in interface Map<K,V>

putAsync

public final NotifyingFuture<V> putAsync(K key,
                                         V value)
Description copied from interface: Cache
Asynchronous version of 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.

Specified by:
putAsync in interface Cache<K,V>
Parameters:
key - key to use
value - value to store
Returns:
a future containing the old value replaced.

putIfAbsent

public final V putIfAbsent(K key,
                           V value)
Specified by:
putIfAbsent in interface ConcurrentMap<K,V>

putAsync

public final NotifyingFuture<V> putAsync(K key,
                                         V value,
                                         long lifespan,
                                         TimeUnit unit)
Description copied from interface: Cache
Asynchronous version of Cache.put(Object, Object, long, TimeUnit) . This method does not block on remote calls, even if your cache mode is synchronous. Has no benefit over Cache.put(Object, Object, long, TimeUnit) if used in LOCAL mode.

Specified by:
putAsync in interface Cache<K,V>
Parameters:
key - key to use
value - value to store
lifespan - lifespan of entry
unit - time unit for lifespan
Returns:
a future containing the old value replaced

putAllAsync

public final NotifyingFuture<Void> putAllAsync(Map<? extends K,? extends V> data)
Description copied from interface: Cache
Asynchronous version of 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.

Specified by:
putAllAsync in interface Cache<K,V>
Parameters:
data - to store
Returns:
a future containing a void return type

putAllAsync

public final NotifyingFuture<Void> putAllAsync(Map<? extends K,? extends V> data,
                                               long lifespan,
                                               TimeUnit unit)
Description copied from interface: Cache
Asynchronous version of Cache.putAll(Map, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous. Has no benefit over Cache.putAll(Map, long, TimeUnit) if used in LOCAL mode.

Specified by:
putAllAsync in interface Cache<K,V>
Parameters:
data - to store
lifespan - lifespan of entry
unit - time unit for lifespan
Returns:
a future containing a void return type

putIfAbsentAsync

public final NotifyingFuture<V> putIfAbsentAsync(K key,
                                                 V value)
Description copied from interface: Cache
Asynchronous version of 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.

Specified by:
putIfAbsentAsync in interface Cache<K,V>
Parameters:
key - key to use
value - value to store
Returns:
a future containing the old value replaced.

putIfAbsentAsync

public final NotifyingFuture<V> putIfAbsentAsync(K key,
                                                 V value,
                                                 long lifespan,
                                                 TimeUnit unit)
Description copied from interface: Cache
Asynchronous version of Cache.putIfAbsent(Object, Object, long, TimeUnit) . This method does not block on remote calls, even if your cache mode is synchronous. Has no benefit over Cache.putIfAbsent(Object, Object, long, TimeUnit) if used in LOCAL mode.

Specified by:
putIfAbsentAsync in interface Cache<K,V>
Parameters:
key - key to use
value - value to store
lifespan - lifespan of entry
unit - time unit for lifespan
Returns:
a future containing the old value replaced

replaceAsync

public final NotifyingFuture<V> replaceAsync(K key,
                                             V value,
                                             long lifespan,
                                             TimeUnit unit)
Description copied from interface: Cache
Asynchronous version of Cache.replace(Object, Object, long, TimeUnit). This method does not block on remote calls, even if your cache mode is synchronous. Has no benefit over Cache.replace(Object, Object, long, TimeUnit) if used in LOCAL mode.

Specified by:
replaceAsync in interface Cache<K,V>
Parameters:
key - key to remove
value - value to store
lifespan - lifespan of entry
unit - time unit for lifespan
Returns:
a future containing the previous value overwritten

replaceAsync

public final NotifyingFuture<Boolean> replaceAsync(K key,
                                                   V oldValue,
                                                   V newValue)
Description copied from interface: Cache
Asynchronous version of 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.

Specified by:
replaceAsync in interface Cache<K,V>
Parameters:
key - key to remove
oldValue - value to overwrite
newValue - value to store
Returns:
a future containing a boolean, indicating whether the entry was replaced or not

replaceAsync

public final NotifyingFuture<V> replaceAsync(K key,
                                             V value)
Description copied from interface: Cache
Asynchronous version of 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.

Specified by:
replaceAsync in interface Cache<K,V>
Parameters:
key - key to remove
value - value to store
Returns:
a future containing the previous value overwritten

replaceAsync

public final NotifyingFuture<Boolean> replaceAsync(K key,
                                                   V oldValue,
                                                   V newValue,
                                                   long lifespan,
                                                   TimeUnit unit)
Description copied from interface: Cache
Asynchronous version of Cache.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 Cache.replace(Object, Object, Object, long, TimeUnit) if used in LOCAL mode.

Specified by:
replaceAsync in interface Cache<K,V>
Parameters:
key - key to remove
oldValue - value to overwrite
newValue - value to store
lifespan - lifespan of entry
unit - time unit for lifespan
Returns:
a future containing a boolean, indicating whether the entry was replaced or not

put

public final V put(K key,
                   V value,
                   long lifespan,
                   TimeUnit unit)
Description copied from interface: Cache
An overloaded form of Map.put(Object, Object), which takes in lifespan parameters.

Specified by:
put in interface Cache<K,V>
Parameters:
key - key to use
value - value to store
lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
unit - unit of measurement for the lifespan
Returns:
the value being replaced, or null if nothing is being replaced.

putIfAbsent

public final V putIfAbsent(K key,
                           V value,
                           long lifespan,
                           TimeUnit unit)
Description copied from interface: Cache
An overloaded form of ConcurrentMap.putIfAbsent(Object, Object), which takes in lifespan parameters.

Specified by:
putIfAbsent in interface Cache<K,V>
Parameters:
key - key to use
value - value to store
lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
unit - unit of measurement for the lifespan
Returns:
the value being replaced, or null if nothing is being replaced.

putAll

public final void putAll(Map<? extends K,? extends V> map,
                         long lifespan,
                         TimeUnit unit)
Description copied from interface: Cache
An overloaded form of Map.putAll(Map), which takes in lifespan parameters. Note that the lifespan is applied to all mappings in the map passed in.

Specified by:
putAll in interface Cache<K,V>
Parameters:
map - map containing mappings to enter
lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
unit - unit of measurement for the lifespan

replace

public final V replace(K key,
                       V value,
                       long lifespan,
                       TimeUnit unit)
Description copied from interface: Cache
An overloaded form of ConcurrentMap.replace(Object, Object), which takes in lifespan parameters.

Specified by:
replace in interface Cache<K,V>
Parameters:
key - key to use
value - value to store
lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
unit - unit of measurement for the lifespan
Returns:
the value being replaced, or null if nothing is being replaced.

replace

public final boolean replace(K key,
                             V oldValue,
                             V newValue)
Specified by:
replace in interface ConcurrentMap<K,V>

replace

public final V replace(K key,
                       V value)
Specified by:
replace in interface ConcurrentMap<K,V>

replace

public final boolean replace(K key,
                             V oldValue,
                             V value,
                             long lifespan,
                             TimeUnit unit)
Description copied from interface: Cache
An overloaded form of ConcurrentMap.replace(Object, Object, Object), which takes in lifespan parameters.

Specified by:
replace in interface Cache<K,V>
Parameters:
key - key to use
oldValue - value to replace
value - value to store
lifespan - lifespan of the entry. Negative values are interpreted as unlimited lifespan.
unit - unit of measurement for the lifespan
Returns:
true if the value was replaced, false otherwise

Google Analytics

Copyright © 2010 JBoss, a division of Red Hat. All Rights Reserved.