K
- Cache key type.V
- Cache value type.public interface IgniteCache<K,V> extends javax.cache.Cache<K,V>, IgniteAsyncSupport
Ignite.cache(String)
method.
Cache
API which contains JCache (JSR107)
cache functionality
and documentation. In addition to Cache
functionality this API provides:
JCache
API.loadCache(IgniteBiPredicate, Object...)
method.
lock(Object)
methods.query(Query)
method.rebalance()
methopd
(in case if delayed rebalancing was configured.)get(...)
from cache
via localPeek(Object, CachePeekMode...)
methodsinvoke(Object, CacheEntryProcessor, Object...)
methods.IgniteTransactions
for more information.
TransactionException
for more information.Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
clear(K key)
Clears entry from the cache and swap storage, without notifying listeners or
CacheWriter s. |
void |
clearAll(Set<? extends K> keys)
Clears entries from the cache and swap storage, without notifying listeners or
CacheWriter s. |
IgniteFuture<Void> |
clearAllAsync(Set<? extends K> keys)
Asynchronously clears entries from the cache and swap storage, without notifying listeners or
CacheWriter s. |
IgniteFuture<Void> |
clearAsync()
Asynchronously clears the contents of the cache, without notifying listeners or
CacheWriter s. |
IgniteFuture<Void> |
clearAsync(K key)
Asynchronously clears entry from the cache and swap storage, without notifying listeners or
CacheWriter s. |
void |
clearStatistics()
Clear cluster statistics for this cache.
|
void |
close()
Closes this cache instance.
|
boolean |
containsKey(K key) |
IgniteFuture<Boolean> |
containsKeyAsync(K key)
Asynchronously determines if the
Cache contains an entry for the specified key. |
boolean |
containsKeys(Set<? extends K> keys)
Determines if the
Cache contains entries for the specified keys. |
IgniteFuture<Boolean> |
containsKeysAsync(Set<? extends K> keys)
Asynchronously determines if the
Cache contains entries for the specified keys. |
void |
destroy()
Completely deletes the cache with all its data from the system on all cluster nodes.
|
void |
enableStatistics(boolean enabled)
Sets statistics enabled flag cluster wide for this cache.
|
V |
get(K key) |
Map<K,V> |
getAll(Set<? extends K> keys) |
IgniteFuture<Map<K,V>> |
getAllAsync(Set<? extends K> keys)
Asynchronously gets a collection of entries from the
Cache , returning them as
Map of the values associated with the set of keys requested. |
Map<K,V> |
getAllOutTx(Set<? extends K> keys)
Gets values from cache.
|
IgniteFuture<Map<K,V>> |
getAllOutTxAsync(Set<? extends K> keys)
Asynchronously gets values from cache.
|
V |
getAndPut(K key,
V val) |
IgniteFuture<V> |
getAndPutAsync(K key,
V val)
Asynchronously associates the specified value with the specified key in this cache,
returning an existing value if one existed as the future result.
|
V |
getAndPutIfAbsent(K key,
V val)
Stores given key-value pair in cache only if cache had no previous mapping for it.
|
IgniteFuture<V> |
getAndPutIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
V |
getAndRemove(K key) |
IgniteFuture<V> |
getAndRemoveAsync(K key)
Asynchronously removes the entry for a key only if currently mapped to some
value.
|
V |
getAndReplace(K key,
V val) |
IgniteFuture<V> |
getAndReplaceAsync(K key,
V val)
Asynchronously replaces the value for a given key if and only if there is a
value currently mapped by the key.
|
IgniteFuture<V> |
getAsync(K key)
Asynchronously gets an entry from the cache.
|
<C extends javax.cache.configuration.Configuration<K,V>> |
getConfiguration(Class<C> clazz) |
Collection<CacheEntry<K,V>> |
getEntries(Set<? extends K> keys)
Gets a collection of entries from the
Cache . |
IgniteFuture<Collection<CacheEntry<K,V>>> |
getEntriesAsync(Set<? extends K> keys)
Asynchronously gets a collection of entries from the
Cache . |
CacheEntry<K,V> |
getEntry(K key)
Gets an entry from the cache.
|
IgniteFuture<CacheEntry<K,V>> |
getEntryAsync(K key)
Asynchronously gets an entry from the cache.
|
IgniteFuture<?> |
indexReadyFuture()
Returns future that will be completed when all indexes for this cache are ready to use.
|
<T> T |
invoke(K key,
CacheEntryProcessor<K,V,T> entryProcessor,
Object... arguments)
Invokes an
CacheEntryProcessor against the Cache.Entry specified by
the provided key. |
<T> T |
invoke(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments)
Please refer to documentation for
CacheAtomicityMode.ATOMIC for information on
system behavior in crash scenarios for atomic caches. |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
Object... args)
Asynchronously invokes each
EntryProcessor from map's values against the correspondent
Cache.Entry specified by map's key set. |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Set<? extends K> keys,
CacheEntryProcessor<K,V,T> entryProcessor,
Object... args)
Invokes an
CacheEntryProcessor against the set of Cache.Entry s
specified by the set of keys. |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Set<? extends K> keys,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args)
Please refer to documentation for
CacheAtomicityMode.ATOMIC for information on
system behavior in crash scenarios for atomic caches. |
<T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> |
invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
Object... args)
Asynchronous version of the
invokeAll(Map, Object...) method. |
<T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> |
invokeAllAsync(Set<? extends K> keys,
CacheEntryProcessor<K,V,T> entryProcessor,
Object... args)
Asynchronously invokes an
CacheEntryProcessor against the set of Cache.Entry s
specified by the set of keys. |
<T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> |
invokeAllAsync(Set<? extends K> keys,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args)
Asynchronously invokes an
EntryProcessor against the set of Cache.Entry s
specified by the set of keys. |
<T> IgniteFuture<T> |
invokeAsync(K key,
CacheEntryProcessor<K,V,T> entryProcessor,
Object... arguments)
Asynchronously invokes an
CacheEntryProcessor against the Cache.Entry specified by
the provided key. |
<T> IgniteFuture<T> |
invokeAsync(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... arguments)
Asynchronously invokes an
EntryProcessor against the Cache.Entry specified by
the provided key. |
boolean |
isLocalLocked(K key,
boolean byCurrThread)
Checks if specified key is locked.
|
void |
loadCache(@Nullable IgniteBiPredicate<K,V> p,
Object... args)
Executes
localLoadCache(IgniteBiPredicate, Object...) on all cache nodes. |
IgniteFuture<Void> |
loadCacheAsync(@Nullable IgniteBiPredicate<K,V> p,
Object... args)
Asynchronously executes
localLoadCache(IgniteBiPredicate, Object...) on all cache nodes. |
void |
localClear(K key)
Clears entry from the cache and swap storage, without notifying listeners or
CacheWriter s. |
void |
localClearAll(Set<? extends K> keys)
Clears entries from the cache and swap storage, without notifying listeners or
CacheWriter s. |
Iterable<javax.cache.Cache.Entry<K,V>> |
localEntries(CachePeekMode... peekModes)
Allows for iteration over local cache entries.
|
void |
localEvict(Collection<? extends K> keys)
Attempts to evict all entries associated with keys.
|
void |
localLoadCache(@Nullable IgniteBiPredicate<K,V> p,
Object... args)
Delegates to
CacheStore.loadCache(IgniteBiInClosure,Object...) method
to load state from the underlying persistent storage. |
IgniteFuture<Void> |
localLoadCacheAsync(@Nullable IgniteBiPredicate<K,V> p,
Object... args)
Asynchronously loads state from the underlying persistent storage by delegating
to
CacheStore.loadCache(IgniteBiInClosure,Object...) method. |
CacheMetrics |
localMetrics()
Gets local snapshot metrics (statistics) for this cache.
|
V |
localPeek(K key,
CachePeekMode... peekModes)
Peeks at a value in the local storage using an optional peek mode.
|
boolean |
localPreloadPartition(int partition)
Efficiently preloads cache partition into page memory if it exists on the local node.
|
int |
localSize(CachePeekMode... peekModes)
Gets the number of all entries cached on this node.
|
long |
localSizeLong(CachePeekMode... peekModes)
Gets the number of all entries cached on this node as a long value.
|
long |
localSizeLong(int partition,
CachePeekMode... peekModes)
Gets the number of all entries cached on this node for the partition as a long value.
|
Lock |
lock(K key)
Creates a
Lock instance associated with passed key. |
Lock |
lockAll(Collection<? extends K> keys)
Deprecated.
It is recommended to use
Ignite.reentrantLock(String, boolean, boolean, boolean) instead.
This method will be removed in future releases. |
Collection<Integer> |
lostPartitions()
Gets a collection of lost partition IDs.
|
CacheMetrics |
metrics()
Gets whole cluster snapshot metrics (statistics) for this cache.
|
CacheMetrics |
metrics(ClusterGroup grp)
Gets cluster group snapshot metrics for caches in cluster group.
|
void |
preloadPartition(int partition)
Efficiently preloads cache primary partition into page memory.
|
IgniteFuture<Void> |
preloadPartitionAsync(int partition)
Efficiently preloads cache partition into page memory.
|
void |
put(K key,
V val) |
void |
putAll(Map<? extends K,? extends V> map)
Keys are locked in the order in which they appear in map.
|
IgniteFuture<Void> |
putAllAsync(Map<? extends K,? extends V> map)
Asynchronously copies all of the entries from the specified map to the
Cache . |
IgniteFuture<Void> |
putAsync(K key,
V val)
Asynchronously associates the specified value with the specified key in the cache.
|
boolean |
putIfAbsent(K key,
V val)
For
CacheAtomicityMode.ATOMIC return
value on primary node crash may be incorrect because of the automatic retries. |
IgniteFuture<Boolean> |
putIfAbsentAsync(K key,
V val)
Asynchronously associates the specified key with the given value if it is
not already associated with a value.
|
<R> QueryCursor<R> |
query(Query<R> qry)
Queries cache.
|
<T,R> QueryCursor<R> |
query(Query<T> qry,
IgniteClosure<T,R> transformer)
Queries the cache transforming the entries on the server nodes.
|
FieldsQueryCursor<List<?>> |
query(SqlFieldsQuery qry)
Queries cache.
|
Collection<? extends QueryDetailMetrics> |
queryDetailMetrics()
Gets query detail metrics.
|
QueryMetrics |
queryMetrics()
Gets query metrics.
|
IgniteFuture<Boolean> |
rebalance()
Deprecated.
Use baseline topology feature instead. Please, be aware this API will be removed in the next releases.
|
boolean |
remove(K key) |
boolean |
remove(K key,
V oldVal)
For
CacheAtomicityMode.ATOMIC return
value on primary node crash may be incorrect because of the automatic retries. |
void |
removeAll()
Removes all of the mappings from this cache.
|
void |
removeAll(Set<? extends K> keys)
Keys are locked in the order in which they appear in key set.
|
IgniteFuture<Void> |
removeAllAsync()
Asynchronously removes all of the mappings from this cache.
|
IgniteFuture<Void> |
removeAllAsync(Set<? extends K> keys)
Asynchronously removes entries for the specified keys.
|
IgniteFuture<Boolean> |
removeAsync(K key)
Asynchronously removes the mapping for a key from this cache if it is present.
|
IgniteFuture<Boolean> |
removeAsync(K key,
V oldVal)
Asynchronously removes the mapping for a key only if currently mapped to the
given value.
|
boolean |
replace(K key,
V val) |
boolean |
replace(K key,
V oldVal,
V newVal)
For
CacheAtomicityMode.ATOMIC return
value on primary node crash may be incorrect because of the automatic retries. |
IgniteFuture<Boolean> |
replaceAsync(K key,
V val)
Asynchronously replaces the entry for a key only if currently mapped to a
given value.
|
IgniteFuture<Boolean> |
replaceAsync(K key,
V oldVal,
V newVal)
Asynchronous version of the
replace(Object, Object, Object) . |
void |
resetQueryDetailMetrics()
Reset query detail metrics.
|
void |
resetQueryMetrics()
Reset query metrics.
|
int |
size(CachePeekMode... peekModes)
Gets the number of all entries cached across all nodes.
|
IgniteFuture<Integer> |
sizeAsync(CachePeekMode... peekModes)
Asynchronously gets the number of all entries cached across all nodes.
|
long |
sizeLong(CachePeekMode... peekModes)
Gets the number of all entries cached across all nodes as a long value.
|
long |
sizeLong(int partition,
CachePeekMode... peekModes)
Gets the number of all entries cached in a partition as a long value.
|
IgniteFuture<Long> |
sizeLongAsync(CachePeekMode... peekModes)
Asynchronously gets the number of all entries cached across all nodes as a long value.
|
IgniteFuture<Long> |
sizeLongAsync(int partition,
CachePeekMode... peekModes)
Asynchronously gets the number of all entries cached in a partition as a long value.
|
IgniteCache<K,V> |
withAsync()
Deprecated.
|
IgniteCache<K,V> |
withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc)
Returns cache with the specified expired policy set.
|
<K1,V1> IgniteCache<K1,V1> |
withKeepBinary()
Returns cache that will operate with binary objects.
|
IgniteCache<K,V> |
withNoRetries() |
IgniteCache<K,V> |
withPartitionRecover()
Gets an instance of
IgniteCache that will be allowed to execute cache read operations
regardless of partition loss policy. |
IgniteCache<K,V> |
withReadRepair(ReadRepairStrategy strategy)
This is an experimental API.
|
IgniteCache<K,V> |
withSkipStore() |
deregisterCacheEntryListener, getCacheManager, getName, isClosed, iterator, loadAll, registerCacheEntryListener, unwrap
forEach, spliterator
future, isAsync
@Deprecated IgniteCache<K,V> withAsync()
withAsync
in interface IgniteAsyncSupport
<C extends javax.cache.configuration.Configuration<K,V>> C getConfiguration(Class<C> clazz)
IgniteCache<K,V> withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc)
This method does not modify existing cache instance.
plc
- Expire policy to use.IgniteCache<K,V> withSkipStore()
IgniteCache<K,V> withNoRetries()
IgniteCache<K,V> withPartitionRecover()
IgniteCache
that will be allowed to execute cache read operations
regardless of partition loss policy.IgniteCache<K,V> withReadRepair(ReadRepairStrategy strategy)
Gets an instance of IgniteCache
that will perform backup nodes check on each get attempt.
Read Repair means that each backup node will be checked to have the same entry as the primary node has.
In case consistency violations were found, the values across the topology will be replaced by repaired values
according to the chosen strategy, see ReadRepairStrategy
for the details.
A consistency violation exception will be thrown when the repair is impossible.
CacheConsistencyViolationEvent
will be recorded for each violation in case it's configured as recordable.
TransactionConcurrency.OPTIMISTIC
concurrency mode
or TransactionIsolation.READ_COMMITTED
isolation level,TransactionConcurrency.PESSIMISTIC
concurrency mode
and isolation level other than TransactionIsolation.READ_COMMITTED
This proxy usage does not guarantee "all copies check" in case the value have been already cached inside the transaction. In case you don't use a READ_COMMITTED isolation mode and already have a cached value, for example have already read the value or performed a write, you'll just get the cached value.
Warning:
Due to the nature of an atomic cache, false-positive results can be observed. For example, an attempt to check
consistency under cache's loading may lead to a consistency violation exception. By default, the implementation tries
to check the given key three times. The number of attempts can be changed using
IgniteSystemProperties.IGNITE_NEAR_GET_MAX_REMAPS
property.
Full list of repairable methods:
containsKey(K)
&& containsKeyAsync(K)
containsKeys(java.util.Set<? extends K>)
&& containsKeysAsync(java.util.Set<? extends K>)
getEntry(K)
&& getEntryAsync(K)
getEntries(java.util.Set<? extends K>)
&& getEntriesAsync(java.util.Set<? extends K>)
get(K)
&& getAsync(K)
getAll(java.util.Set<? extends K>)
&& getAllAsync(java.util.Set<? extends K>)
strategy
- Read Repair strategy.<K1,V1> IgniteCache<K1,V1> withKeepBinary()
Cache returned by this method will not be forced to deserialize binary objects, so keys and values will be returned from cache API methods without changes. Therefore, signature of the cache can contain only following types:
org.apache.ignite.binary.BinaryObject
for binary classesString
and array of String
sUUID
and array of UUID
sDate
and array of Date
sTimestamp
and array of Timestamp
s
For example, if you use Integer
as a key and Value
class as a value
(which will be stored in binary format), you should acquire following projection
to avoid deserialization:
IgniteCacheprj = cache.withKeepBinary(); // Value is not deserialized and returned in binary format. BinaryObject po = prj.get(1);
Note that this method makes sense only if cache is working in binary mode if default marshaller is used. If not, this method is no-op and will return current cache.
V1
- Type of the cache value binary objects.K1
- Type of the cache key.@IgniteAsyncSupported void loadCache(@Nullable @Nullable IgniteBiPredicate<K,V> p, @Nullable Object... args) throws javax.cache.CacheException
localLoadCache(IgniteBiPredicate, Object...)
on all cache nodes.p
- Optional predicate (may be null
). If provided, will be used to
filter values loaded from storage before they are put into cache.args
- Optional user arguments to be passed into
CacheStore.loadCache(IgniteBiInClosure, Object...)
method.javax.cache.CacheException
- If loading failed.IgniteFuture<Void> loadCacheAsync(@Nullable @Nullable IgniteBiPredicate<K,V> p, @Nullable Object... args) throws javax.cache.CacheException
localLoadCache(IgniteBiPredicate, Object...)
on all cache nodes.p
- Optional predicate (may be null
). If provided, will be used to
filter values loaded from storage before they are put into cache.args
- Optional user arguments to be passed into
CacheStore.loadCache(IgniteBiInClosure, Object...)
method.javax.cache.CacheException
- If loading failed.@IgniteAsyncSupported void localLoadCache(@Nullable @Nullable IgniteBiPredicate<K,V> p, @Nullable Object... args) throws javax.cache.CacheException
CacheStore.loadCache(IgniteBiInClosure,Object...)
method
to load state from the underlying persistent storage. The loaded values
will then be given to the optionally passed in predicate, and, if the predicate returns
true
, will be stored in cache. If predicate is null
, then
all loaded values will be stored in cache.
Note that this method does not receive keys as a parameter, so it is up to
CacheStore
implementation to provide all the data to be loaded.
This method is not transactional and may end up loading a stale value into cache if another thread has updated the value immediately after it has been loaded. It is mostly useful when pre-loading the cache from underlying data store before start, or for read-only caches.
p
- Optional predicate (may be null
). If provided, will be used to
filter values to be put into cache.args
- Optional user arguments to be passed into
CacheStore.loadCache(IgniteBiInClosure, Object...)
method.javax.cache.CacheException
- If loading failed.IgniteFuture<Void> localLoadCacheAsync(@Nullable @Nullable IgniteBiPredicate<K,V> p, @Nullable Object... args) throws javax.cache.CacheException
CacheStore.loadCache(IgniteBiInClosure,Object...)
method. The loaded values
will then be given to the optionally passed in predicate, and, if the predicate returns
true
, will be stored in cache. If predicate is null
, then
all loaded values will be stored in cache.
Note that this method does not receive keys as a parameter, so it is up to
CacheStore
implementation to provide all the data to be loaded.
This method is not transactional and may end up loading a stale value into cache if another thread has updated the value immediately after it has been loaded. It is mostly useful when pre-loading the cache from underlying data store before start, or for read-only caches.
p
- Optional predicate (may be null
). If provided, will be used to
filter values to be put into cache.args
- Optional user arguments to be passed into
CacheStore.loadCache(IgniteBiInClosure, Object...)
method.javax.cache.CacheException
- If loading failed.@IgniteAsyncSupported V getAndPutIfAbsent(K key, V val) throws javax.cache.CacheException, TransactionException
CacheMode.PARTITIONED
or CacheMode.REPLICATED
caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheLoader.load(Object)
method will be used.
If the returned value is not needed, method putIfAbsent(Object, Object)
should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheWriter.write(javax.cache.Cache.Entry)
method.
key
- Key to store in cache.val
- Value to be associated with the given key.null
if there was no
previous value).NullPointerException
- If either key or value are null
.javax.cache.CacheException
- If put operation failed.TransactionException
- If operation within transaction is failed.IgniteFuture<V> getAndPutIfAbsentAsync(K key, V val) throws javax.cache.CacheException, TransactionException
CacheMode.PARTITIONED
or CacheMode.REPLICATED
caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheLoader.load(Object)
method will be used.
If the returned value is not needed, method putIfAbsentAsync(Object, Object)
should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheWriter.write(javax.cache.Cache.Entry)
method.
key
- Key to store in cache.val
- Value to be associated with the given key.NullPointerException
- If either key or value are null
.javax.cache.CacheException
- If put operation failed.TransactionException
- If operation within transaction is failed.Lock lock(K key)
Lock
instance associated with passed key.
This method does not acquire lock immediately, you have to call appropriate method on returned instance.
Returned lock does not support Lock.newCondition()
method,
other methods defined in Lock
are supported.key
- Key for lock.Lock.lock()
,
Lock.tryLock(long, TimeUnit)
Lock lockAll(Collection<? extends K> keys)
Ignite.reentrantLock(String, boolean, boolean, boolean)
instead.
This method will be removed in future releases.Lock
instance associated with passed keys.
This method does not acquire lock immediately, you have to call appropriate method on returned instance.
Returned lock does not support Lock.newCondition()
method,
other methods defined in Lock
are supported.keys
- Keys for lock.Lock.lock()
,
Lock.tryLock(long, TimeUnit)
boolean isLocalLocked(K key, boolean byCurrThread)
This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
key
- Key to check.byCurrThread
- If true
method will check that current thread owns a lock on this key, otherwise
will check that any thread on any node owns a lock on this key.True
if lock is owned by some node.<R> QueryCursor<R> query(Query<R> qry)
Query
interface.
See also query(SqlFieldsQuery)
.R
- Type of the query result.qry
- Query.ScanQuery
,
SqlFieldsQuery
,
TextQuery
,
SpiQuery
FieldsQueryCursor<List<?>> query(SqlFieldsQuery qry)
SqlFieldsQuery
class.qry
- SqlFieldsQuery.SqlFieldsQuery
<T,R> QueryCursor<R> query(Query<T> qry, IgniteClosure<T,R> transformer)
Currently transformers are supported ONLY for ScanQuery
. Passing any other
subclass of Query
interface to this method will end up with
UnsupportedOperationException
.
T
- Type of the initial query result.R
- Type of the transformed query result.qry
- Query.transformer
- Transformer.Iterable<javax.cache.Cache.Entry<K,V>> localEntries(CachePeekMode... peekModes) throws javax.cache.CacheException
peekModes
- Peek modes.javax.cache.CacheException
- If failed.QueryMetrics queryMetrics()
void resetQueryMetrics()
Collection<? extends QueryDetailMetrics> queryDetailMetrics()
CacheConfiguration.setQueryDetailMetricsSize(int)
method.void resetQueryDetailMetrics()
void localEvict(Collection<? extends K> keys)
keys
- Keys to evict.V localPeek(K key, CachePeekMode... peekModes)
This method will not load a value from the configured CacheStore
or from a remote node.
key
- Entry key.peekModes
- Peek modes.null
if not found.NullPointerException
- If key is null
.@IgniteAsyncSupported int size(CachePeekMode... peekModes) throws javax.cache.CacheException
peekModes
value isn't defined,
only size of primary copies across all nodes will be returned. This behavior is identical to calling
this method with CachePeekMode.PRIMARY
peek mode.
NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
peekModes
- Optional peek modes. If not provided, then total cache size is returned.javax.cache.CacheException
- On error.IgniteFuture<Integer> sizeAsync(CachePeekMode... peekModes) throws javax.cache.CacheException
peekModes
value isn't defined, only size of primary copies across all nodes will be returned.
This behavior is identical to calling this method with CachePeekMode.PRIMARY
peek mode.
NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
peekModes
- Optional peek modes. If not provided, then total cache size is returned.javax.cache.CacheException
- On error.@IgniteAsyncSupported long sizeLong(CachePeekMode... peekModes) throws javax.cache.CacheException
peekModes
value
isn't defined, only size of primary copies across all nodes will be returned. This behavior is identical to
calling this method with CachePeekMode.PRIMARY
peek mode.
NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
peekModes
- Optional peek modes. If not provided, then total cache size is returned.javax.cache.CacheException
- On error.IgniteFuture<Long> sizeLongAsync(CachePeekMode... peekModes) throws javax.cache.CacheException
peekModes
value isn't defined, only size of primary copies across all nodes will be returned.
This behavior is identical to calling this method with CachePeekMode.PRIMARY
peek mode.
NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
peekModes
- Optional peek modes. If not provided, then total cache size is returned.javax.cache.CacheException
- On error.@IgniteAsyncSupported long sizeLong(int partition, CachePeekMode... peekModes) throws javax.cache.CacheException
peekModes
value
isn't defined, only size of primary copies across all nodes will be returned. This behavior is identical to
calling this method with CachePeekMode.PRIMARY
peek mode.
NOTE: this operation is distributed and will query all participating nodes for their partition cache sizes.
partition
- partition.peekModes
- Optional peek modes. If not provided, then total partition cache size is returned.javax.cache.CacheException
- On error.IgniteFuture<Long> sizeLongAsync(int partition, CachePeekMode... peekModes) throws javax.cache.CacheException
peekModes
value
isn't defined, only size of primary copies across all nodes will be returned. This behavior is identical to
calling this method with CachePeekMode.PRIMARY
peek mode.
NOTE: this operation is distributed and will query all participating nodes for their partition cache sizes.
partition
- partition.peekModes
- Optional peek modes. If not provided, then total partition cache size is returned.javax.cache.CacheException
- On error.int localSize(CachePeekMode... peekModes)
peekModes
value isn't defined,
only size of primary copies will be returned. This behavior is identical to calling this method with
CachePeekMode.PRIMARY
peek mode.peekModes
- Optional peek modes. If not provided, then total cache size is returned.long localSizeLong(CachePeekMode... peekModes)
peekModes
value isn't
defined, only size of primary copies will be returned. This behavior is identical to calling this method with
CachePeekMode.PRIMARY
peek mode.peekModes
- Optional peek modes. If not provided, then total cache size is returned.long localSizeLong(int partition, CachePeekMode... peekModes)
peekModes
value isn't
defined, only size of primary copies will be returned. This behavior is identical to calling this method with
CachePeekMode.PRIMARY
peek mode.partition
- partition.peekModes
- Optional peek modes. If not provided, then total cache size is returned.@IgniteAsyncSupported <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args) throws TransactionException
EntryProcessor
from map's values against the correspondent
Cache.Entry
specified by map's key set.
If an Cache.Entry
does not exist for the specified key, an attempt is made
to load it (if a loader is configured) or a surrogate Cache.Entry
,
consisting of the key and a value of null is provided.
The order that the entries for the keys are processed is undefined.
Implementations may choose to process the entries in any order, including
concurrently. Furthermore there is no guarantee implementations will
use the same EntryProcessor
instance to process each entry, as
the case may be in a non-local cache topology.
The result of executing the EntryProcessor
is returned in the future as a
Map
of EntryProcessorResult
s, one result per key. Should the
EntryProcessor
or Caching implementation throw an exception, the
exception is wrapped and re-thrown when a call to
EntryProcessorResult.get()
is made.
Please refer to documentation for CacheAtomicityMode.ATOMIC
for information on
system behavior in crash scenarios for atomic caches.
Keys are locked in the order in which they appear in map. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeMap
. Using unordered map,
such as HashMap
, while calling this method in parallel will lead to deadlock.
T
- Type of the cache entry processing result.map
- Map containing keys and entry processors to be applied to values.args
- Additional arguments to pass to the EntryProcessor
.EntryProcessorResult
s of the processing per key,
if any, defined by the EntryProcessor
implementation. No mappings
will be returned for EntryProcessor
s that return a
null
value for a key.TransactionException
- If operation within transaction is failed.<T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args) throws TransactionException
invokeAll(Map, Object...)
method.T
- Type of the cache entry processing result.map
- Map containing keys and entry processors to be applied to values.args
- Additional arguments to pass to the EntryProcessor
.invokeAll(Map, Object...)
.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported V get(K key) throws TransactionException
get
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<V> getAsync(K key)
If the cache is configured to use read-through, and a future result would be null
because the entry is missing from the cache, the Cache's CacheLoader
is called in an attempt to load the entry.
key
- Key.@IgniteAsyncSupported CacheEntry<K,V> getEntry(K key) throws TransactionException
If the cache is configured to use read-through, and get would return null
because the entry is missing from the cache, the Cache's CacheLoader
is called in an attempt to load the entry.
key
- The key whose associated value is to be returned.IllegalStateException
- If the cache is Cache.isClosed()
.NullPointerException
- If the key is null
.javax.cache.CacheException
- If there is a problem fetching the value.ClassCastException
- If the implementation is configured to perform
runtime-type-checking, and the key or value types are incompatible with those that have been
configured for the Cache
.TransactionException
- If operation within transaction is failed.IgniteFuture<CacheEntry<K,V>> getEntryAsync(K key) throws TransactionException
If the cache is configured to use read-through, and a future result would be null
because the entry is missing from the cache, the Cache's CacheLoader
is called in an attempt to load the entry.
key
- The key whose associated value is to be returned.IllegalStateException
- If the cache is Cache.isClosed()
.NullPointerException
- If the key is null
.javax.cache.CacheException
- If there is a problem fetching the value.ClassCastException
- If the implementation is configured to perform
runtime-type-checking, and the key or value types are incompatible with those that have been
configured for the Cache
.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported Map<K,V> getAll(Set<? extends K> keys) throws TransactionException
getAll
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Map<K,V>> getAllAsync(Set<? extends K> keys) throws TransactionException
Cache
, returning them as
Map
of the values associated with the set of keys requested.
If the cache is configured read-through, and a future result for a key would
be null because an entry is missing from the cache, the Cache's
CacheLoader
is called in an attempt to load the entry. If an
entry cannot be loaded for a given key, the key will not be present in
the returned Map.
keys
- Keys set.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported Collection<CacheEntry<K,V>> getEntries(Set<? extends K> keys) throws TransactionException
Cache
.
If the cache is configured read-through, and a get for a key would
return null because an entry is missing from the cache, the Cache's
CacheLoader
is called in an attempt to load the entry. If an
entry cannot be loaded for a given key, the key will not be present in
the returned Collection.
keys
- The keys whose associated values are to be returned.NullPointerException
- If keys is null or if keys contains a null
.IllegalStateException
- If the cache is Cache.isClosed()
.javax.cache.CacheException
- If there is a problem fetching the values.ClassCastException
- If the implementation is configured to perform
runtime-type-checking, and the key or value types are incompatible with those that have been
configured for the Cache
.TransactionException
- If operation within transaction is failed.IgniteFuture<Collection<CacheEntry<K,V>>> getEntriesAsync(Set<? extends K> keys) throws TransactionException
Cache
.
If the cache is configured read-through, and a future result for a key would
be null because an entry is missing from the cache, the Cache's
CacheLoader
is called in an attempt to load the entry. If an
entry cannot be loaded for a given key, the key will not be present in
the returned Collection.
keys
- The keys whose associated values are to be returned.NullPointerException
- If keys is null or if keys contains a null
.IllegalStateException
- If the cache is Cache.isClosed()
.javax.cache.CacheException
- If there is a problem fetching the values.ClassCastException
- If the implementation is configured to perform
runtime-type-checking, and the key or value types are incompatible with those that have been
configured for the Cache
.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported Map<K,V> getAllOutTx(Set<? extends K> keys)
keys
- The keys whose associated values are to be returned.IgniteFuture<Map<K,V>> getAllOutTxAsync(Set<? extends K> keys)
keys
- The keys whose associated values are to be returned.@IgniteAsyncSupported boolean containsKey(K key) throws TransactionException
containsKey
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Boolean> containsKeyAsync(K key) throws TransactionException
Cache
contains an entry for the specified key.
More formally, future result is true if and only if this cache contains a mapping for a key k such that key.equals(k). (There can be at most one such mapping.)
key
- Key.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported boolean containsKeys(Set<? extends K> keys) throws TransactionException
Cache
contains entries for the specified keys.keys
- Key whose presence in this cache is to be tested.True
if this cache contains a mapping for the specified keys.TransactionException
- If operation within transaction is failed.IgniteFuture<Boolean> containsKeysAsync(Set<? extends K> keys) throws TransactionException
Cache
contains entries for the specified keys.keys
- Key whose presence in this cache is to be tested.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported void put(K key, V val) throws TransactionException
put
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Void> putAsync(K key, V val) throws TransactionException
If the Cache
previously contained a mapping for the key, the old
value is replaced by the specified value. (A cache c is said to
contain a mapping for a key k if and only if c.containsKey(k)
would return true.)
key
- Key.val
- Value.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported V getAndPut(K key, V val) throws TransactionException
getAndPut
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<V> getAndPutAsync(K key, V val) throws TransactionException
If the cache previously contained a mapping for
the key, the old value is replaced by the specified value. (A cache
c is said to contain a mapping for a key k if and only
if c.containsKey(k)
would return
true.)
The previous value is returned as the future result, or future result is null if there was no value associated with the key previously.
key
- Key.val
- Value.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported void putAll(Map<? extends K,? extends V> map) throws TransactionException
Keys are locked in the order in which they appear in map. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeMap
. Using unordered map,
such as HashMap
, while calling this method in parallel will lead to deadlock.
putAll
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Void> putAllAsync(Map<? extends K,? extends V> map) throws TransactionException
Cache
.
The effect of this call is equivalent to that of calling
putAsync(Object, Object)
putAsync(k, v)} on this cache once for each mapping
from key k to value v in the specified map.
The order in which the individual puts occur is undefined.
The behavior of this operation is undefined if entries in the cache corresponding to entries in the map are modified or removed while this operation is in progress. or if map is modified while the operation is in progress.
In Default Consistency mode, individual puts occur atomically but not the entire putAll. Listeners may observe individual updates.
Keys are locked in the order in which they appear in map. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeMap
. Using unordered map,
such as HashMap
, while calling this method in parallel will lead to deadlock.
map
- Map containing keys and values to put into the cache.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported boolean putIfAbsent(K key, V val) throws TransactionException
For CacheAtomicityMode.ATOMIC
return
value on primary node crash may be incorrect because of the automatic retries. It is recommended
to disable retries with withNoRetries()
and manually restore primary-backup
consistency in case of update failure.
putIfAbsent
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Boolean> putIfAbsentAsync(K key, V val)
For CacheAtomicityMode.ATOMIC
return
value on primary node crash may be incorrect because of the automatic retries. It is recommended
to disable retries with withNoRetries()
and manually restore primary-backup
consistency in case of update failure.
key
- Key.val
- Value.TransactionTimeoutException
- If operation performs within transaction and timeout occurred.TransactionRollbackException
- If operation performs within transaction that automatically rolled back.TransactionHeuristicException
- If operation performs within transaction that entered an unknown state.@IgniteAsyncSupported boolean remove(K key) throws TransactionException
remove
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Boolean> removeAsync(K key) throws TransactionException
More formally, if this cache contains a mapping from key k to
value v such that
(key==null ? k==null : key.equals(k))
, that mapping is removed.
(The cache can contain at most one such mapping.)
A future result is true if this cache previously associated the key, or false if the cache contained no mapping for the key.
The cache will not contain a mapping for the specified key once the returned future is completed.
key
- Key.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported boolean remove(K key, V oldVal) throws TransactionException
For CacheAtomicityMode.ATOMIC
return
value on primary node crash may be incorrect because of the automatic retries. It is recommended
to disable retries with withNoRetries()
and manually restore primary-backup
consistency in case of update failure.
remove
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Boolean> removeAsync(K key, V oldVal) throws TransactionException
For CacheAtomicityMode.ATOMIC
return
value on primary node crash may be incorrect because of the automatic retries. It is recommended
to disable retries with withNoRetries()
and manually restore primary-backup
consistency in case of update failure.
key
- Key.oldVal
- Old value.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported V getAndRemove(K key) throws TransactionException
getAndRemove
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<V> getAndRemoveAsync(K key) throws TransactionException
key
- Key.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported boolean replace(K key, V oldVal, V newVal) throws TransactionException
For CacheAtomicityMode.ATOMIC
return
value on primary node crash may be incorrect because of the automatic retries. It is recommended
to disable retries with withNoRetries()
and manually restore primary-backup
consistency in case of update failure.
replace
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Boolean> replaceAsync(K key, V oldVal, V newVal) throws TransactionException
replace(Object, Object, Object)
.
For CacheAtomicityMode.ATOMIC
return
value on primary node crash may be incorrect because of the automatic retries. It is recommended
to disable retries with withNoRetries()
and manually restore primary-backup
consistency in case of update failure.
key
- Key.oldVal
- Old value.newVal
- New value.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported boolean replace(K key, V val) throws TransactionException
replace
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Boolean> replaceAsync(K key, V val) throws TransactionException
key
- Key.val
- Value.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported V getAndReplace(K key, V val) throws TransactionException
getAndReplace
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<V> getAndReplaceAsync(K key, V val)
key
- Key.val
- Value.TransactionTimeoutException
- If operation performs within transaction and timeout occurred.TransactionRollbackException
- If operation performs within transaction that automatically rolled back.TransactionHeuristicException
- If operation performs within transaction that entered an unknown state.@IgniteAsyncSupported void removeAll(Set<? extends K> keys) throws TransactionException
Keys are locked in the order in which they appear in key set. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeSet
. Using unordered map,
such as HashSet
, while calling this method in parallel will lead to deadlock.
removeAll
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.IgniteFuture<Void> removeAllAsync(Set<? extends K> keys) throws TransactionException
The order in which the individual entries are removed is undefined.
For every entry in the key set, the following are called:
CacheEntryRemovedListener
sCacheWriter
CacheWriter
is not called.
Keys are locked in the order in which they appear in key set. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeSet
. Using unordered map,
such as HashSet
, while calling this method in parallel will lead to deadlock.
keys
- Keys set.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported void removeAll()
The order that the individual entries are removed is undefined.
For every mapping that exists the following are called:
CacheEntryRemovedListener
sCacheWriter
CacheWriter
is not called.
This operation is not transactional. It calls broadcast closure that deletes all primary keys from remote nodes.
This is potentially an expensive operation as listeners are invoked.
Use clear()
to avoid this.
removeAll
in interface javax.cache.Cache<K,V>
IllegalStateException
- if the cache is Cache.isClosed()
javax.cache.CacheException
- if there is a problem during the removeclear()
,
CacheWriter.deleteAll(java.util.Collection<?>)
IgniteFuture<Void> removeAllAsync()
The order that the individual entries are removed is undefined.
For every mapping that exists the following are called:
CacheEntryRemovedListener
sCacheWriter
CacheWriter
is not called.
This is potentially an expensive operation as listeners are invoked.
Use clearAsync()
to avoid this.
IllegalStateException
- if the cache is Cache.isClosed()
javax.cache.CacheException
- if there is a problem during the removeclearAsync()
,
CacheWriter.deleteAll(java.util.Collection<?>)
@IgniteAsyncSupported void clear()
IgniteFuture<Void> clearAsync()
CacheWriter
s.@IgniteAsyncSupported void clear(K key)
CacheWriter
s. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.key
- Key to clear.IllegalStateException
- if the cache is Cache.isClosed()
javax.cache.CacheException
- if there is a problem during the clearIgniteFuture<Void> clearAsync(K key)
CacheWriter
s. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.key
- Key to clear.IllegalStateException
- if the cache is Cache.isClosed()
javax.cache.CacheException
- if there is a problem during the clear@IgniteAsyncSupported void clearAll(Set<? extends K> keys)
CacheWriter
s. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.keys
- Keys to clear.IllegalStateException
- if the cache is Cache.isClosed()
javax.cache.CacheException
- if there is a problem during the clearIgniteFuture<Void> clearAllAsync(Set<? extends K> keys)
CacheWriter
s. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.keys
- Keys to clear.IllegalStateException
- if the cache is Cache.isClosed()
javax.cache.CacheException
- if there is a problem during the clearvoid localClear(K key)
CacheWriter
s. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.
Note that this operation is local as it merely clears
an entry from local cache, it does not remove entries from
remote caches.key
- Key to clear.void localClearAll(Set<? extends K> keys)
CacheWriter
s. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.
Note that this operation is local as it merely clears
an entry from local cache, it does not remove entries from
remote caches.keys
- Keys to clear.@IgniteAsyncSupported <T> T invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments) throws TransactionException
Please refer to documentation for CacheAtomicityMode.ATOMIC
for information on
system behavior in crash scenarios for atomic caches.
invoke
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.<T> IgniteFuture<T> invokeAsync(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... arguments) throws TransactionException
EntryProcessor
against the Cache.Entry
specified by
the provided key. If an Cache.Entry
does not exist for the specified key,
an attempt is made to load it (if a loader is configured) or a surrogate
Cache.Entry
, consisting of the key with a null value is used instead.
Please refer to documentation for CacheAtomicityMode.ATOMIC
for information on
system behavior in crash scenarios for atomic caches.
T
- Type of the cache entry processing result.key
- The key to the entry.entryProcessor
- The EntryProcessor
to invoke.arguments
- Additional arguments to pass to the EntryProcessor
.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported <T> T invoke(K key, CacheEntryProcessor<K,V,T> entryProcessor, Object... arguments) throws TransactionException
CacheEntryProcessor
against the Cache.Entry
specified by
the provided key. If an Cache.Entry
does not exist for the specified key,
an attempt is made to load it (if a loader is configured) or a surrogate
Cache.Entry
, consisting of the key with a null value is used instead.
An instance of entry processor must be stateless as it may be invoked multiple times on primary and backup nodes in the cache. It is guaranteed that the value passed to the entry processor will be always the same.
Please refer to documentation for CacheAtomicityMode.ATOMIC
for information on
system behavior in crash scenarios for atomic caches.
T
- Type of the cache entry processing result.key
- The key to the entry.entryProcessor
- The CacheEntryProcessor
to invoke.arguments
- Additional arguments to pass to the CacheEntryProcessor
.CacheEntryProcessor
implementation.NullPointerException
- If key or CacheEntryProcessor
is nullIllegalStateException
- If the cache is Cache.isClosed()
ClassCastException
- If the implementation is configured to perform
runtime-type-checking, and the key or value
types are incompatible with those that have been
configured for the Cache
.javax.cache.processor.EntryProcessorException
- If an exception is thrown by the CacheEntryProcessor
, a Caching Implementation
must wrap any Exception
thrown
wrapped in an EntryProcessorException
.TransactionException
- If operation within transaction is failed.CacheEntryProcessor
<T> IgniteFuture<T> invokeAsync(K key, CacheEntryProcessor<K,V,T> entryProcessor, Object... arguments) throws TransactionException
CacheEntryProcessor
against the Cache.Entry
specified by
the provided key. If an Cache.Entry
does not exist for the specified key,
an attempt is made to load it (if a loader is configured) or a surrogate
Cache.Entry
, consisting of the key with a null value is used instead.
An instance of entry processor must be stateless as it may be invoked multiple times on primary and backup nodes in the cache. It is guaranteed that the value passed to the entry processor will be always the same.
T
- Type of the cache entry processing result.key
- The key to the entry.entryProcessor
- The CacheEntryProcessor
to invoke.arguments
- Additional arguments to pass to the CacheEntryProcessor
.NullPointerException
- If key or CacheEntryProcessor
is nullIllegalStateException
- If the cache is Cache.isClosed()
ClassCastException
- If the implementation is configured to perform
runtime-type-checking, and the key or value
types are incompatible with those that have been
configured for the Cache
.javax.cache.processor.EntryProcessorException
- If an exception is thrown by the CacheEntryProcessor
, a Caching Implementation
must wrap any Exception
thrown
wrapped in an EntryProcessorException
.TransactionException
- If operation within transaction is failed.CacheEntryProcessor
@IgniteAsyncSupported <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws TransactionException
Please refer to documentation for CacheAtomicityMode.ATOMIC
for information on
system behavior in crash scenarios for atomic caches.
Keys are locked in the order in which they appear in key set. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeSet
. Using unordered map,
such as HashSet
, while calling this method in parallel will lead to deadlock.
invokeAll
in interface javax.cache.Cache<K,V>
TransactionException
- If operation within transaction is failed.<T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws TransactionException
EntryProcessor
against the set of Cache.Entry
s
specified by the set of keys.
If an Cache.Entry
does not exist for the specified key, an attempt is made
to load it (if a loader is configured) or a surrogate Cache.Entry
,
consisting of the key and a value of null is provided.
The order that the entries for the keys are processed is undefined.
Implementations may choose to process the entries in any order, including
concurrently. Furthermore there is no guarantee implementations will
use the same EntryProcessor
instance to process each entry, as
the case may be in a non-local cache topology.
The result of executing the EntryProcessor
is returned in the future as a
Map
of EntryProcessorResult
s, one result per key. Should the
EntryProcessor
or Caching implementation throw an exception, the
exception is wrapped and re-thrown when a call to
EntryProcessorResult.get()
is made.
Please refer to documentation for CacheAtomicityMode.ATOMIC
for information on
system behavior in crash scenarios for atomic caches.
Keys are locked in the order in which they appear in key set. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeSet
. Using unordered map,
such as HashSet
, while calling this method in parallel will lead to deadlock.
T
- Type of the cache entry processing result.keys
- The set of keys.entryProcessor
- The EntryProcessor
to invoke.args
- Additional arguments to pass to the EntryProcessor
.TransactionException
- If operation within transaction is failed.@IgniteAsyncSupported <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, CacheEntryProcessor<K,V,T> entryProcessor, Object... args) throws TransactionException
CacheEntryProcessor
against the set of Cache.Entry
s
specified by the set of keys.
If an Cache.Entry
does not exist for the specified key, an attempt is made
to load it (if a loader is configured) or a surrogate Cache.Entry
,
consisting of the key and a value of null is provided.
The order that the entries for the keys are processed is undefined.
Implementations may choose to process the entries in any order, including
concurrently. Furthermore there is no guarantee implementations will
use the same CacheEntryProcessor
instance to process each entry, as
the case may be in a non-local cache topology.
The result of executing the CacheEntryProcessor
is returned as a
Map
of EntryProcessorResult
s, one result per key. Should the
CacheEntryProcessor
or Caching implementation throw an exception, the
exception is wrapped and re-thrown when a call to
EntryProcessorResult.get()
is made.
An instance of entry processor must be stateless as it may be invoked multiple times on primary and backup nodes in the cache. It is guaranteed that the value passed to the entry processor will be always the same.
Keys are locked in the order in which they appear in key set. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeSet
. Using unordered map,
such as HashSet
, while calling this method in parallel will lead to deadlock.
T
- Type of the cache entry processing result.keys
- The set of keys for entries to process.entryProcessor
- The CacheEntryProcessor
to invoke.args
- Additional arguments to pass to the CacheEntryProcessor
.EntryProcessorResult
s of the processing per key,
if any, defined by the CacheEntryProcessor
implementation. No mappings
will be returned for CacheEntryProcessor
s that return a
null
value for a key.NullPointerException
- If keys or CacheEntryProcessor
are {#code null}.IllegalStateException
- If the cache is Cache.isClosed()
.ClassCastException
- If the implementation is configured to perform
runtime-type-checking, and the key or value
types are incompatible with those that have been
configured for the Cache
.TransactionException
- If operation within transaction is failed.CacheEntryProcessor
<T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys, CacheEntryProcessor<K,V,T> entryProcessor, Object... args) throws TransactionException
CacheEntryProcessor
against the set of Cache.Entry
s
specified by the set of keys.
If an Cache.Entry
does not exist for the specified key, an attempt is made
to load it (if a loader is configured) or a surrogate Cache.Entry
,
consisting of the key and a value of null is provided.
The order that the entries for the keys are processed is undefined.
Implementations may choose to process the entries in any order, including
concurrently. Furthermore there is no guarantee implementations will
use the same CacheEntryProcessor
instance to process each entry, as
the case may be in a non-local cache topology.
The result of executing the CacheEntryProcessor
is returned in the future as a
Map
of EntryProcessorResult
s, one result per key. Should the
CacheEntryProcessor
or Caching implementation throw an exception, the
exception is wrapped and re-thrown when a call to
EntryProcessorResult.get()
is made.
An instance of entry processor must be stateless as it may be invoked multiple times on primary and backup nodes in the cache. It is guaranteed that the value passed to the entry processor will be always the same.
Keys are locked in the order in which they appear in key set. It is caller's responsibility to
make sure keys always follow same order, such as by using TreeSet
. Using unordered map,
such as HashSet
, while calling this method in parallel will lead to deadlock.
T
- Type of the cache entry processing result.keys
- The set of keys for entries to process.entryProcessor
- The CacheEntryProcessor
to invoke.args
- Additional arguments to pass to the CacheEntryProcessor
.NullPointerException
- If keys or CacheEntryProcessor
are {#code null}.IllegalStateException
- If the cache is Cache.isClosed()
.ClassCastException
- If the implementation is configured to perform
runtime-type-checking, and the key or value
types are incompatible with those that have been
configured for the Cache
.TransactionException
- If operation within transaction is failed.CacheEntryProcessor
void close()
For local cache equivalent to destroy()
.
For distributed caches, if called on clients, stops client cache, if called on a server node,
just closes this cache instance and does not destroy cache data.
After cache instance is closed another IgniteCache
instance for the same
cache can be created using Ignite.cache(String)
method.
void destroy()
@Deprecated IgniteFuture<Boolean> rebalance()
CacheConfiguration.getRebalanceDelay()
configuration parameter has non-zero value.
When many nodes are started or stopped almost concurrently, it is more efficient to delay
rebalancing until the node topology is stable to make sure that no redundant re-partitioning
happens.
In case ofCacheMode.PARTITIONED
caches, for better efficiency user should
usually make sure that new nodes get placed on the same place of consistent hash ring as
the left nodes, and that nodes are restarted before
rebalanceDelay
expires. To place nodes
on the same place in consistent hash ring, use
IgniteConfiguration.setConsistentId(Serializable)
to make sure that
a node maps to the same hash ID if re-started.
See CacheConfiguration.getRebalanceDelay()
for more information on how to configure
rebalance re-partition delay.
true
when rebalance was successfully finished.IgniteFuture<?> indexReadyFuture()
CacheMetrics metrics()
CacheMetrics metrics(ClusterGroup grp)
grp
- Cluster group.CacheMetrics localMetrics()
Collection<Integer> lostPartitions()
Ignite.resetLostPartitions(Collection)
can used in order to clear lost
flag
making all partitions fully operational.PartitionLossPolicy
,
EventType.EVT_CACHE_REBALANCE_PART_DATA_LOST
,
Ignite.resetLostPartitions(Collection)
void enableStatistics(boolean enabled)
enabled
- Statistics enabled flag.void clearStatistics()
void preloadPartition(int partition)
This is useful for fast iteration over cache partition data if persistence is enabled and the data is "cold".
Preload will reduce available amount of page memory for subsequent operations and may lead to earlier page replacement.
This method is irrelevant for in-memory caches. Calling this method on an in-memory cache will result in exception.
partition
- Partition.IgniteFuture<Void> preloadPartitionAsync(int partition)
This is useful for fast iteration over cache partition data if persistence is enabled and the data is "cold".
Preload will reduce available amount of page memory for subsequent operations and may lead to earlier page replacement.
This method is irrelevant for in-memory caches. Calling this method on an in-memory cache will result in exception.
partition
- Partition.boolean localPreloadPartition(int partition)
This is useful for fast iteration over cache partition data if persistence is enabled and the data is "cold".
Preload will reduce available amount of page memory for subsequent operations and may lead to earlier page replacement.
This method is irrelevant for in-memory caches. Calling this method on an in-memory cache will result in exception.
partition
- Partition.True
if partition was preloaded, false
if it doesn't belong to local node.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023