public interface BasicCache<K,V> extends AsyncCache<K,V>, ConcurrentMap<K,V>, Lifecycle
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.
Other methods such as Map.size()
provide an approximation-only, and should not be relied on for an accurate picture
as to the size of the entire, distributed cache. Remote nodes are not queried and in-fly transactions are not
taken into account, even if Map.size()
is invoked from within such a transaction.
Also, like many ConcurrentMap
implementations, BasicCache does not support the use of null keys or
values.
Modifier and Type | Method and Description |
---|---|
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.compute(Object, BiFunction) which takes in lifespan parameters. |
V |
compute(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.compute(Object, BiFunction) which takes in lifespan and maxIdleTime parameters. |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan parameters. |
V |
computeIfAbsent(K key,
Function<? super K,? extends V> mappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.computeIfAbsent(Object, Function) which takes in lifespan and maxIdleTime parameters. |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan parameters. |
V |
computeIfPresent(K key,
BiFunction<? super K,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.computeIfPresent(Object, BiFunction) which takes in lifespan and maxIdleTime parameters. |
String |
getName()
Retrieves the name of the cache
|
String |
getVersion()
Retrieves the version of Infinispan
|
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit)
An overloaded form of
ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters. |
V |
merge(K key,
V value,
BiFunction<? super V,? super V,? extends V> remappingFunction,
long lifespan,
TimeUnit lifespanUnit,
long maxIdleTime,
TimeUnit maxIdleTimeUnit)
An overloaded form of
ConcurrentMap.merge(Object, Object, BiFunction) which takes in lifespan parameters. |
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
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
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(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. |
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 |
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. |
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. |
clearAsync, computeAsync, computeAsync, computeAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfAbsentAsync, computeIfPresentAsync, computeIfPresentAsync, computeIfPresentAsync, containsKeyAsync, getAllAsync, getAsync, mergeAsync, mergeAsync, mergeAsync, putAllAsync, putAllAsync, putAllAsync, putAsync, putAsync, putAsync, putIfAbsentAsync, putIfAbsentAsync, putIfAbsentAsync, removeAsync, removeAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, replaceAsync, sizeAsync
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
String getName()
String getVersion()
V put(K key, V value)
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).V put(K key, V value, long lifespan, TimeUnit unit)
put(Object, Object)
, which takes in lifespan parameters.key
- key to usevalue
- value to storelifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanV 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 interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanvoid putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit unit)
Map.putAll(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 interpreted 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 interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanboolean 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 interpreted as unlimited lifespan.unit
- unit of measurement for the lifespanV put(K key, V value, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
put(Object, Object)
, which takes in lifespan parameters.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 timeV 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 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 timevoid putAll(Map<? extends K,? extends V> map, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
Map.putAll(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 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 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 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 timeboolean 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 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 timeV merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
ConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.key
- key to usevalue
- new value to merge with existing valueremappingFunction
- function to use to merge new and existing values into a merged value to store under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanV merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
ConcurrentMap.merge(Object, Object, BiFunction)
which takes in lifespan parameters.key
- key to usevalue
- new value to merge with existing valueremappingFunction
- function to use to merge new and existing values into a merged value to store under keylifespan
- 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 timeV compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
ConcurrentMap.compute(Object, BiFunction)
which takes in lifespan parameters.key
- key to useremappingFunction
- function to use to compute and store the value under keylifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanV compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
ConcurrentMap.compute(Object, BiFunction)
which takes in lifespan and maxIdleTime parameters.key
- key to useremappingFunction
- function to use to compute and store the value under keylifespan
- 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 timeV computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit)
ConcurrentMap.computeIfPresent(Object, BiFunction)
which takes in lifespan parameters.key
- key to useremappingFunction
- function to use to compute and store the value under key, if such existslifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanV computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
ConcurrentMap.computeIfPresent(Object, BiFunction)
which takes in lifespan and maxIdleTime parameters.key
- key to useremappingFunction
- function to use to compute and store the value under key, if such existslifespan
- 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 timeV computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit)
ConcurrentMap.computeIfAbsent(Object, Function)
which takes in lifespan parameters.key
- key to usemappingFunction
- function to use to compute and store the value under key, if the key is absentlifespan
- lifespan of the entry. Negative values are interpreted as unlimited lifespan.lifespanUnit
- time unit for lifespanV computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction, long lifespan, TimeUnit lifespanUnit, long maxIdleTime, TimeUnit maxIdleTimeUnit)
ConcurrentMap.computeIfAbsent(Object, Function)
which takes in lifespan and maxIdleTime parameters.key
- key to usemappingFunction
- function to use to compute and store the value under key, if the key is absentlifespan
- 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 timeV remove(Object key)
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).Copyright © 2021 JBoss by Red Hat. All rights reserved.