|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cache<K,V>
The central interface of Infinispan. A Cache provides a highly concurrent, optionally distributed data structure with additional features such as:
OutOfMemoryError
sCacheStore
, either when they are evicted as an overflow, or all the time, to maintain
persistent copies that would withstand server failure or restarts.ConcurrentMap
and implements all methods accordingly,
although methods like Map.keySet()
, Map.values()
and Map.entrySet()
are expensive
(prohibitively so when using a distributed cache) and frequent use of these methods is not recommended.
Also, like most ConcurrentMap
implementations, Cache does not support the use of
null keys (although null values are allowed).
Please see the Infinispan documentation for more details.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Method Summary | |
---|---|
void |
compact()
Method that releases object references of cached objects held in the cache by serializing them to byte buffers. |
void |
endBatch(boolean successful)
|
void |
evict(K key)
|
AdvancedCache<K,V> |
getAdvancedCache()
|
CacheManager |
getCacheManager()
Retrieves the cache manager responsible for creating this cache instance. |
Configuration |
getConfiguration()
|
String |
getName()
|
ComponentStatus |
getStatus()
|
String |
getVersion()
|
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> map,
long lifespan,
TimeUnit unit)
An overloaded form of Map.putAll(java.util.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(java.util.Map) , which takes in lifespan parameters. |
void |
putForExternalRead(K key,
V value)
Under special operating behavior, associates the value with the specified key. |
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. |
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 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. |
boolean |
startBatch()
|
Methods inherited from interface java.util.concurrent.ConcurrentMap |
---|
putIfAbsent, remove, replace, replace |
Methods inherited from interface java.util.Map |
---|
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values |
Methods inherited from interface org.infinispan.lifecycle.Lifecycle |
---|
start, stop |
Methods inherited from interface org.infinispan.notifications.Listenable |
---|
addListener, getListeners, removeListener |
Method Detail |
---|
void putForExternalRead(K key, V value)
ConcurrentMap.putIfAbsent(Object,
Object)
)
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.
IllegalStateException
- if getStatus()
would not return ComponentStatus.RUNNING
.void evict(K key)
Configuration getConfiguration()
boolean startBatch()
void endBatch(boolean successful)
String getName()
String getVersion()
CacheManager getCacheManager()
V put(K key, V value, long lifespan, TimeUnit unit)
Map.put(Object, Object)
, which takes in lifespan parameters.
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are intepreted as unlimited lifespan.unit
- unit of measurement for the lifespan
V putIfAbsent(K key, V value, long lifespan, TimeUnit unit)
ConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are intepreted as unlimited lifespan.unit
- unit of measurement for the lifespan
void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit)
Map.putAll(java.util.Map)
, which takes in lifespan parameters. Note that the lifespan
is applied to all mappings in the map passed in.
map
- map containing mappings to enterlifespan
- lifespan of the entry. Negative values are intepreted as unlimited lifespan.unit
- unit of measurement for the lifespanV replace(K key, V value, long lifespan, TimeUnit unit)
ConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are intepreted as unlimited lifespan.unit
- unit of measurement for the lifespan
boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit unit)
ConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.
key
- key to useoldValue
- value to replacevalue
- value to storelifespan
- lifespan of the entry. Negative values are intepreted as unlimited lifespan.unit
- unit of measurement for the lifespan
V put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
Map.put(Object, Object)
, which takes in lifespan parameters.
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are intepreted 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
V putIfAbsent(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
ConcurrentMap.putIfAbsent(Object, Object)
, which takes in lifespan parameters.
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are intepreted 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
void putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
Map.putAll(java.util.Map)
, which takes in lifespan parameters. Note that the lifespan
is applied to all mappings in the map passed in.
map
- map containing mappings to enterlifespan
- lifespan of the entry. Negative values are intepreted 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 timeV replace(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
ConcurrentMap.replace(Object, Object)
, which takes in lifespan parameters.
key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are intepreted 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
boolean replace(K key, V oldValue, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
ConcurrentMap.replace(Object, Object, Object)
, which takes in lifespan parameters.
key
- key to useoldValue
- value to replacevalue
- value to storelifespan
- lifespan of the entry. Negative values are intepreted 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
AdvancedCache<K,V> getAdvancedCache()
void compact()
ComponentStatus getStatus()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |