public abstract class GridCacheAdapter<K,V> extends Object implements GridCache<K,V>, GridCacheProjectionEx<K,V>, Externalizable
| Modifier and Type | Class and Description |
|---|---|
protected class |
GridCacheAdapter.AsyncOp<T>
Cache operation.
|
protected static class |
GridCacheAdapter.CacheExpiryPolicy |
protected static class |
GridCacheAdapter.FutureHolder
Holder for last async operation future.
|
protected static class |
GridCacheAdapter.UpdateGetTimeStatClosure<T> |
protected static class |
GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T> |
protected static class |
GridCacheAdapter.UpdatePutTimeStatClosure<T> |
protected static class |
GridCacheAdapter.UpdateRemoveTimeStatClosure<T> |
protected static class |
GridCacheAdapter.UpdateTimeStatClosure<T> |
| Modifier and Type | Field and Description |
|---|---|
protected CacheConfiguration |
cacheCfg
Cache configuration.
|
static int |
CLEAR_ALL_SPLIT_THRESHOLD
clearLocally() split threshold.
|
protected GridCacheContext<K,V> |
ctx
Cache configuration.
|
protected IgniteConfiguration |
gridCfg
Grid configuration.
|
protected boolean |
keyCheck |
protected ThreadLocal<GridCacheAdapter.FutureHolder> |
lastFut
Last asynchronous future.
|
protected UUID |
locNodeId
Local node ID.
|
protected IgniteLogger |
log
Logger.
|
protected GridCacheConcurrentMap |
map
Local map.
|
protected CacheMetricsImpl |
metrics
Cache metrics.
|
protected CacheMetricsMXBean |
mxBean
Cache mxBean.
|
protected static IgniteClosure |
RET2NULL
GridCacheReturn-to-null conversion. |
| Modifier | Constructor and Description |
|---|---|
protected |
GridCacheAdapter()
Empty constructor required by
Externalizable. |
protected |
GridCacheAdapter(GridCacheContext<K,V> ctx,
GridCacheConcurrentMap map) |
protected |
GridCacheAdapter(GridCacheContext<K,V> ctx,
int startSize) |
| Modifier and Type | Method and Description |
|---|---|
CacheAffinity<K> |
affinity()
Gets affinity service to provide information about data partitioning
and distribution.
|
Set<GridCacheEntryEx> |
allEntries() |
protected <T> IgniteInternalFuture<T> |
asyncOp(IgniteTxLocalAdapter tx,
GridCacheAdapter.AsyncOp<T> op) |
protected <T> IgniteInternalFuture<T> |
asyncOpAcquire()
Tries to acquire asynchronous operations permit, if limited.
|
protected void |
asyncOpRelease()
Releases asynchronous operations permit, if limited.
|
void |
awaitLastFut()
Awaits for previous async operation to be completed.
|
<K1,V1> GridCache<K1,V1> |
cache()
Gets base cache for this projection.
|
protected void |
checkJta()
Checks if cache is working in JTA transaction and enlist cache as XAResource if necessary.
|
void |
clear()
Clears cache on all nodes that store it's data.
|
void |
clear(K key)
Clears key on all nodes that store it's data.
|
void |
clear(long timeout)
Clears cache on all nodes that store it's data.
|
void |
clearAll(Set<K> keys)
Clears keys on all nodes that store it's data.
|
IgniteInternalFuture<?> |
clearAsync() |
IgniteInternalFuture<?> |
clearAsync(K key) |
IgniteInternalFuture<?> |
clearAsync(Set<K> keys) |
void |
clearLocally()
Clears all entries from this cache only if the entry is not
currently locked or participating in a transaction.
|
void |
clearLocally(Collection<KeyCacheObject> keys,
boolean readers) |
boolean |
clearLocally(K key)
Clears an entry from this cache and swap storage only if the entry
is not currently locked, and is not participating in a transaction.
|
void |
clearLocally0(Collection<? extends K> keys,
CacheEntryPredicate... filter) |
boolean |
clearLocally0(K key,
CacheEntryPredicate... filter) |
void |
clearLocallyAll(Set<K> keys)
Clears entries from this cache and swap storage only if the entry
is not currently locked, and is not participating in a transaction.
|
IgniteInternalFuture<IgniteInternalTx> |
commitTxAsync(IgniteInternalTx tx)
Asynchronously commits transaction after all previous asynchronous operations are completed.
|
CacheConfiguration |
configuration()
Gets configuration bean for this cache.
|
boolean |
containsKey(K key) |
IgniteInternalFuture<Boolean> |
containsKeyAsync(K key) |
boolean |
containsKeys(Collection<? extends K> keys) |
IgniteInternalFuture<Boolean> |
containsKeysAsync(Collection<? extends K> keys) |
boolean |
containsValue(V val)
Returns
true if this cache contains given value. |
GridCacheContext<K,V> |
context() |
Set<GridCacheEntryEx> |
entries() |
javax.cache.Cache.Entry<K,V> |
entry(K key)
Gets entry from cache with the specified key.
|
GridCacheEntryEx |
entryEx(KeyCacheObject key) |
GridCacheEntryEx |
entryEx(KeyCacheObject key,
boolean touch) |
GridCacheEntryEx |
entryEx(KeyCacheObject key,
long topVer) |
GridCacheEntryEx |
entryEx(Object key) |
protected GridCacheEntryEx |
entryExSafe(KeyCacheObject key,
long topVer) |
Set<javax.cache.Cache.Entry<K,V>> |
entrySet()
Gets set of all entries cached on this node.
|
Set<javax.cache.Cache.Entry<K,V>> |
entrySet(CacheEntryPredicate... filter) |
Set<javax.cache.Cache.Entry<K,V>> |
entrySet(int part)
Gets set containing cache entries that belong to provided partition or
null
if partition is not found locally. |
Set<javax.cache.Cache.Entry<K,V>> |
entrySetx(CacheEntryPredicate... filter)
Gets entry set containing internal entries.
|
boolean |
evict(K key)
Evicts entry associated with given key from cache.
|
boolean |
evict(K key,
CacheEntryPredicate... filter) |
void |
evictAll()
Attempts to evict all cache entries.
|
void |
evictAll(Collection<? extends K> keys)
Attempts to evict all entries associated with keys.
|
void |
evictAll(Collection<? extends K> keys,
CacheEntryPredicate... filter) |
javax.cache.expiry.ExpiryPolicy |
expiry() |
IgniteCacheExpiryPolicy |
expiryPolicy(javax.cache.expiry.ExpiryPolicy plc) |
Set<CacheFlag> |
flags()
Gets cache flags enabled on this projection.
|
CacheProjection<K,V> |
flagsOff(CacheFlag[] flags)
Gets cache projection base on this but with the specified flags turned off.
|
CacheProjection<K,V> |
flagsOn(CacheFlag[] flags)
Gets cache projection base on this one, but with the specified flags turned on.
|
IgniteInternalFuture<?> |
forceRepartition()
Forces this cache node to re-balance its partitions.
|
GridCacheProjectionEx<K,V> |
forSubjectId(UUID subjId)
Creates projection for specified subject ID.
|
V |
get(K key)
Retrieves value mapped to the specified key from cache.
|
V |
get(K key,
boolean deserializePortable) |
V |
get(K key,
GridCacheEntryEx entry,
boolean deserializePortable,
CacheEntryPredicate... filter) |
Map<K,V> |
getAll(Collection<? extends K> keys)
Retrieves values mapped to the specified keys from cache.
|
Map<K,V> |
getAll(Collection<? extends K> keys,
boolean deserializePortable) |
IgniteInternalFuture<Map<K,V>> |
getAllAsync(Collection<? extends K> keys)
Asynchronously retrieves values mapped to the specified keys from cache.
|
IgniteInternalFuture<Map<K,V>> |
getAllAsync(Collection<? extends K> keys,
boolean deserializePortable) |
protected IgniteInternalFuture<Map<K,V>> |
getAllAsync(Collection<? extends K> keys,
boolean forcePrimary,
boolean skipTx,
GridCacheEntryEx entry,
UUID subjId,
String taskName,
boolean deserializePortable,
boolean skipVals) |
IgniteInternalFuture<Map<K,V>> |
getAllAsync(Collection<? extends K> keys,
boolean readThrough,
GridCacheEntryEx cached,
boolean checkTx,
UUID subjId,
String taskName,
boolean deserializePortable,
boolean forcePrimary,
IgniteCacheExpiryPolicy expiry,
boolean skipVals) |
<K1,V1> IgniteInternalFuture<Map<K1,V1>> |
getAllAsync0(Collection<KeyCacheObject> keys,
boolean readThrough,
boolean checkTx,
UUID subjId,
String taskName,
boolean deserializePortable,
IgniteCacheExpiryPolicy expiry,
boolean skipVals,
boolean keepCacheObjects) |
Map<K,V> |
getAllOutTx(List<K> keys)
Gets values from cache.
|
IgniteInternalFuture<Map<K,V>> |
getAllOutTxAsync(List<K> keys)
Asynchronously gets values from cache.
|
IgniteInternalFuture<V> |
getAsync(K key)
Asynchronously retrieves value mapped to the specified key from cache.
|
IgniteInternalFuture<V> |
getAsync(K key,
boolean deserializePortable) |
V |
getForcePrimary(K key)
Gets value from cache.
|
IgniteInternalFuture<V> |
getForcePrimaryAsync(K key)
Asynchronously gets value from cache.
|
int |
globalPrimarySize()
Gets the number of all primary entries cached across all nodes (excluding backups).
|
int |
globalSize()
Gets the number of all entries cached across all nodes.
|
ClusterGroup |
gridProjection()
Gets grid projection for this cache.
|
long |
igfsDataSpaceMax()
Get maximum space available for IGFS.
|
long |
igfsDataSpaceUsed()
Get current amount of used IGFS space in bytes.
|
Iterator<javax.cache.Cache.Entry<K,V>> |
igniteIterator() |
protected void |
init()
Post constructor initialization for subclasses.
|
<T> javax.cache.processor.EntryProcessorResult<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,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
<T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> |
invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map,
Object... args) |
<T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> |
invokeAllAsync(Set<? extends K> keys,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
<T> IgniteInternalFuture<javax.cache.processor.EntryProcessorResult<T>> |
invokeAsync(K key,
javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
Object... args) |
boolean |
isColocated() |
boolean |
isDht() |
boolean |
isDhtAtomic() |
boolean |
isEmpty()
Returns
true if this map contains no key-value mappings. |
boolean |
isIgfsDataCache()
Checks whether this cache is IGFS data cache.
|
boolean |
isLocal() |
boolean |
isLocked(K key)
Checks if any node owns a lock for this key.
|
boolean |
isLockedByThread(K key)
Checks if current thread owns a lock on this key.
|
boolean |
isMongoDataCache()
Checks whether this cache is Mongo data cache.
|
boolean |
isMongoMetaCache()
Checks whether this cache is Mongo meta cache.
|
boolean |
isNear() |
Iterator<javax.cache.Cache.Entry<K,V>> |
iterator() |
protected Iterator<javax.cache.Cache.Entry<K,V>> |
iterator(Iterator<GridCacheEntryEx> it,
boolean deserializePortable) |
<K1,V1> CacheProjection<K1,V1> |
keepPortable()
Creates projection that will operate with portable objects.
|
<K1,V1> GridCacheProjectionImpl<K1,V1> |
keepPortable0()
Internal routine to get "keep-portable" projection.
|
Set<K> |
keySet()
Set of keys cached on this node.
|
Set<K> |
keySet(CacheEntryPredicate... filter)
Set of keys cached on this node.
|
IgniteInternalFuture<?> |
loadAll(Set<? extends K> keys,
boolean replaceExisting) |
Iterable<javax.cache.Cache.Entry<K,V>> |
localEntries(CachePeekMode[] peekModes) |
void |
localLoad(Collection<? extends K> keys,
javax.cache.expiry.ExpiryPolicy plc) |
void |
localLoadCache(IgniteBiPredicate<K,V> p,
Object[] args)
Delegates to
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure,Object...) method
to load state from the underlying persistent storage. |
IgniteInternalFuture<?> |
localLoadCacheAsync(IgniteBiPredicate<K,V> p,
Object[] args)
Asynchronously delegates to
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...) method
to reload state from the underlying persistent storage. |
V |
localPeek(K key,
CachePeekMode[] peekModes,
IgniteCacheExpiryPolicy plc) |
void |
localRemoveAll() |
IgniteInternalFuture<?> |
localRemoveAll(CacheEntryPredicate filter) |
int |
localSize(CachePeekMode[] peekModes) |
boolean |
lock(K key,
long timeout,
CacheEntryPredicate... filter)
Synchronously acquires lock on a cached object with given
key only if the passed in filter (if any) passes.
|
boolean |
lockAll(Collection<? extends K> keys,
long timeout,
CacheEntryPredicate... filter)
All or nothing synchronous lock for passed in keys.
|
IgniteInternalFuture<Boolean> |
lockAsync(K key,
long timeout,
CacheEntryPredicate... filter)
Asynchronously acquires lock on a cached object with given
key only if the passed in filter (if any) passes.
|
protected IgniteLogger |
log() |
GridCacheConcurrentMap |
map() |
CacheMetrics |
metrics()
Gets metrics (statistics) for this cache.
|
CacheMetricsImpl |
metrics0() |
CacheMetricsMXBean |
mxBean()
Gets metrics (statistics) for this cache.
|
String |
name()
Gets name of this cache (
null for default cache). |
int |
nearSize()
Gets size of near cache key set.
|
long |
offHeapAllocatedSize()
Gets memory size allocated in off-heap.
|
long |
offHeapEntriesCount()
Gets number of cache entries stored in off-heap memory.
|
Iterator<Map.Entry<K,V>> |
offHeapIterator()
Gets iterator over keys and values belonging to this cache off-heap memory on local node.
|
abstract void |
onDeferredDelete(GridCacheEntryEx entry,
GridCacheVersion ver) |
void |
onIgfsDataSizeChanged(long delta)
Callback invoked when data is added to IGFS cache.
|
protected void |
onKernalStart()
Kernal start callback.
|
void |
onKernalStop()
Kernal stop callback.
|
void |
onUndeploy(ClassLoader ldr)
Undeploys and removes all entries for class loader.
|
long |
overflowSize()
Gets size (in bytes) of all entries swapped to disk.
|
V |
peek(K key)
Peeks at in-memory cached value using default
GridCachePeekMode.SMART
peek mode. |
V |
peek(K key,
CacheEntryPredicate filter) |
V |
peek(K key,
Collection<GridCachePeekMode> modes)
Peeks at cached value using optional set of peek modes.
|
protected GridTuple<V> |
peek0(boolean failFast,
K key,
Collection<GridCachePeekMode> modes,
IgniteInternalTx tx) |
protected GridTuple<V> |
peek0(boolean failFast,
K key,
GridCachePeekMode mode,
CacheEntryPredicate... filter) |
protected V |
peek0(K key,
Collection<GridCachePeekMode> modes,
IgniteInternalTx tx) |
protected Map<K,V> |
peekAll0(Collection<? extends K> keys,
Collection<GridCachePeekMode> modes,
IgniteInternalTx tx,
Collection<K> skipped) |
GridCacheEntryEx |
peekEx(KeyCacheObject key) |
GridCacheEntryEx |
peekEx(Object key) |
CacheEntryPredicate |
predicate()
Gets predicate on which this projection is based on or
null
if predicate is not defined. |
abstract GridCachePreloader<K,V> |
preloader() |
Set<javax.cache.Cache.Entry<K,V>> |
primaryEntrySet()
Gets set of cache entries for which this node is primary.
|
Set<javax.cache.Cache.Entry<K,V>> |
primaryEntrySet(CacheEntryPredicate... filter) |
Set<javax.cache.Cache.Entry<K,V>> |
primaryEntrySetx(CacheEntryPredicate... filter)
Gets set of primary entries containing internal entries.
|
Set<K> |
primaryKeySet()
Set of keys for which this node is primary.
|
Set<K> |
primaryKeySet(CacheEntryPredicate... filter) |
int |
primarySize()
Gets the number of all primary entries cached on this node.
|
Collection<V> |
primaryValues()
Collection of cached values for which this node is primary.
|
Collection<V> |
primaryValues(CacheEntryPredicate... filter) |
void |
printMemoryStats()
Prints memory stats.
|
CacheProjection<K,V> |
projection(CacheEntryPredicate filter)
Gets cache projection based on given entry filter.
|
<K1,V1> CacheProjection<K1,V1> |
projection(Class<? super K1> keyType,
Class<? super V1> valType)
Gets cache projection only for given key and value type.
|
V |
promote(K key)
This method promotes cache entry by given key, if any, from offheap or swap storage
into memory.
|
V |
promote(K key,
boolean deserializePortable) |
void |
promoteAll(Collection<? extends K> keys)
This method unswaps cache entries by given keys, if any, from swap storage
into memory.
|
V |
put(K key,
V val,
CacheEntryPredicate... filter)
Stores given key-value pair in cache.
|
V |
put(K key,
V val,
GridCacheEntryEx cached,
long ttl,
CacheEntryPredicate[] filter)
Internal method that is called from
GridCacheEntryImpl. |
void |
putAll(Map<? extends K,? extends V> m,
CacheEntryPredicate[] filter)
Stores given key-value pairs in cache.
|
IgniteInternalFuture<?> |
putAllAsync(Map<? extends K,? extends V> m,
CacheEntryPredicate... filter)
Asynchronously stores given key-value pairs in cache.
|
void |
putAllConflict(Map<KeyCacheObject,GridCacheDrInfo> drMap)
Store DR data.
|
IgniteInternalFuture<?> |
putAllConflictAsync(Map<KeyCacheObject,GridCacheDrInfo> drMap)
Store DR data asynchronously.
|
IgniteInternalFuture<V> |
putAsync(K key,
V val,
CacheEntryPredicate[] filter)
Asynchronously stores given key-value pair in cache.
|
IgniteInternalFuture<V> |
putAsync(K key,
V val,
GridCacheEntryEx entry,
long ttl,
CacheEntryPredicate... filter)
Internal method that is called from
GridCacheEntryImpl. |
V |
putIfAbsent(K key,
V val)
Stores given key-value pair in cache only if cache had no previous mapping for it.
|
IgniteInternalFuture<V> |
putIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
boolean |
putx(K key,
V val,
CacheEntryPredicate[] filter)
Stores given key-value pair in cache.
|
boolean |
putx(K key,
V val,
GridCacheEntryEx cached,
long ttl,
CacheEntryPredicate... filter)
Internal method that is called from
GridCacheEntryImpl. |
IgniteInternalFuture<Boolean> |
putxAsync(K key,
V val,
CacheEntryPredicate... filter)
Stores given key-value pair in cache.
|
IgniteInternalFuture<Boolean> |
putxAsync(K key,
V val,
GridCacheEntryEx entry,
long ttl,
CacheEntryPredicate... filter)
Internal method that is called from
GridCacheEntryImpl. |
boolean |
putxIfAbsent(K key,
V val)
Stores given key-value pair in cache only if cache had no previous mapping for it.
|
IgniteInternalFuture<Boolean> |
putxIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
CacheQueries<K,V> |
queries()
Returns queries facade responsible for creating various SQL, TEXT, or SCAN queries.
|
javax.cache.Cache.Entry<K,V> |
randomEntry()
Gets a random entry out of cache.
|
void |
readExternal(ObjectInput in) |
protected Object |
readResolve()
Reconstructs object on unmarshalling.
|
IgniteInternalFuture<Object> |
readThroughAllAsync(Collection<KeyCacheObject> keys,
boolean reload,
boolean skipVals,
IgniteInternalTx tx,
UUID subjId,
String taskName,
IgniteBiInClosure<KeyCacheObject,Object> vis) |
V |
reload(K key)
Reloads a single key from persistent storage.
|
IgniteInternalFuture<Map<KeyCacheObject,CacheObject>> |
reloadAllAsync0(Collection<KeyCacheObject> keys,
boolean ret,
boolean skipVals,
UUID subjId,
String taskName) |
IgniteInternalFuture<V> |
reloadAsync(K key)
Asynchronously reloads a single key from persistent storage.
|
V |
remove(K key,
CacheEntryPredicate[] filter)
Removes given key mapping from cache.
|
V |
remove(K key,
GridCacheEntryEx entry,
CacheEntryPredicate... filter)
Internal method that is called from
GridCacheEntryImpl. |
boolean |
remove(K key,
V val)
Removes given key mapping from cache if one exists and value is equal to the passed in value.
|
void |
removeAll(Collection<? extends K> keys,
CacheEntryPredicate... filter)
Removes given key mappings from cache for entries for which the optionally passed in filters do
pass.
|
IgniteInternalFuture<?> |
removeAllAsync(Collection<? extends K> keys,
CacheEntryPredicate... filter)
Asynchronously removes given key mappings from cache for entries for which the optionally
passed in filters do pass.
|
void |
removeAllConflict(Map<KeyCacheObject,GridCacheVersion> drMap)
Removes DR data.
|
IgniteInternalFuture<?> |
removeAllConflictAsync(Map<KeyCacheObject,GridCacheVersion> drMap)
Removes DR data asynchronously.
|
IgniteInternalFuture<V> |
removeAsync(K key,
CacheEntryPredicate... filter)
Asynchronously removes given key mapping from cache.
|
IgniteInternalFuture<V> |
removeAsync(K key,
GridCacheEntryEx entry,
CacheEntryPredicate... filter)
Internal method that is called from
GridCacheEntryImpl. |
IgniteInternalFuture<Boolean> |
removeAsync(K key,
V val)
Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value.
|
void |
removeEntry(GridCacheEntryEx entry) |
void |
removeIfObsolete(KeyCacheObject key) |
boolean |
removex(K key,
CacheEntryPredicate... filter)
Removes given key mapping from cache.
|
boolean |
removex(K key,
GridCacheEntryEx entry,
CacheEntryPredicate... filter)
Internal method that is called from
GridCacheEntryImpl. |
GridCacheReturn |
removex(K key,
V val)
Removes given key mapping from cache if one exists and value is equal to the passed in value.
|
IgniteInternalFuture<Boolean> |
removexAsync(K key,
CacheEntryPredicate... filter)
Asynchronously removes given key mapping from cache.
|
IgniteInternalFuture<Boolean> |
removexAsync(K key,
GridCacheEntryEx entry,
CacheEntryPredicate... filter)
Internal method that is called from
GridCacheEntryImpl. |
IgniteInternalFuture<GridCacheReturn> |
removexAsync(K key,
V val)
Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value.
|
V |
replace(K key,
V val)
Stores given key-value pair in cache only if there is a previous mapping for it.
|
boolean |
replace(K key,
V oldVal,
V newVal)
Stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
IgniteInternalFuture<V> |
replaceAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if there is a previous mapping for it.
|
IgniteInternalFuture<Boolean> |
replaceAsync(K key,
V oldVal,
V newVal)
Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
boolean |
replacex(K key,
V val)
Stores given key-value pair in cache only if only if there is a previous mapping for it.
|
GridCacheReturn |
replacex(K key,
V oldVal,
V newVal)
Stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
IgniteInternalFuture<Boolean> |
replacexAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if only if there is a previous mapping for it.
|
IgniteInternalFuture<GridCacheReturn> |
replacexAsync(K key,
V oldVal,
V newVal)
Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
protected void |
saveFuture(GridCacheAdapter.FutureHolder holder,
IgniteInternalFuture<?> fut)
Saves future in thread local holder and adds listener
that will clear holder when future is finished.
|
int |
size()
Gets the number of all entries cached on this node.
|
int |
size(CachePeekMode[] peekModes) |
IgniteInternalFuture<Integer> |
sizeAsync(CachePeekMode[] peekModes) |
List<GridCacheClearAllRunnable<K,V>> |
splitClearLocally()
Split clearLocally all task into multiple runnables.
|
void |
start()
Starts this cache.
|
protected String |
startInfo()
Startup info.
|
void |
stop()
Stops this cache.
|
protected String |
stopInfo()
Stop info.
|
Iterator<Map.Entry<K,V>> |
swapIterator()
Gets iterator over keys and values belonging to this cache swap space on local node.
|
long |
swapKeys()
Gets number of swap entries (keys).
|
long |
swapSize()
Gets size in bytes for swap space.
|
ConcurrentMap<K,V> |
toMap()
Converts this API into standard Java
ConcurrentMap interface. |
String |
toString() |
Transaction |
tx()
Gets transaction started by this thread or
null if this thread does
not have a transaction. |
abstract IgniteInternalFuture<Boolean> |
txLockAsync(Collection<KeyCacheObject> keys,
long timeout,
IgniteTxLocalEx tx,
boolean isRead,
boolean retval,
TransactionIsolation isolation,
boolean invalidate,
long accessTtl,
CacheEntryPredicate[] filter) |
Transaction |
txStart()
Starts transaction with default isolation, concurrency, timeout, and invalidation policy.
|
Transaction |
txStart(TransactionConcurrency concurrency,
TransactionIsolation isolation)
Starts new transaction with the specified concurrency and isolation.
|
Transaction |
txStart(TransactionConcurrency concurrency,
TransactionIsolation isolation,
long timeout,
int txSize)
Starts transaction with specified isolation, concurrency, timeout, invalidation flag,
and number of participating entries.
|
IgniteInternalTx |
txStartEx(TransactionConcurrency concurrency,
TransactionIsolation isolation) |
Collection<TransactionSynchronization> |
txSynchronizations()
Gets registered transaction synchronizations.
|
void |
txSynchronize(TransactionSynchronization syncs)
Registers transactions synchronizations for all transactions started by this cache.
|
void |
txUnsynchronize(TransactionSynchronization syncs)
Removes transaction synchronizations.
|
void |
unlock(K key,
CacheEntryPredicate... filter)
Unlocks given key only if current thread owns the lock.
|
protected void |
validateCacheKey(Object key)
Validates that given cache key has overridden equals and hashCode methods and
implements
Externalizable. |
protected void |
validateCacheKeys(Iterable<?> keys)
Validates that given cache keys have overridden equals and hashCode methods and
implement
Externalizable. |
Collection<V> |
values()
Collection of values cached on this node.
|
Collection<V> |
values(CacheEntryPredicate... filter) |
GridCacheProjectionEx<K,V> |
withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc) |
void |
writeExternal(ObjectOutput out) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitlockAllAsync, removeAll, removeAllAsync, unlockAllpublic static final int CLEAR_ALL_SPLIT_THRESHOLD
protected static final IgniteClosure RET2NULL
GridCacheReturn-to-null conversion.protected boolean keyCheck
protected ThreadLocal<GridCacheAdapter.FutureHolder> lastFut
@GridToStringExclude protected GridCacheContext<K,V> ctx
@GridToStringExclude protected GridCacheConcurrentMap map
@GridToStringExclude protected UUID locNodeId
@GridToStringExclude protected CacheConfiguration cacheCfg
@GridToStringExclude protected IgniteConfiguration gridCfg
protected CacheMetricsImpl metrics
protected CacheMetricsMXBean mxBean
protected IgniteLogger log
protected GridCacheAdapter()
Externalizable.protected GridCacheAdapter(GridCacheContext<K,V> ctx, int startSize)
ctx - Cache context.startSize - Start size.protected GridCacheAdapter(GridCacheContext<K,V> ctx, GridCacheConcurrentMap map)
ctx - Cache context.map - Concurrent map.public String name()
null for default cache).name in interface CacheProjection<K,V>public ClusterGroup gridProjection()
gridProjection in interface CacheProjection<K,V>public void printMemoryStats()
public GridCacheConcurrentMap map()
public GridCacheContext<K,V> context()
context in interface GridCacheProjectionEx<K,V>protected IgniteLogger log()
public boolean isNear()
True if this is near cache.public boolean isLocal()
True if cache is local.public boolean isColocated()
True if cache is colocated.public boolean isDhtAtomic()
True if cache is DHT Atomic.public boolean isDht()
True if cache is DHT.public abstract GridCachePreloader<K,V> preloader()
public CacheQueries<K,V> queries()
queries in interface CacheProjection<K,V>public CacheAffinity<K> affinity()
public <K1,V1> GridCache<K1,V1> cache()
cache in interface CacheProjection<K,V>K1 - Cache key type.V1 - Cache value type.public Set<CacheFlag> flags()
flags in interface CacheProjection<K,V>public CacheEntryPredicate predicate()
null
if predicate is not defined.predicate in interface GridCacheProjectionEx<K,V>public GridCacheProjectionEx<K,V> forSubjectId(UUID subjId)
forSubjectId in interface GridCacheProjectionEx<K,V>subjId - Client ID.public CacheProjection<K,V> flagsOn(@Nullable CacheFlag[] flags)
flagsOn in interface CacheProjection<K,V>flags - Flags to turn on (if empty, then no-op).public CacheProjection<K,V> flagsOff(@Nullable CacheFlag[] flags)
flagsOff in interface CacheProjection<K,V>flags - Flags to turn off (if empty, then all flags will be turned off).public <K1,V1> CacheProjection<K1,V1> keepPortable()
Projection returned by this method will force cache not to deserialize portable objects, so keys and values will be returned from cache API methods without changes. Therefore, signature of the projection can contain only following types:
org.gridgain.grid.portables.PortableObject for portable 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 portable format), you should acquire following projection
to avoid deserialization:
CacheProjectionprj = cache.keepPortable(); // Value is not deserialized and returned in portable format. GridPortableObject po = prj.get(1);
Note that this method makes sense only if cache is working in portable mode
(org.apache.ignite.configuration.CacheConfiguration#isPortableEnabled() returns true. If not,
this method is no-op and will return current projection.
keepPortable in interface CacheProjection<K,V>public <K1,V1> GridCacheProjectionImpl<K1,V1> keepPortable0()
@Nullable public javax.cache.expiry.ExpiryPolicy expiry()
expiry in interface GridCacheProjectionEx<K,V>ExpiryPolicy associated with this projection.public GridCacheProjectionEx<K,V> withExpiryPolicy(javax.cache.expiry.ExpiryPolicy plc)
withExpiryPolicy in interface GridCacheProjectionEx<K,V>plc - ExpiryPolicy to associate with this projection.public <K1,V1> CacheProjection<K1,V1> projection(Class<? super K1> keyType, Class<? super V1> valType)
non-null key-value
pairs that have matching key and value pairs will be used in this projection.projection in interface CacheProjection<K,V>K1 - Key type.V1 - Value type.keyType - Key type.valType - Value type.public CacheProjection<K,V> projection(CacheEntryPredicate filter)
#projection(org.apache.ignite.lang.IgniteBiPredicate)
method, this filter will not be used for pre-filtering.projection in interface CacheProjection<K,V>filter - Filter to be passed through to all cache operations. If null, then the
same projection is returned. If cache operation receives its own filter, then filters
will be 'anded'.public CacheConfiguration configuration()
configuration in interface GridCache<K,V>public abstract IgniteInternalFuture<Boolean> txLockAsync(Collection<KeyCacheObject> keys, long timeout, IgniteTxLocalEx tx, boolean isRead, boolean retval, TransactionIsolation isolation, boolean invalidate, long accessTtl, CacheEntryPredicate[] filter)
keys - Keys to lock.timeout - Lock timeout.tx - Transaction.isRead - True for read operations.retval - Flag to return value.isolation - Transaction isolation.invalidate - Invalidate flag.accessTtl - TTL for read operation.filter - Optional filter.protected void init()
public void start()
throws IgniteCheckedException
IgniteCheckedException - If start failed.protected final String startInfo()
public void stop()
protected final String stopInfo()
protected void onKernalStart()
throws IgniteCheckedException
IgniteCheckedException - If callback failed.public void onKernalStop()
public boolean isEmpty()
true if this map contains no key-value mappings.isEmpty in interface CacheProjection<K,V>true if this map contains no key-value mappings.public boolean containsValue(V val)
true if this cache contains given value.containsValue in interface CacheProjection<K,V>val - Value to check.True if given value is present in cache.public boolean containsKey(K key)
containsKey in interface CacheProjection<K,V>key - Key.True if cache contains mapping for a given key.public IgniteInternalFuture<Boolean> containsKeyAsync(K key)
containsKeyAsync in interface CacheProjection<K,V>key - Key.public boolean containsKeys(Collection<? extends K> keys)
containsKeys in interface CacheProjection<K,V>keys - Keys,True if cache contains all keys.public IgniteInternalFuture<Boolean> containsKeysAsync(Collection<? extends K> keys)
containsKeysAsync in interface CacheProjection<K,V>keys - Keys to check.public Iterable<javax.cache.Cache.Entry<K,V>> localEntries(CachePeekMode[] peekModes) throws IgniteCheckedException
localEntries in interface CacheProjection<K,V>peekModes - Peek modes.IgniteCheckedException - If failed.@Nullable public V localPeek(K key, CachePeekMode[] peekModes, @Nullable IgniteCacheExpiryPolicy plc) throws IgniteCheckedException
localPeek in interface CacheProjection<K,V>key - Key.peekModes - Peek modes.plc - Expiry policy if TTL should be updated.IgniteCheckedException - If failed.public V peek(K key)
GridCachePeekMode.SMART
peek mode.
This method will not load value from any persistent store or from a remote node.
GridCachePeekMode.SMART mode
semantics. If you need to look at global cached value even from within transaction,
you can use CacheProjection.peek(Object, Collection) method.peek in interface CacheProjection<K,V>key - Entry key.public V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException
non-null value is found, it will be immediately returned.
Note that if modes are not provided this method works exactly the same way as
CacheProjection.peek(Object), implicitly using GridCachePeekMode.SMART mode.
peek in interface CacheProjection<K,V>key - Entry key.modes - Optional set of peek modes.IgniteCheckedException - If peek operation failed.@Nullable protected GridTuple<V> peek0(boolean failFast, K key, GridCachePeekMode mode, @Nullable CacheEntryPredicate... filter) throws GridCacheFilterFailedException
failFast - Fail fast flag.key - Key.mode - Peek mode.filter - Filter.GridCacheFilterFailedException - If filter failed.@Nullable protected V peek0(K key, @Nullable Collection<GridCachePeekMode> modes, IgniteInternalTx tx) throws IgniteCheckedException
key - Key.modes - Peek modes.tx - Transaction to peek at (if modes contains TX value).IgniteCheckedException - In case of error.@Nullable protected GridTuple<V> peek0(boolean failFast, K key, @Nullable Collection<GridCachePeekMode> modes, IgniteInternalTx tx) throws IgniteCheckedException, GridCacheFilterFailedException
failFast - If true, then filter failure will result in exception.key - Key.modes - Peek modes.tx - Transaction to peek at (if modes contains TX value).IgniteCheckedException - In case of error.GridCacheFilterFailedException - If filer validation failed.protected Map<K,V> peekAll0(@Nullable Collection<? extends K> keys, @Nullable Collection<GridCachePeekMode> modes, IgniteInternalTx tx, @Nullable Collection<K> skipped) throws IgniteCheckedException
keys - Keys.modes - Modes.tx - Transaction.skipped - Keys skipped during filter validation.IgniteCheckedException - If failed.public void onUndeploy(ClassLoader ldr)
ldr - Class loader to undeploy.@Nullable public javax.cache.Cache.Entry<K,V> entry(K key)
Note that this method can return null if projection is configured as
pre-filtered and entry key and value don't pass key-value filter of the projection.
entry in interface CacheProjection<K,V>key - Entry key.null if projection pre-filtering was not passed.@Nullable public GridCacheEntryEx peekEx(KeyCacheObject key)
key - Entry key.@Nullable public GridCacheEntryEx peekEx(Object key)
key - Entry key.public GridCacheEntryEx entryEx(Object key)
key - Entry key.null).public GridCacheEntryEx entryEx(KeyCacheObject key)
key - Entry key.null).public GridCacheEntryEx entryEx(KeyCacheObject key, boolean touch)
key - Entry key.touch - Whether created entry should be touched.null).public GridCacheEntryEx entryEx(KeyCacheObject key, long topVer)
topVer - Topology version.key - Entry key.null).public Set<GridCacheEntryEx> entries()
GridCacheInternal keys.public Set<GridCacheEntryEx> allEntries()
GridCacheInternal keys.public Set<javax.cache.Cache.Entry<K,V>> entrySet()
NOTE: this operation is not distributed and returns only the entries cached on this node.
entrySet in interface CacheProjection<K,V>public Set<javax.cache.Cache.Entry<K,V>> entrySetx(CacheEntryPredicate... filter)
entrySetx in interface GridCacheProjectionEx<K,V>filter - Filter.public Set<javax.cache.Cache.Entry<K,V>> primaryEntrySetx(CacheEntryPredicate... filter)
primaryEntrySetx in interface GridCacheProjectionEx<K,V>filter - Optional filter.public Set<javax.cache.Cache.Entry<K,V>> entrySet(int part)
null
if partition is not found locally.
NOTE: this operation is not distributed and returns only the entries cached on this node.
entrySet in interface CacheProjection<K,V>part - Partition.null if partition is
not found locally.public Set<javax.cache.Cache.Entry<K,V>> primaryEntrySet()
NOTE: this operation is not distributed and returns only the entries cached on this node.
primaryEntrySet in interface CacheProjection<K,V>public Set<K> keySet()
Iterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the keys cached on this node.
keySet in interface CacheProjection<K,V>public Set<K> primaryKeySet()
null because they were invalidated. You can remove elements from
this set, but you cannot add elements to this set. All removal operation will be
reflected on the cache itself.
Iterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the keys cached on this node.
primaryKeySet in interface CacheProjection<K,V>public Collection<V> values()
Iterator over this collection will not fail if collection was concurrently updated by another thread. This means that iterator may or may not return latest values depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the values cached on this node.
values in interface CacheProjection<K,V>public Collection<V> values(CacheEntryPredicate... filter)
public Collection<V> primaryValues()
null
because they were invalided. You can remove elements from this collection,
but you cannot add elements to this collection. All removal operation will be
reflected on the cache itself.
Iterator over this collection will not fail if collection was concurrently updated by another thread. This means that iterator may or may not return latest values depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the values cached on this node.
primaryValues in interface CacheProjection<K,V>public void removeIfObsolete(KeyCacheObject key)
key - Entry key.public List<GridCacheClearAllRunnable<K,V>> splitClearLocally()
public boolean clearLocally(K key)
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entries will
also be cleared from swap.
Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.
CacheFlag.READ.clearLocally in interface CacheProjection<K,V>key - Key to clearLocally.True if entry was successfully cleared from cache, false
if entry was in use at the time of this method invocation and could not be
cleared.public void clearLocallyAll(Set<K> keys)
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entries will
also be cleared from swap.
Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.
CacheFlag.READ.clearLocallyAll in interface CacheProjection<K,V>keys - Keys to clearLocally.public void clearLocally()
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entries will
also be cleared from swap.
Note that this operation is local as it merely clears entries from local cache. It does not remove entries from remote caches or from underlying persistent storage.
CacheFlag.READ.clearLocally in interface CacheProjection<K,V>public void clearLocally(Collection<KeyCacheObject> keys, boolean readers)
keys - Keys.readers - Readers flag.public void clear()
throws IgniteCheckedException
CacheProjection.clearLocally() method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
This method is identical to calling clear(0).
clear in interface CacheProjection<K,V>IgniteCheckedException - In case of cache could not be cleared on any of the nodes.public void clear(K key) throws IgniteCheckedException
CacheProjection.clearLocally(Object) method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
clear in interface CacheProjection<K,V>key - Key to clear.IgniteCheckedException - In case of cache could not be cleared on any of the nodes.public void clearAll(Set<K> keys) throws IgniteCheckedException
CacheProjection.clearLocallyAll(Set) method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
clearAll in interface CacheProjection<K,V>keys - Keys to clear.IgniteCheckedException - In case of cache could not be cleared on any of the nodes.public IgniteInternalFuture<?> clearAsync(K key)
clearAsync in interface CacheProjection<K,V>key - Key to clear.public IgniteInternalFuture<?> clearAsync(Set<K> keys)
clearAsync in interface CacheProjection<K,V>keys - Keys to clear.public void clear(long timeout)
throws IgniteCheckedException
CacheProjection.clearLocally() method which only
clears local node's cache.
Ignite will make the best attempt to clearLocally caches on all nodes. If some caches could not be cleared, then exception will be thrown.
clear in interface CacheProjection<K,V>timeout - Timeout for clearLocally all task in milliseconds (0 for never).
Set it to larger value for large caches.IgniteCheckedException - In case of cache could not be cleared on any of the nodes.public IgniteInternalFuture<?> clearAsync()
clearAsync in interface CacheProjection<K,V>public void removeEntry(GridCacheEntryEx entry)
entry - Removes entry from cache if currently mapped value is the same as passed.public V get(K key, @Nullable GridCacheEntryEx entry, boolean deserializePortable, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
get in interface GridCacheProjectionEx<K,V>key - Key to retrieve the value for.entry - Cached entry when called from entry wrapper.filter - Filter to check prior to getting the value. Note that filter check
together with getting the value is an atomic operation.IgniteCheckedException - If failed.public V getForcePrimary(K key) throws IgniteCheckedException
getForcePrimary in interface GridCacheProjectionEx<K,V>key - Key to get value for.IgniteCheckedException - If failed.public IgniteInternalFuture<V> getForcePrimaryAsync(K key)
getForcePrimaryAsync in interface GridCacheProjectionEx<K,V>key - Key to get value for.@Nullable public Map<K,V> getAllOutTx(List<K> keys) throws IgniteCheckedException
getAllOutTx in interface GridCacheProjectionEx<K,V>keys - Keys to get values for.IgniteCheckedException - If failed.public IgniteInternalFuture<Map<K,V>> getAllOutTxAsync(List<K> keys)
getAllOutTxAsync in interface GridCacheProjectionEx<K,V>keys - Keys to get values for.public IgniteInternalFuture<Object> readThroughAllAsync(Collection<KeyCacheObject> keys, boolean reload, boolean skipVals, @Nullable IgniteInternalTx tx, @Nullable UUID subjId, String taskName, IgniteBiInClosure<KeyCacheObject,Object> vis)
keys - Keys.reload - Reload flag.tx - Transaction.subjId - Subject ID.taskName - Task name.vis - Visitor.public IgniteInternalFuture<Map<KeyCacheObject,CacheObject>> reloadAllAsync0(Collection<KeyCacheObject> keys, boolean ret, boolean skipVals, @Nullable UUID subjId, String taskName)
keys - Keys.ret - Return flag.skipVals - Skip values flag.subjId - Subject ID.taskName - Task name.@Nullable protected GridCacheEntryEx entryExSafe(KeyCacheObject key, long topVer)
key - Key.topVer - Topology version.public boolean evict(K key)
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entry will
be swapped to offheap, and then to disk.
CacheFlag.READ.evict in interface CacheProjection<K,V>key - Key to evict from cache.True if entry could be evicted, false otherwise.public void evictAll()
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entry will
be swapped to offheap, and then to disk.
CacheFlag.READ.evictAll in interface CacheProjection<K,V>public void evictAll(Collection<? extends K> keys)
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entry will
be swapped to offheap, and then to disk.
CacheFlag.READ.evictAll in interface CacheProjection<K,V>keys - Keys to evict.@Nullable public V get(K key) throws IgniteCheckedException
null
means entry did not pass the provided filter or cache has no mapping for the
key.
If the value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disable, and if read-through is allowed, value
will be loaded from CacheStore persistent storage via
CacheStore#load(Transaction, Object) method.
CacheFlag.LOCAL flag is set on projection.get in interface CacheProjection<K,V>key - Key to retrieve the value for.IgniteCheckedException - If get operation failed.public IgniteInternalFuture<V> getAsync(K key)
null
means entry did not pass the provided filter or cache has no mapping for the
key.
If the value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore persistent storage via
CacheStore#load(Transaction, Object) method.
CacheFlag.LOCAL flag is set on projection.getAsync in interface CacheProjection<K,V>key - Key for the value to get.public Map<K,V> getAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException
If some value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore persistent storage via
CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method.
CacheFlag.LOCAL flag is set on projection.getAll in interface CacheProjection<K,V>keys - Keys to get.IgniteCheckedException - If get operation failed.public IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys)
If some value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore persistent storage via
CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method.
CacheFlag.LOCAL flag is set on projection.getAllAsync in interface CacheProjection<K,V>keys - Key for the value to get.protected IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, @Nullable GridCacheEntryEx entry, @Nullable UUID subjId, String taskName, boolean deserializePortable, boolean skipVals)
public IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys, boolean readThrough, @Nullable GridCacheEntryEx cached, boolean checkTx, @Nullable UUID subjId, String taskName, boolean deserializePortable, boolean forcePrimary, @Nullable IgniteCacheExpiryPolicy expiry, boolean skipVals)
public <K1,V1> IgniteInternalFuture<Map<K1,V1>> getAllAsync0(@Nullable Collection<KeyCacheObject> keys, boolean readThrough, boolean checkTx, @Nullable UUID subjId, String taskName, boolean deserializePortable, @Nullable IgniteCacheExpiryPolicy expiry, boolean skipVals, boolean keepCacheObjects)
keys - Keys.readThrough - Read-through flag.checkTx - Check local transaction flag.subjId - Subject ID.taskName - Task name/deserializePortable - Deserialize portable flag.expiry - Expiry policy.skipVals - Skip values flag.keepCacheObjects - Keep cache objectspublic V put(K key, V val, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
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, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) 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 CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.put in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.filter - Optional filter to check prior to putting value in cache. Note
that filter check is atomic with put operation.null
if entry did not pass the filter, or if there was no mapping for the key in swap
or in persistent storage.IgniteCheckedException - If put operation failed.@Nullable public V put(K key, V val, @Nullable GridCacheEntryEx cached, long ttl, @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException
GridCacheEntryImpl.put in interface GridCacheProjectionEx<K,V>key - Key.val - Value.cached - Cached entry. If not provided, equivalent to {CacheProjection#put}.ttl - Optional time-to-live. If negative, leaves ttl value unchanged.filter - Optional filter.IgniteCheckedException - If failed.public boolean putx(K key, V val, @Nullable GridCacheEntryEx cached, long ttl, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
GridCacheEntryImpl.putx in interface GridCacheProjectionEx<K,V>key - Key.val - Value.cached - Cached entry. If not provided, equivalent to {CacheProjection#put}.ttl - Optional time-to-live. If negative, leaves ttl value unchanged.filter - Optional filter.IgniteCheckedException - If failed.public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable CacheEntryPredicate[] filter)
CacheMode.REPLICATED caches, the value will be loaded from swap
and, if it's not there, and read-through is allowed, from the underlying
CacheStore storage. In case of CacheMode.PARTITIONED 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 and read-through is allowed,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) 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 CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.putAsync in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.filter - Optional filter to check prior to putting value in cache. Note
that filter check is atomic with put operation.public IgniteInternalFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx entry, long ttl, @Nullable CacheEntryPredicate... filter)
GridCacheEntryImpl.putAsync in interface GridCacheProjectionEx<K,V>key - Key.val - Value.entry - Optional cached entry.ttl - Optional time-to-live value. If negative, leaves ttl value unchanged.filter - Optional filter.public boolean putx(K key, V val, CacheEntryPredicate[] filter) throws IgniteCheckedException
This method will return true if value is stored in cache and false otherwise.
Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous
value and, therefore, does not have any overhead associated with returning a value. It
should be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.putx in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.filter - Optional filter to check prior to putting value in cache. Note
that filter check is atomic with put operation.True if optional filter passed and value was stored in cache,
false otherwise. Note that this method will return true if filter is not
specified.IgniteCheckedException - If put operation failed.public void putAllConflict(Map<KeyCacheObject,GridCacheDrInfo> drMap) throws IgniteCheckedException
putAllConflict in interface GridCacheProjectionEx<K,V>drMap - DR map.IgniteCheckedException - If put operation failed.public IgniteInternalFuture<?> putAllConflictAsync(Map<KeyCacheObject,GridCacheDrInfo> drMap) throws IgniteCheckedException
putAllConflictAsync in interface GridCacheProjectionEx<K,V>drMap - DR map.IgniteCheckedException - If put operation failed.public <T> javax.cache.processor.EntryProcessorResult<T> invoke(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws IgniteCheckedException
invoke in interface GridCacheProjectionEx<K,V>key - Key.entryProcessor - Entry processor.args - Arguments.IgniteCheckedException - If failed.public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws IgniteCheckedException
invokeAll in interface GridCacheProjectionEx<K,V>keys - Keys.entryProcessor - Entry processor.args - Arguments.IgniteCheckedException - If failed.public <T> IgniteInternalFuture<javax.cache.processor.EntryProcessorResult<T>> invokeAsync(K key, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args) throws javax.cache.processor.EntryProcessorException
invokeAsync in interface GridCacheProjectionEx<K,V>key - Key.entryProcessor - Entry processor.args - Arguments.javax.cache.processor.EntryProcessorExceptionpublic <T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys, javax.cache.processor.EntryProcessor<K,V,T> entryProcessor, Object... args)
invokeAllAsync in interface GridCacheProjectionEx<K,V>keys - Keys.entryProcessor - Entry processor.args - Arguments.public <T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args)
invokeAllAsync in interface GridCacheProjectionEx<K,V>map - Map containing keys and entry processors to be applied to values.args - Arguments.public <T> Map<K,javax.cache.processor.EntryProcessorResult<T>> invokeAll(Map<? extends K,? extends javax.cache.processor.EntryProcessor<K,V,T>> map, Object... args) throws IgniteCheckedException
invokeAll in interface GridCacheProjectionEx<K,V>map - Map containing keys and entry processors to be applied to values.args - Arguments.IgniteCheckedException - If failed.public IgniteInternalFuture<Boolean> putxAsync(K key, V val, @Nullable CacheEntryPredicate... filter)
This method will return true if value is stored in cache and false otherwise.
Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.putxAsync in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.filter - Optional filter to check prior to putting value in cache. Note
that filter check is atomic with put operation.true if optional filter
passed and value was stored in cache, false otherwise. Note that future will
return true if filter is not specified.public IgniteInternalFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx entry, long ttl, @Nullable CacheEntryPredicate... filter)
GridCacheEntryImpl.putxAsync in interface GridCacheProjectionEx<K,V>key - Key.val - Value.entry - Cached entry. If not provided, equivalent to {CacheProjection#put}.ttl - Optional time-to-live. If negative, leave ttl value unchanged.filter - Optional filter.@Nullable public V putIfAbsent(K key, V val) throws IgniteCheckedException
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, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method CacheProjection.putxIfAbsent(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 CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.putIfAbsent in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.IgniteCheckedException - If put operation failed.public IgniteInternalFuture<V> putIfAbsentAsync(K key, V val)
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, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method CacheProjection.putxIfAbsentAsync(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 CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.putIfAbsentAsync in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.public boolean putxIfAbsent(K key, V val) throws IgniteCheckedException
This method will return true if value is stored in cache and false otherwise.
Unlike CacheProjection.putIfAbsent(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.putxIfAbsent in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.true if value is stored in cache and false otherwise.IgniteCheckedException - If put operation failed.public IgniteInternalFuture<Boolean> putxIfAbsentAsync(K key, V val)
This method will return true if value is stored in cache and false otherwise.
Unlike CacheProjection.putIfAbsent(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.putxIfAbsentAsync in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.@Nullable public V replace(K key, V val) throws IgniteCheckedException
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, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method CacheProjection.replacex(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 CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.replace in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.IgniteCheckedException - If replace operation failed.public IgniteInternalFuture<V> replaceAsync(K key, V val)
CacheMode.PARTITIONED 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, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method CacheProjection.replacex(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 CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.replaceAsync in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.public boolean replacex(K key, V val) throws IgniteCheckedException
This method will return true if value is stored in cache and false otherwise.
Unlike CacheProjection.replace(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.replacex in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.True if replace happened, false otherwise.IgniteCheckedException - If replace operation failed.public IgniteInternalFuture<Boolean> replacexAsync(K key, V val)
This method will return true if value is stored in cache and false otherwise.
Unlike CacheProjection.replaceAsync(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.replacexAsync in interface CacheProjection<K,V>key - Key to store in cache.val - Value to be associated with the given key.public boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.replace in interface CacheProjection<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.True if replace happened, false otherwise.IgniteCheckedException - If replace operation failed.public IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal)
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.replaceAsync in interface CacheProjection<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.public void putAll(@Nullable Map<? extends K,? extends V> m, CacheEntryPredicate[] filter) throws IgniteCheckedException
If write-through is enabled, the stored values will be persisted to CacheStore
via CacheStore#putAll(Transaction, Map) method.
CacheFlag.LOCAL, CacheFlag.READ.putAll in interface CacheProjection<K,V>m - Key-value pairs to store in cache.filter - Optional entry filter. If provided, then entry will
be stored only if the filter returned true.IgniteCheckedException - If put operation failed.public IgniteInternalFuture<?> putAllAsync(Map<? extends K,? extends V> m, @Nullable CacheEntryPredicate... filter)
If write-through is enabled, the stored values will be persisted to CacheStore
via CacheStore#putAll(Transaction, Map) method.
CacheFlag.LOCAL, CacheFlag.READ.putAllAsync in interface CacheProjection<K,V>m - Key-value pairs to store in cache.filter - Optional entry filter. If provided, then entry will
be stored only if the filter returned true.@Nullable public V remove(K key, CacheEntryPredicate[] filter) throws IgniteCheckedException
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 disk-based swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[]) 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 value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.remove in interface CacheProjection<K,V>key - Key whose mapping is to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.null
if there was no value for this key.IgniteCheckedException - If remove operation failed.public V remove(K key, @Nullable GridCacheEntryEx entry, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
GridCacheEntryImpl.remove in interface GridCacheProjectionEx<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {CacheProjection#put}.filter - Optional filter.IgniteCheckedException - If failed.public IgniteInternalFuture<V> removeAsync(K key, CacheEntryPredicate... filter)
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, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[]) 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 value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.removeAsync in interface CacheProjection<K,V>key - Key whose mapping is to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.public IgniteInternalFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx entry, @Nullable CacheEntryPredicate... filter)
GridCacheEntryImpl.removeAsync in interface GridCacheProjectionEx<K,V>key - Key to remove.entry - Optional cached entry.filter - Optional filter.public void removeAll(Collection<? extends K> keys, CacheEntryPredicate... filter) throws IgniteCheckedException
If write-through is enabled, the values will be removed from CacheStore
via CacheStore#removeAll(Transaction, Collection) method.
CacheFlag.LOCAL, CacheFlag.READ.removeAll in interface CacheProjection<K,V>keys - Keys whose mappings are to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.IgniteCheckedException - If remove failed.public IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys, CacheEntryPredicate... filter)
If write-through is enabled, the values will be removed from CacheStore
via CacheStore#removeAll(Transaction, Collection) method.
CacheFlag.LOCAL, CacheFlag.READ.removeAllAsync in interface CacheProjection<K,V>keys - Keys whose mappings are to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.public boolean removex(K key, CacheEntryPredicate... filter) throws IgniteCheckedException
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.removex in interface CacheProjection<K,V>key - Key whose mapping is to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.True if filter passed validation and entry was removed, false otherwise.
Note that if filter is not specified, this method will return true.IgniteCheckedException - If remove failed.public boolean removex(K key, @Nullable GridCacheEntryEx entry, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
GridCacheEntryImpl.removex in interface GridCacheProjectionEx<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {CacheProjection#put}.filter - Optional filter.IgniteCheckedException - If failed.public IgniteInternalFuture<Boolean> removexAsync(K key, CacheEntryPredicate... filter)
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.removexAsync in interface CacheProjection<K,V>key - Key whose mapping is to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.true
if optional filters passed validation and remove did occur, false otherwise.
Note that if filter is not specified, this method will return true.public IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx entry, @Nullable CacheEntryPredicate... filter)
GridCacheEntryImpl.removexAsync in interface GridCacheProjectionEx<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {CacheProjection#put}.filter - Optional filter.public GridCacheReturn removex(K key, V val) throws IgniteCheckedException
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.removex in interface GridCacheProjectionEx<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.IgniteCheckedException - If remove failed.public void removeAllConflict(Map<KeyCacheObject,GridCacheVersion> drMap) throws IgniteCheckedException
removeAllConflict in interface GridCacheProjectionEx<K,V>drMap - DR map.IgniteCheckedException - If remove failed.public IgniteInternalFuture<?> removeAllConflictAsync(Map<KeyCacheObject,GridCacheVersion> drMap) throws IgniteCheckedException
removeAllConflictAsync in interface GridCacheProjectionEx<K,V>drMap - DR map.IgniteCheckedException - If remove failed.public GridCacheReturn replacex(K key, V oldVal, V newVal) throws IgniteCheckedException
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.replacex in interface GridCacheProjectionEx<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.IgniteCheckedException - If replace operation failed.public IgniteInternalFuture<GridCacheReturn> removexAsync(K key, V val)
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.removexAsync in interface GridCacheProjectionEx<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.public IgniteInternalFuture<GridCacheReturn> replacexAsync(K key, V oldVal, V newVal)
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.replacexAsync in interface GridCacheProjectionEx<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.public boolean remove(K key, V val) throws IgniteCheckedException
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.remove in interface CacheProjection<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.True if entry was removed and passed in value matched the cached one,
false otherwise.IgniteCheckedException - If remove failed.public IgniteInternalFuture<Boolean> removeAsync(K key, V val)
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.removeAsync in interface CacheProjection<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.true
if currently cached value will match the passed in one.public IgniteInternalFuture<?> localRemoveAll(CacheEntryPredicate filter)
filter - Filter.public void localRemoveAll()
throws IgniteCheckedException
localRemoveAll in interface CacheProjection<K,V>IgniteCheckedException - If failed.public CacheMetrics metrics()
public CacheMetricsMXBean mxBean()
public CacheMetricsImpl metrics0()
@Nullable public Transaction tx()
null if this thread does
not have a transaction.tx in interface CacheProjection<K,V>null if this thread
does not have a transaction.public boolean lock(K key, long timeout, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.lock in interface CacheProjection<K,V>key - Key to lock.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration), -1 for immediate failure if
lock cannot be acquired immediately).filter - Optional filter to validate prior to acquiring the lock.True if all filters passed and lock was acquired,
false otherwise.IgniteCheckedException - If lock acquisition resulted in error.public boolean lockAll(@Nullable Collection<? extends K> keys, long timeout, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.lockAll in interface CacheProjection<K,V>keys - Keys to lock.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration).filter - Optional filter that needs to atomically pass in order for the locks
to be acquired.True if all filters passed and locks were acquired before
timeout has expired, false otherwise.IgniteCheckedException - If lock acquisition resulted in error.public IgniteInternalFuture<Boolean> lockAsync(K key, long timeout, @Nullable CacheEntryPredicate... filter)
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.lockAsync in interface CacheProjection<K,V>key - Key to lock.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration, -1 for immediate failure if
lock cannot be acquired immediately).filter - Optional filter to validate prior to acquiring the lock.true
whenever all filters pass and locks are acquired before timeout is expired,
false otherwise.public void unlock(K key, CacheEntryPredicate... filter) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.unlock in interface CacheProjection<K,V>key - Key to unlock.filter - Optional filter that needs to pass prior to unlock taking effect.IgniteCheckedException - If unlock execution resulted in error.public boolean isLocked(K key)
This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
isLocked in interface CacheProjection<K,V>key - Key to check.True if lock is owned by some node.public boolean isLockedByThread(K key)
This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
isLockedByThread in interface CacheProjection<K,V>key - Key to check.True if key is locked by current thread.public Transaction txStart() throws IllegalStateException
CacheConfiguration at startup.txStart in interface CacheProjection<K,V>IllegalStateException - If transaction is already started by this thread.public Transaction txStart(TransactionConcurrency concurrency, TransactionIsolation isolation)
txStart in interface CacheProjection<K,V>concurrency - Concurrency.isolation - Isolation.public IgniteInternalTx txStartEx(TransactionConcurrency concurrency, TransactionIsolation isolation)
txStartEx in interface CacheProjection<K,V>concurrency - Concurrency.isolation - Isolation.public Transaction txStart(TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, int txSize) throws IllegalStateException
txStart in interface CacheProjection<K,V>concurrency - Concurrency.isolation - Isolation.timeout - Timeout.txSize - Number of entries participating in transaction (may be approximate).IllegalStateException - If transaction is already started by this thread.public long overflowSize()
throws IgniteCheckedException
overflowSize in interface GridCache<K,V>IgniteCheckedException - In case of error.public ConcurrentMap<K,V> toMap()
ConcurrentMap interface.toMap in interface CacheProjection<K,V>ConcurrentMap representation of given cache projection.protected void checkJta()
throws IgniteCheckedException
IgniteCheckedException - In case of error.public void txSynchronize(TransactionSynchronization syncs)
txSynchronize in interface GridCache<K,V>syncs - Transaction synchronizations to register.public void txUnsynchronize(TransactionSynchronization syncs)
txUnsynchronize in interface GridCache<K,V>syncs - Transactions synchronizations to remove.GridCache.txSynchronize(TransactionSynchronization)public Collection<TransactionSynchronization> txSynchronizations()
txSynchronizations in interface GridCache<K,V>GridCache.txSynchronize(TransactionSynchronization)public void localLoadCache(IgniteBiPredicate<K,V> p, Object[] args) throws IgniteCheckedException
CacheStore.loadCache(org.apache.ignite.lang.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 GridCacheProjectionEx<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(org.apache.ignite.lang.IgniteBiInClosure, Object...) method.IgniteCheckedException - If loading failed.public IgniteInternalFuture<?> localLoadCacheAsync(IgniteBiPredicate<K,V> p, Object[] args)
CacheStore.loadCache(org.apache.ignite.lang.IgniteBiInClosure, Object...) method
to reload state from the underlying persistent storage. The reloaded 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 reloaded 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 GridCacheProjectionEx<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(org.apache.ignite.lang.IgniteBiInClosure,Object...) method.public IgniteInternalFuture<?> loadAll(Set<? extends K> keys, boolean replaceExisting)
keys - Keys.replaceExisting - Replace existing values flag.public void localLoad(Collection<? extends K> keys, @Nullable javax.cache.expiry.ExpiryPolicy plc) throws IgniteCheckedException
keys - Keys to load.plc - Optional expiry policy.IgniteCheckedException - If failed.@Nullable public javax.cache.Cache.Entry<K,V> randomEntry()
O(S * N/64)where
N is the size of internal hash
table and S is the number of hash table buckets to sample, which is 5
by default. However, if the table is pretty dense, with density factor of N/64,
which is true for near fully populated caches, this method will generally perform significantly
faster with complexity of O(S) where S = 5.
Note that this method is not available on CacheProjection API since it is
impossible (or very hard) to deterministically return a number value when pre-filtering
and post-filtering is involved (e.g. projection level predicate filters).
randomEntry in interface GridCache<K,V>null if cache is empty.public int size(CachePeekMode[] peekModes) throws IgniteCheckedException
size in interface CacheProjection<K,V>peekModes - Peek modes.IgniteCheckedException - If failed.public IgniteInternalFuture<Integer> sizeAsync(CachePeekMode[] peekModes)
sizeAsync in interface CacheProjection<K,V>peekModes - Peek modes.public int localSize(CachePeekMode[] peekModes) throws IgniteCheckedException
localSize in interface CacheProjection<K,V>peekModes - Peek modes.IgniteCheckedException - If failed.public int size()
GridCache projection. It is essentially the
size of cache key set and is semantically identical to {Cache.keySet().size().
NOTE: this operation is not distributed and returns only the number of entries cached on this node.
size in interface CacheProjection<K,V>public int globalSize()
throws IgniteCheckedException
NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
globalSize in interface CacheProjection<K,V>IgniteCheckedExceptionpublic int nearSize()
Note that for LOCAL non-distributed caches this method will always return 0
nearSize in interface CacheProjection<K,V>0 if cache is not CacheMode.PARTITIONED.public int primarySize()
CacheMode.LOCAL non-distributed
cache mode, this method is identical to CacheProjection.size().
For CacheMode.PARTITIONED and CacheMode.REPLICATED modes, this method will
return number of primary entries cached on this node (excluding any backups). The complexity of
this method is O(P), where P is the total number of partitions.
NOTE: this operation is not distributed and returns only the number of primary entries cached on this node.
primarySize in interface CacheProjection<K,V>public int globalPrimarySize()
throws IgniteCheckedException
NOTE: this operation is distributed and will query all participating nodes for their primary cache sizes.
globalPrimarySize in interface CacheProjection<K,V>IgniteCheckedExceptionpublic Iterator<javax.cache.Cache.Entry<K,V>> igniteIterator()
@Nullable public V promote(K key) throws IgniteCheckedException
CacheFlag.SKIP_SWAP, CacheFlag.READ.promote in interface CacheProjection<K,V>key - Key to promote entry for.null for non-existing key.IgniteCheckedException - If promote failed.@Nullable public V promote(K key, boolean deserializePortable) throws IgniteCheckedException
key - Key.deserializePortable - Deserialize portable flag.IgniteCheckedException - If failed.public void promoteAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException
CacheFlag.SKIP_SWAP, CacheFlag.READ.promoteAll in interface CacheProjection<K,V>keys - Keys to promote entries for.IgniteCheckedException - If promote failed.public Iterator<Map.Entry<K,V>> swapIterator() throws IgniteCheckedException
Returned iterator supports remove operation which delegates to
#removex(Object, org.apache.ignite.lang.IgnitePredicate[]) method.
CacheFlag.SKIP_SWAP.swapIterator in interface GridCache<K,V>IgniteCheckedException - If failed.CacheProjection.promote(Object)public Iterator<Map.Entry<K,V>> offHeapIterator() throws IgniteCheckedException
Returned iterator supports remove operation which delegates to
#removex(Object, org.apache.ignite.lang.IgnitePredicate[]) method.
offHeapIterator in interface GridCache<K,V>IgniteCheckedException - If failed.public long offHeapEntriesCount()
offHeapEntriesCount in interface GridCache<K,V>public long offHeapAllocatedSize()
offHeapAllocatedSize in interface GridCache<K,V>public long swapSize()
throws IgniteCheckedException
swapSize in interface GridCache<K,V>IgniteCheckedException - If failed.public long swapKeys()
throws IgniteCheckedException
swapKeys in interface GridCache<K,V>IgniteCheckedException - If failed.public IgniteInternalFuture<IgniteInternalTx> commitTxAsync(IgniteInternalTx tx)
tx - Transaction to commit.public void awaitLastFut()
protected <T> IgniteInternalFuture<T> asyncOp(IgniteTxLocalAdapter tx, GridCacheAdapter.AsyncOp<T> op)
T - Return type.tx - Transaction.op - Cache operation.protected void saveFuture(GridCacheAdapter.FutureHolder holder, IgniteInternalFuture<?> fut)
holder - Future holder.fut - Future to save.@Nullable protected <T> IgniteInternalFuture<T> asyncOpAcquire()
protected void asyncOpRelease()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionprotected Object readResolve() throws ObjectStreamException
ObjectStreamException - Thrown in case of unmarshalling error.public IgniteInternalFuture<?> forceRepartition()
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
CacheRendezvousAffinityFunction.setHashIdResolver(CacheAffinityNodeHashResolver) 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.
forceRepartition in interface GridCache<K,V>public boolean isIgfsDataCache()
isIgfsDataCache in interface GridCacheProjectionEx<K,V>True in case this cache is IGFS data cache.public long igfsDataSpaceUsed()
igfsDataSpaceUsed in interface GridCacheProjectionEx<K,V>public long igfsDataSpaceMax()
igfsDataSpaceMax in interface GridCacheProjectionEx<K,V>public boolean isMongoDataCache()
isMongoDataCache in interface GridCacheProjectionEx<K,V>True if this cache is mongo data cache.public boolean isMongoMetaCache()
isMongoMetaCache in interface GridCacheProjectionEx<K,V>True if this cache is mongo meta cache.public void onIgfsDataSizeChanged(long delta)
delta - Size delta.public void clearLocally0(Collection<? extends K> keys, @Nullable CacheEntryPredicate... filter)
keys - Keys.filter - Filters to evaluate.public boolean clearLocally0(K key, @Nullable CacheEntryPredicate... filter)
key - Key.filter - Filters to evaluate.True if cleared.public boolean evict(K key, @Nullable CacheEntryPredicate... filter)
key - Key.filter - Filters to evaluate.True if evicted.public void evictAll(Collection<? extends K> keys, @Nullable CacheEntryPredicate... filter)
keys - Keys.filter - Filters to evaluate.public V peek(K key, @Nullable CacheEntryPredicate filter)
key - Key.filter - Filter to evaluate.public Set<javax.cache.Cache.Entry<K,V>> entrySet(@Nullable CacheEntryPredicate... filter)
filter - Filters to evaluate.public Set<javax.cache.Cache.Entry<K,V>> primaryEntrySet(@Nullable CacheEntryPredicate... filter)
filter - Filters to evaluate.public Set<K> keySet(@Nullable CacheEntryPredicate... filter)
CacheProjectionIterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the keys cached on this node.
keySet in interface CacheProjection<K,V>filter - Filters to evaluate.public Set<K> primaryKeySet(@Nullable CacheEntryPredicate... filter)
filter - Primary key set.public Collection<V> primaryValues(@Nullable CacheEntryPredicate... filter)
filter - Filters to evaluate.@Nullable public V get(K key, boolean deserializePortable) throws IgniteCheckedException
key - Key.deserializePortable - Deserialize portable flag.IgniteCheckedException - If failed.public final IgniteInternalFuture<V> getAsync(K key, boolean deserializePortable)
key - Key.deserializePortable - Deserialize portable flag.public Map<K,V> getAll(Collection<? extends K> keys, boolean deserializePortable) throws IgniteCheckedException
keys - Keys.deserializePortable - Deserialize portable flag.IgniteCheckedException - If read failed.@Nullable public V reload(K key) throws IgniteCheckedException
CacheProjectionCacheStore#load(Transaction, Object)
method.
reload in interface CacheProjection<K,V>key - Key.IgniteCheckedException - If failed.public IgniteInternalFuture<V> reloadAsync(K key)
CacheProjectionCacheStore#load(Transaction, Object)
method.
reloadAsync in interface CacheProjection<K,V>key - Key.public IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys, boolean deserializePortable)
keys - Keys.deserializePortable - Deserialize portable flag.public abstract void onDeferredDelete(GridCacheEntryEx entry, GridCacheVersion ver)
entry - Entry.ver - Version.protected void validateCacheKey(Object key)
Externalizable.key - Cache key.IllegalArgumentException - If validation fails.protected void validateCacheKeys(Iterable<?> keys)
Externalizable.keys - Cache keys.IgniteException - If validation fails.protected Iterator<javax.cache.Cache.Entry<K,V>> iterator(Iterator<GridCacheEntryEx> it, boolean deserializePortable)
it - Internal entry iterator.deserializePortable - Deserialize portable flag.@Nullable public IgniteCacheExpiryPolicy expiryPolicy(@Nullable javax.cache.expiry.ExpiryPolicy plc)
plc - Explicitly specified expiry policy for cache operation.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015