public class IgniteCacheProxy<K,V> extends AsyncSupportAdapter<IgniteCache<K,V>> implements IgniteCache<K,V>, Externalizable
curFut| Constructor and Description |
|---|
IgniteCacheProxy()
Empty constructor required for
Externalizable. |
IgniteCacheProxy(GridCacheContext<K,V> ctx,
IgniteInternalCache<K,V> delegate,
CacheOperationContext opCtx,
boolean async) |
| Modifier and Type | Method and Description |
|---|---|
IgniteCacheProxy<K,V> |
cacheNoGate()
Gets cache proxy which does not acquire read lock on gateway enter, should be used only if grid read lock is
externally acquired.
|
void |
clear() |
void |
clear(K key)
Clears entry from the cache and swap storage, without notifying listeners or
CacheWriters. |
void |
clearAll(Set<? extends K> keys)
Clears entries from the cache and swap storage, without notifying listeners or
CacheWriters. |
IgniteFuture<Void> |
clearAllAsync(Set<? extends K> keys)
Asynchronously clears entries from the cache and swap storage, without notifying listeners or
CacheWriters. |
IgniteFuture<Void> |
clearAsync()
Asynchronously clears the contents of the cache, without notifying listeners or
CacheWriters. |
IgniteFuture<Void> |
clearAsync(K key)
Asynchronously clears entry from the cache and swap storage, without notifying listeners or
CacheWriters. |
void |
close()
Closes this cache instance.
|
void |
closeProxy()
Closes this proxy 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. |
GridCacheContext<K,V> |
context() |
protected IgniteCache<K,V> |
createAsyncInstance()
Creates component with asynchronous mode enabled.
|
protected <R> IgniteFuture<R> |
createFuture(IgniteInternalFuture<R> fut) |
IgniteInternalCache |
delegate() |
void |
deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> lsnrCfg) |
void |
destroy()
Completely deletes the cache with all its data from the system on all cluster nodes.
|
GridCacheGateway<K,V> |
gate() |
V |
get(K key) |
Map<K,V> |
getAll(Collection<? extends K> keys) |
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.
|
CacheManager |
getCacheManager() |
<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.
|
String |
getName() |
V |
getTopologySafe(K key)
Gets value without waiting for toplogy changes.
|
IgniteFuture<?> |
indexReadyFuture()
Returns future that will be completed when all indexes for this cache are ready to use.
|
GridCacheProxyImpl<K,V> |
internalProxy() |
<T> T |
invoke(AffinityTopologyVersion topVer,
K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
<T> T |
invoke(K key,
CacheEntryProcessor<K,V,T> entryProcessor,
Object... args)
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... args) |
<T> Map<K,javax.cache.processor.EntryProcessorResult<T>> |
invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
Object... args) |
<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.Entrys
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) |
<T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> |
invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
Object... args)
Asynchronously version of the
IgniteCache.invokeAll(Set, EntryProcessor, 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.Entrys
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.Entrys
specified by the set of keys. |
<T> IgniteFuture<T> |
invokeAsync(K key,
CacheEntryProcessor<K,V,T> entryProcessor,
Object... args)
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... args)
Asynchronously invokes an
EntryProcessor against the Cache.Entry specified by
the provided key. |
boolean |
isClosed() |
boolean |
isLocalLocked(K key,
boolean byCurrThread)
Checks if specified key is locked.
|
Iterator<javax.cache.Cache.Entry<K,V>> |
iterator() |
<K1,V1> IgniteCache<K1,V1> |
keepBinary()
Creates projection that will operate with binary objects.
|
void |
loadAll(Set<? extends K> keys,
boolean replaceExisting,
javax.cache.integration.CompletionListener completionLsnr) |
void |
loadCache(IgniteBiPredicate<K,V> p,
Object... args)
Executes
IgniteCache.localLoadCache(IgniteBiPredicate, Object...) on all cache nodes. |
IgniteFuture<Void> |
loadCacheAsync(IgniteBiPredicate<K,V> p,
Object... args)
Asynchronously executes
IgniteCache.localLoadCache(IgniteBiPredicate, Object...) on all cache nodes. |
void |
localClear(K key)
Clears entry from the cache and swap storage, without notifying listeners or
CacheWriters. |
void |
localClearAll(Set<? extends K> keys)
Clears entries from the cache and swap storage, without notifying listeners or
CacheWriters. |
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(IgniteBiPredicate<K,V> p,
Object... args)
Delegates to
CacheStore.loadCache(IgniteBiInClosure,Object...) method
to load state from the underlying persistent storage. |
IgniteFuture<Void> |
localLoadCacheAsync(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.
|
CacheMetricsMXBean |
localMxBean()
Gets local MxBean for this cache.
|
V |
localPeek(K key,
CachePeekMode... peekModes)
Peeks at in-memory cached value using default optional peek mode.
|
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 part,
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)
Creates a
Lock instance associated with passed keys. |
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.
|
CacheMetricsMXBean |
mxBean()
Gets whole cluster MxBean for this cache.
|
CacheOperationContext |
operationContext() |
boolean |
proxyClosed() |
void |
put(K key,
V val) |
void |
putAll(Map<? extends K,? extends V> 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) |
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.
|
Collection<? extends QueryDetailMetrics> |
queryDetailMetrics()
Gets query detail metrics.
|
QueryMetrics |
queryMetrics()
Gets query metrics.
|
void |
readExternal(ObjectInput in) |
IgniteFuture<?> |
rebalance()
This cache node to re-balance its partitions.
|
void |
registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> lsnrCfg) |
boolean |
remove(K key) |
boolean |
remove(K key,
V oldVal) |
void |
removeAll()
Removes all of the mappings from this cache.
|
void |
removeAll(Set<? extends K> keys) |
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) |
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
IgniteCache.replace(Object, Object, Object). |
void |
resetQueryDetailMetrics()
Reset query detail metrics.
|
void |
resetQueryMetrics()
Reset query metrics.
|
void |
setCacheManager(CacheManager cacheMgr) |
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 part,
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 part,
CachePeekMode... peekModes)
Asynchronously gets the number of all entries cached in a partition as a long value.
|
IgniteCache<K,V> |
skipStore() |
String |
toString() |
<T> T |
unwrap(Class<T> clazz) |
IgniteCache<K,V> |
withDataCenterId(byte dataCenterId) |
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 operations (read, write)
regardless of partition loss policy. |
IgniteCache<K,V> |
withSkipStore() |
void |
writeExternal(ObjectOutput out) |
future, future, isAsync, saveOrGet, withAsyncclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitwithAsyncfuture, isAsyncpublic IgniteCacheProxy()
Externalizable.public IgniteCacheProxy(GridCacheContext<K,V> ctx, IgniteInternalCache<K,V> delegate, CacheOperationContext opCtx, boolean async)
ctx - Context.delegate - Delegate.opCtx - Operation context.async - Async support flag.@Nullable public CacheOperationContext operationContext()
public IgniteCacheProxy<K,V> cacheNoGate()
public GridCacheContext<K,V> context()
public GridCacheGateway<K,V> gate()
public CacheMetrics metrics()
metrics in interface IgniteCache<K,V>public CacheMetrics metrics(ClusterGroup grp)
metrics in interface IgniteCache<K,V>grp - Cluster group.public CacheMetrics localMetrics()
localMetrics in interface IgniteCache<K,V>public CacheMetricsMXBean mxBean()
mxBean in interface IgniteCache<K,V>public CacheMetricsMXBean localMxBean()
localMxBean in interface IgniteCache<K,V>public <C extends javax.cache.configuration.Configuration<K,V>> C getConfiguration(Class<C> clazz)
getConfiguration in interface javax.cache.Cache<K,V>getConfiguration in interface IgniteCache<K,V>public IgniteCache<K,V> withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc)
This method does not modify existing cache instance.
withExpiryPolicy in interface IgniteCache<K,V>plc - Expire policy to use.public IgniteCache<K,V> withSkipStore()
withSkipStore in interface IgniteCache<K,V>public <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 StringsUUID and array of UUIDsDate and array of DatesTimestamp and array of Timestamps
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.
withKeepBinary in interface IgniteCache<K,V>public IgniteCache<K,V> withNoRetries()
withNoRetries in interface IgniteCache<K,V>public IgniteCache<K,V> withPartitionRecover()
IgniteCache that will be allowed to execute cache operations (read, write)
regardless of partition loss policy.withPartitionRecover in interface IgniteCache<K,V>public void loadCache(@Nullable
IgniteBiPredicate<K,V> p,
@Nullable
Object... args)
IgniteCache.localLoadCache(IgniteBiPredicate, Object...) on all cache nodes.loadCache in interface IgniteCache<K,V>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.public IgniteFuture<Void> loadCacheAsync(@Nullable IgniteBiPredicate<K,V> p, @Nullable Object... args) throws javax.cache.CacheException
IgniteCache.localLoadCache(IgniteBiPredicate, Object...) on all cache nodes.loadCacheAsync in interface IgniteCache<K,V>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.public void localLoadCache(@Nullable
IgniteBiPredicate<K,V> p,
@Nullable
Object... args)
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.
localLoadCache in interface IgniteCache<K,V>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.public IgniteFuture<Void> localLoadCacheAsync(@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.
localLoadCacheAsync in interface IgniteCache<K,V>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.@Nullable public V getAndPutIfAbsent(K key, V val) throws javax.cache.CacheException
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 IgniteCache.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.
getAndPutIfAbsent in interface IgniteCache<K,V>key - Key to store in cache.val - Value to be associated with the given key.null if there was no
previous value).javax.cache.CacheException - If put operation failed.public IgniteFuture<V> getAndPutIfAbsentAsync(K key, V val) throws javax.cache.CacheException
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 IgniteCache.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.
getAndPutIfAbsentAsync in interface IgniteCache<K,V>key - Key to store in cache.val - Value to be associated with the given key.javax.cache.CacheException - If put operation failed.public Lock lock(K key) throws javax.cache.CacheException
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.lock in interface IgniteCache<K,V>key - Key for lock.javax.cache.CacheExceptionLock.lock(),
Lock.tryLock(long, TimeUnit)public Lock lockAll(Collection<? extends K> keys)
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.lockAll in interface IgniteCache<K,V>keys - Keys for lock.Lock.lock(),
Lock.tryLock(long, TimeUnit)public 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.
isLocalLocked in interface IgniteCache<K,V>key - Key to check.byCurrThread - If true method will check that current thread owns a lock on this key, other vise
will check that any thread on any node owns a lock on this key.True if lock is owned by some node.public <R> QueryCursor<R> query(Query<R> qry)
Query interface.query in interface IgniteCache<K,V>qry - Query.ScanQuery,
SqlQuery,
SqlFieldsQuery,
TextQuery,
SpiQuerypublic <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.
query in interface IgniteCache<K,V>qry - Query.transformer - Transformer.public Iterable<javax.cache.Cache.Entry<K,V>> localEntries(CachePeekMode... peekModes) throws javax.cache.CacheException
localEntries in interface IgniteCache<K,V>peekModes - Peek modes.javax.cache.CacheException - If failed.public QueryMetrics queryMetrics()
queryMetrics in interface IgniteCache<K,V>public void resetQueryMetrics()
resetQueryMetrics in interface IgniteCache<K,V>public Collection<? extends QueryDetailMetrics> queryDetailMetrics()
CacheConfiguration.setQueryDetailMetricsSize(int) method.queryDetailMetrics in interface IgniteCache<K,V>public void resetQueryDetailMetrics()
resetQueryDetailMetrics in interface IgniteCache<K,V>public void localEvict(Collection<? extends K> keys)
localEvict in interface IgniteCache<K,V>keys - Keys to evict.@Nullable public V localPeek(K key, CachePeekMode... peekModes)
This method will not load value from any persistent store or from a remote node.
localPeek in interface IgniteCache<K,V>key - Entry key.peekModes - Peek modes.null if not found.public 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.
size in interface IgniteCache<K,V>peekModes - Optional peek modes. If not provided, then total cache size is returned.javax.cache.CacheException - On error.public 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.
sizeAsync in interface IgniteCache<K,V>peekModes - Optional peek modes. If not provided, then total cache size is returned.javax.cache.CacheException - On error.public 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.
sizeLong in interface IgniteCache<K,V>peekModes - Optional peek modes. If not provided, then total cache size is returned.javax.cache.CacheException - On error.public 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.
sizeLongAsync in interface IgniteCache<K,V>peekModes - Optional peek modes. If not provided, then total cache size is returned.javax.cache.CacheException - On error.public long sizeLong(int part,
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.
sizeLong in interface IgniteCache<K,V>part - partition.peekModes - Optional peek modes. If not provided, then total partition cache size is returned.javax.cache.CacheException - On error.public IgniteFuture<Long> sizeLongAsync(int part, 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.
sizeLongAsync in interface IgniteCache<K,V>part - partition.peekModes - Optional peek modes. If not provided, then total partition cache size is returned.javax.cache.CacheException - On error.public 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.localSize in interface IgniteCache<K,V>peekModes - Optional peek modes. If not provided, then total cache size is returned.public 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.localSizeLong in interface IgniteCache<K,V>peekModes - Optional peek modes. If not provided, then total cache size is returned.public long localSizeLong(int part,
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.localSizeLong in interface IgniteCache<K,V>part - partition.peekModes - Optional peek modes. If not provided, then total cache size is returned.public 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.
getAsync in interface IgniteCache<K,V>key - Key.public CacheEntry<K,V> getEntry(K key)
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.
getEntry in interface IgniteCache<K,V>key - The key whose associated value is to be returned.public IgniteFuture<CacheEntry<K,V>> getEntryAsync(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.
getEntryAsync in interface IgniteCache<K,V>key - The key whose associated value is to be returned.public IgniteFuture<Map<K,V>> getAllAsync(Set<? extends K> keys)
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.
getAllAsync in interface IgniteCache<K,V>keys - Keys set.public Collection<CacheEntry<K,V>> getEntries(Set<? extends K> keys)
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.
getEntries in interface IgniteCache<K,V>keys - The keys whose associated values are to be returned.public IgniteFuture<Collection<CacheEntry<K,V>>> getEntriesAsync(Set<? extends K> keys)
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.
getEntriesAsync in interface IgniteCache<K,V>keys - The keys whose associated values are to be returned.public Map<K,V> getAllOutTx(Set<? extends K> keys)
getAllOutTx in interface IgniteCache<K,V>keys - The keys whose associated values are to be returned.public IgniteFuture<Map<K,V>> getAllOutTxAsync(Set<? extends K> keys)
getAllOutTxAsync in interface IgniteCache<K,V>keys - The keys whose associated values are to be returned.public Map<K,V> getAll(Collection<? extends K> keys)
keys - Keys.public boolean containsKey(K key)
containsKey in interface javax.cache.Cache<K,V>containsKey in interface IgniteCache<K,V>public IgniteFuture<Boolean> containsKeyAsync(K key)
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.)
containsKeyAsync in interface IgniteCache<K,V>key - Key.public boolean containsKeys(Set<? extends K> keys)
Cache contains entries for the specified keys.containsKeys in interface IgniteCache<K,V>keys - Key whose presence in this cache is to be tested.True if this cache contains a mapping for the specified keys.public IgniteFuture<Boolean> containsKeysAsync(Set<? extends K> keys)
Cache contains entries for the specified keys.containsKeysAsync in interface IgniteCache<K,V>keys - Key whose presence in this cache is to be tested.public void loadAll(Set<? extends K> keys, boolean replaceExisting, @Nullable javax.cache.integration.CompletionListener completionLsnr)
public IgniteFuture<Void> putAsync(K key, V val)
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.)
putAsync in interface IgniteCache<K,V>key - Key.val - Value.public IgniteFuture<V> getAndPutAsync(K key, V val)
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.
getAndPutAsync in interface IgniteCache<K,V>key - Key.val - Value.public IgniteFuture<Void> putAllAsync(Map<? extends K,? extends V> map)
Cache.
The effect of this call is equivalent to that of calling
IgniteCache.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.
putAllAsync in interface IgniteCache<K,V>map - Map containing keys and values to put into the cache.public boolean putIfAbsent(K key, V val)
putIfAbsent in interface javax.cache.Cache<K,V>putIfAbsent in interface IgniteCache<K,V>public IgniteFuture<Boolean> putIfAbsentAsync(K key, V val)
putIfAbsentAsync in interface IgniteCache<K,V>key - Key.val - Value.public boolean remove(K key)
public IgniteFuture<Boolean> removeAsync(K key)
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.
removeAsync in interface IgniteCache<K,V>key - Key.public IgniteFuture<Boolean> removeAsync(K key, V oldVal)
removeAsync in interface IgniteCache<K,V>key - Key.oldVal - Old value.public V getAndRemove(K key)
getAndRemove in interface javax.cache.Cache<K,V>getAndRemove in interface IgniteCache<K,V>public IgniteFuture<V> getAndRemoveAsync(K key)
getAndRemoveAsync in interface IgniteCache<K,V>key - Key.public IgniteFuture<Boolean> replaceAsync(K key, V oldVal, V newVal)
IgniteCache.replace(Object, Object, Object).replaceAsync in interface IgniteCache<K,V>key - Key.oldVal - Old value.newVal - New value.public IgniteFuture<Boolean> replaceAsync(K key, V val)
replaceAsync in interface IgniteCache<K,V>key - Key.val - Value.public V getAndReplace(K key, V val)
getAndReplace in interface javax.cache.Cache<K,V>getAndReplace in interface IgniteCache<K,V>public IgniteFuture<V> getAndReplaceAsync(K key, V val)
getAndReplaceAsync in interface IgniteCache<K,V>key - Key.val - Value.public IgniteFuture<Void> removeAllAsync(Set<? extends K> keys)
The order in which the individual entries are removed is undefined.
For every entry in the key set, the following are called:
CacheEntryRemovedListenersCacheWriterCacheWriter is not called.removeAllAsync in interface IgniteCache<K,V>keys - Keys set.public void removeAll()
The order that the individual entries are removed is undefined.
For every mapping that exists the following are called:
CacheEntryRemovedListenersCacheWriterCacheWriter 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 IgniteCache.clear() to avoid this.
removeAll in interface javax.cache.Cache<K,V>removeAll in interface IgniteCache<K,V>IgniteCache.clear(),
CacheWriter.deleteAll(java.util.Collection<?>)public IgniteFuture<Void> removeAllAsync()
The order that the individual entries are removed is undefined.
For every mapping that exists the following are called:
CacheEntryRemovedListenersCacheWriterCacheWriter is not called.
This is potentially an expensive operation as listeners are invoked.
Use IgniteCache.clearAsync() to avoid this.
removeAllAsync in interface IgniteCache<K,V>IgniteCache.clearAsync(),
CacheWriter.deleteAll(java.util.Collection<?>)public void clear(K key)
CacheWriters. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.clear in interface IgniteCache<K,V>key - Key to clear.public IgniteFuture<Void> clearAsync(K key)
CacheWriters. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.clearAsync in interface IgniteCache<K,V>key - Key to clear.public void clearAll(Set<? extends K> keys)
CacheWriters. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.clearAll in interface IgniteCache<K,V>keys - Keys to clear.public IgniteFuture<Void> clearAllAsync(Set<? extends K> keys)
CacheWriters. Entry is cleared only if it is not currently locked,
and is not participating in a transaction.clearAllAsync in interface IgniteCache<K,V>keys - Keys to clear.public void clear()
public IgniteFuture<Void> clearAsync()
CacheWriters.clearAsync in interface IgniteCache<K,V>public void localClear(K key)
CacheWriters. 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.localClear in interface IgniteCache<K,V>key - Key to clear.public void localClearAll(Set<? extends K> keys)
CacheWriters. 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.localClearAll in interface IgniteCache<K,V>keys - Keys to clear.public <T> T invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws javax.cache.processor.EntryProcessorException
public <T> IgniteFuture<T> invokeAsync(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)
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.invokeAsync in interface IgniteCache<K,V>key - The key to the entry.entryProcessor - The EntryProcessor to invoke.args - Additional arguments to pass to the EntryProcessor.public <T> T invoke(K key, CacheEntryProcessor<K,V,T> entryProcessor, Object... args) throws javax.cache.processor.EntryProcessorException
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.
invoke in interface IgniteCache<K,V>key - The key to the entry.entryProcessor - The CacheEntryProcessor to invoke.args - Additional arguments to pass to the CacheEntryProcessor.CacheEntryProcessor implementation.javax.cache.processor.EntryProcessorException - If an exception is thrown by the CacheEntryProcessor, a Caching Implementation
must wrap any Exception thrown
wrapped in an EntryProcessorException.CacheEntryProcessorpublic <T> IgniteFuture<T> invokeAsync(K key, CacheEntryProcessor<K,V,T> entryProcessor, Object... args)
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.
invokeAsync in interface IgniteCache<K,V>key - The key to the entry.entryProcessor - The CacheEntryProcessor to invoke.args - Additional arguments to pass to the CacheEntryProcessor.CacheEntryProcessorpublic <T> T invoke(@Nullable
AffinityTopologyVersion topVer,
K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args)
topVer - Locked topology version.key - Key.entryProcessor - Entry processor.args - Arguments.public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)
public <T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)
EntryProcessor against the set of Cache.Entrys
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 EntryProcessorResults, 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.
invokeAllAsync in interface IgniteCache<K,V>keys - The set of keys.entryProcessor - The EntryProcessor to invoke.args - Additional arguments to pass to the EntryProcessor.public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, CacheEntryProcessor<K,V,T> entryProcessor, Object... args)
CacheEntryProcessor against the set of Cache.Entrys
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 EntryProcessorResults, 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.
invokeAll in interface IgniteCache<K,V>keys - The set of keys for entries to process.entryProcessor - The CacheEntryProcessor to invoke.args - Additional arguments to pass to the CacheEntryProcessor.EntryProcessorResults of the processing per key,
if any, defined by the CacheEntryProcessor implementation. No mappings
will be returned for CacheEntryProcessors that return a
null value for a key.CacheEntryProcessorpublic <T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys, CacheEntryProcessor<K,V,T> entryProcessor, Object... args)
CacheEntryProcessor against the set of Cache.Entrys
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 EntryProcessorResults, 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.
invokeAllAsync in interface IgniteCache<K,V>keys - The set of keys for entries to process.entryProcessor - The CacheEntryProcessor to invoke.args - Additional arguments to pass to the CacheEntryProcessor.CacheEntryProcessorpublic <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args)
invokeAll in interface IgniteCache<K,V>map - Map containing keys and entry processors to be applied to values.args - Additional arguments to pass to the EntryProcessor.EntryProcessorResults of the processing per key,
if any, defined by the EntryProcessor implementation. No mappings
will be returned for EntryProcessors that return a
null value for a key.public <T> IgniteFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args)
IgniteCache.invokeAll(Set, EntryProcessor, Object...) method.invokeAllAsync in interface IgniteCache<K,V>map - Map containing keys and entry processors to be applied to values.args - Additional arguments to pass to the EntryProcessor.IgniteCache.invokeAll(Map, Object...).public CacheManager getCacheManager()
public void setCacheManager(CacheManager cacheMgr)
cacheMgr - Cache manager.public void destroy()
destroy in interface IgniteCache<K,V>public void close()
For local cache equivalent to IgniteCache.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.
close in interface Closeableclose in interface AutoCloseableclose in interface javax.cache.Cache<K,V>close in interface IgniteCache<K,V>public IgniteInternalCache delegate()
public void registerCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> lsnrCfg)
public void deregisterCacheEntryListener(javax.cache.configuration.CacheEntryListenerConfiguration<K,V> lsnrCfg)
protected IgniteCache<K,V> createAsyncInstance()
createAsyncInstance in class AsyncSupportAdapter<IgniteCache<K,V>>public <K1,V1> IgniteCache<K1,V1> keepBinary()
Projection returned by this method will force cache not to deserialize binary objects, so keys and values will be returned from cache API methods without changes. Therefore, signature of the projection can contain only following types:
BinaryObject
for binary classesString and array of StringsUUID and array of UUIDsDate and array of DatesTimestamp and array of Timestamps 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:
IgniteInternalCacheprj = cache.keepBinary(); // Value is not deserialized and returned in binary format. GridBinaryObject po = prj.get(1);
Note that this method makes sense only if cache is working in binary mode (CacheConfiguration#isBinaryEnabled() returns true. If not, this method is no-op and will return
current projection.
public IgniteCache<K,V> withDataCenterId(byte dataCenterId)
dataCenterId - Data center ID.public IgniteCache<K,V> skipStore()
protected <R> IgniteFuture<R> createFuture(IgniteInternalFuture<R> fut)
createFuture in class AsyncSupportAdapter<IgniteCache<K,V>>fut - Internal future.public GridCacheProxyImpl<K,V> internalProxy()
public boolean proxyClosed()
True if proxy was closed.public void closeProxy()
public Collection<Integer> lostPartitions()
lostPartitions in interface IgniteCache<K,V>public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic IgniteFuture<?> 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.
rebalance in interface IgniteCache<K,V>public IgniteFuture<?> indexReadyFuture()
indexReadyFuture in interface IgniteCache<K,V>public V getTopologySafe(K key)
key - Key.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017