public class GridLocalAtomicCache<K,V> extends GridCacheAdapter<K,V>
GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.FutureHolderafterPessimisticUnlock, beforePessimisticLock, cacheCfg, CLEAR_ALL_SPLIT_THRESHOLD, ctx, gridCfg, lastFut, locNodeId, log, map, metrics| Constructor and Description |
|---|
GridLocalAtomicCache()
Empty constructor required by
Externalizable. |
GridLocalAtomicCache(GridCacheContext<K,V> ctx) |
| Modifier and Type | Method and Description |
|---|---|
protected GridFuture |
asyncOp(Callable<?> op) |
V |
get(K key,
GridPredicate<GridCacheEntry<K,V>> filter) |
Map<K,V> |
getAll(Collection<? extends K> keys,
GridPredicate<GridCacheEntry<K,V>> filter) |
GridFuture<Map<K,V>> |
getAllAsync(Collection<? extends K> keys,
boolean forcePrimary,
boolean skipTx,
GridCacheEntryEx<K,V> entry,
UUID subjId,
GridPredicate<GridCacheEntry<K,V>>[] filter) |
protected void |
init()
Post constructor initialization for subclasses.
|
boolean |
isLocal() |
GridFuture<Boolean> |
lockAllAsync(Collection<? extends K> keys,
long timeout,
GridPredicate<GridCacheEntry<K,V>>... filter)
All or nothing synchronous lock for passed in keys.
|
GridCacheTxLocalAdapter<K,V> |
newTx(boolean implicit,
boolean implicitSingle,
GridCacheTxConcurrency concurrency,
GridCacheTxIsolation isolation,
long timeout,
boolean invalidate,
boolean syncCommit,
boolean syncRollback,
boolean swapOrOffheapEnabled,
boolean storeEnabled,
int txSize,
Object grpLockKey,
boolean partLock) |
void |
onDeferredDelete(GridCacheEntryEx<K,V> entry,
GridCacheVersion ver) |
GridCachePreloader<K,V> |
preloader() |
V |
put(K key,
V val,
GridCacheEntryEx<K,V> cached,
long ttl,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Internal method that is called from
GridCacheEntryImpl. |
void |
putAll(Map<? extends K,? extends V> m,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Stores given key-value pairs in cache.
|
GridFuture<?> |
putAllAsync(Map<? extends K,? extends V> m,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Asynchronously stores given key-value pairs in cache.
|
GridFuture<V> |
putAsync(K key,
V val,
GridCacheEntryEx<K,V> entry,
long ttl,
GridPredicate<GridCacheEntry<K,V>>... 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.
|
GridFuture<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,
GridCacheEntryEx<K,V> cached,
long ttl,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
boolean |
putx(K key,
V val,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Stores given key-value pair in cache.
|
GridFuture<Boolean> |
putxAsync(K key,
V val,
GridCacheEntryEx<K,V> entry,
long ttl,
GridPredicate<GridCacheEntry<K,V>>... 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.
|
GridFuture<Boolean> |
putxIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
V |
remove(K key,
GridCacheEntryEx<K,V> entry,
GridPredicate<GridCacheEntry<K,V>>... 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,
GridPredicate<GridCacheEntry<K,V>>... filter)
Removes given key mappings from cache for entries for which the optionally passed in filters do
pass.
|
void |
removeAll(GridPredicate<GridCacheEntry<K,V>>[] filter)
Removes mappings from cache for entries for which the optionally passed in filters do
pass.
|
GridFuture<?> |
removeAllAsync(Collection<? extends K> keys,
GridPredicate<GridCacheEntry<K,V>>[] filter)
Asynchronously removes given key mappings from cache for entries for which the optionally
passed in filters do pass.
|
GridFuture<?> |
removeAllAsync(GridPredicate<GridCacheEntry<K,V>>[] filter)
Asynchronously removes mappings from cache for entries for which the optionally passed in filters do
pass.
|
GridFuture<V> |
removeAsync(K key,
GridCacheEntryEx<K,V> entry,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
GridFuture<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.
|
boolean |
removex(K key,
GridCacheEntryEx<K,V> entry,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
GridCacheReturn<V> |
removex(K key,
V val)
Removes given key mapping from cache if one exists and value is equal to the passed in value.
|
GridFuture<Boolean> |
removexAsync(K key,
GridCacheEntryEx<K,V> entry,
GridPredicate<GridCacheEntry<K,V>>... filter)
Internal method that is called from
GridCacheEntryImpl. |
GridFuture<GridCacheReturn<V>> |
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 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. |
GridFuture<V> |
replaceAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if if there is a previous mapping for it.
|
GridFuture<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<V> |
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. |
GridFuture<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.
|
GridFuture<GridCacheReturn<V>> |
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. |
void |
start()
Starts this cache.
|
void |
transform(K key,
GridClosure<V,V> transformer)
Stores result of applying
valTransform closure to the previous value associated with
given key in cache. |
void |
transformAll(Map<? extends K,? extends GridClosure<V,V>> m)
Stores result of applying transform closures from the given map to previous values associated
with corresponding keys in cache.
|
GridFuture<?> |
transformAllAsync(Map<? extends K,? extends GridClosure<V,V>> m)
Stores result of applying transform closures from the given map to previous values associated
with corresponding keys in cache.
|
<R> R |
transformAndCompute(K key,
GridClosure<V,GridBiTuple<V,R>> transformer)
Applies
transformer closure to the previous value associated with given key in cache,
closure should return GridBiTuple instance where first value is new value stored in cache
and second value is returned as result of this method. |
GridFuture<?> |
transformAsync(K key,
GridClosure<V,V> transformer,
GridCacheEntryEx<K,V> entry,
long ttl)
Internal method that is called from
GridCacheEntryImpl. |
GridFuture<Boolean> |
txLockAsync(Collection<? extends K> keys,
long timeout,
GridCacheTxLocalEx<K,V> tx,
boolean isRead,
boolean retval,
GridCacheTxIsolation isolation,
boolean invalidate,
GridPredicate<GridCacheEntry<K,V>>[] filter) |
void |
unlockAll(Collection<? extends K> keys,
GridPredicate<GridCacheEntry<K,V>>... filter)
Unlocks given keys only if current thread owns the locks.
|
affinity, afterPessimisticUnlock, afterPessimisticUnlock, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, beforePessimisticLock, beforePessimisticLock, cache, checkJta, clear, clear0, clearAll, clearAll, clearAll0, compact, compact, compactAll, compactAll, configuration, containsAllKeys, containsAllValues, containsAnyKeys, containsAnyValues, containsKey, containsKey, containsValue, containsValue, context, dataStructures, dgc, dgc, drBackupQueueSize, drListStateTransfers, drPause, drPauseState, drResume, drStateTransfer, entries, entry, entryEx, entryEx, entryEx, entryExSafe, entrySet, entrySet, entrySet, entrySet, entrySetx, evict, evict, evictAll, evictAll, evictAll, flags, flagsOff, flagsOn, forAll, forceRepartition, forEach, forSubjectId, get, get, getAll, getAllAsync, getAllAsync, getAllAsync, getAllOutTx, getAllOutTxAsync, getAsync, getAsync, getForcePrimary, getForcePrimaryAsync, ggfsDataSpaceMax, ggfsDataSpaceUsed, globalClearAll, gridProjection, isColocated, isDht, isDhtAtomic, isDrSystemCache, isEmpty, isGgfsDataCache, isLocked, isLockedByThread, isMongoDataCache, isMongoMetaCache, isNear, iterator, keySet, keySet, loadCache, loadCacheAsync, lock, lockAll, lockAsync, log, map, metrics, metrics0, name, nearSize, offHeapAllocatedSize, offHeapEntriesCount, offHeapIterator, onGgfsDataSizeChanged, onKernalStart, onKernalStop, onUndeploy, overflowSize, peek, peek, peek, peek0, peek0, peek0, peekAll, peekAll0, peekAll0, peekEx, predicate, primaryEntrySet, primaryEntrySet, primaryKeySet, primaryKeySet, primarySize, primaryValues, primaryValues, printMemoryStats, processCheckCommittedTxRequest, processCheckCommittedTxResponse, processCheckPreparedTxRequest, processCheckPreparedTxResponse, projection, projection, projection, promote, promoteAll, put, putAllDr, putAllDrAsync, putAsync, putxAsync, queries, randomEntry, readExternal, readResolve, readThroughAllAsync, reload, reload, reloadAll, reloadAll, reloadAll, reloadAll, reloadAll, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAllAsync, reloadAsync, reloadAsync, remove, removeAllDr, removeAllDrAsync, removeAsync, removeEntry, removeIfObsolete, removex, removexAsync, resetMetrics, saveFuture, size, splitClearAll, startInfo, stop, stopInfo, swapIterator, swapKeys, swapSize, toMap, toString, transformAll, transformAllAsync, transformAsync, tx, txStart, txStart, txStart, txStartAffinity, txStartPartition, txSynchronizations, txSynchronize, txUnsynchronize, unlock, values, values, wrappers, writeExternaladdMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, clone, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, readExternalMeta, removeMeta, removeMeta, replaceMeta, writeExternalMetaequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMetapublic GridLocalAtomicCache()
Externalizable.public GridLocalAtomicCache(GridCacheContext<K,V> ctx)
ctx - Cache context.protected void init()
init in class GridCacheAdapter<K,V>public void start()
throws GridException
start in class GridCacheAdapter<K,V>GridException - If start failed.public boolean isLocal()
isLocal in class GridCacheAdapter<K,V>True if cache is local.public GridCachePreloader<K,V> preloader()
preloader in class GridCacheAdapter<K,V>public V put(K key, V val, @Nullable GridCacheEntryEx<K,V> cached, long ttl, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
GridCacheEntryImpl.put in interface GridCacheProjectionEx<K,V>put in class GridCacheAdapter<K,V>key - Key.val - Value.cached - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.ttl - Optional time-to-live. If negative, leaves ttl value unchanged.filter - Optional filter.GridException - If failed.public boolean putx(K key, V val, @Nullable GridCacheEntryEx<K,V> cached, long ttl, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheEntryImpl.putx in interface GridCacheProjectionEx<K,V>putx in class GridCacheAdapter<K,V>key - Key.val - Value.cached - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.ttl - Optional time-to-live. If negative, leaves ttl value unchanged.filter - Optional filter.GridException - If failed.public boolean putx(K key, V val, GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.put(Object, Object, GridPredicate[]) 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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putx in interface GridCacheProjection<K,V>putx in class GridCacheAdapter<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.GridException - If put operation failed.public GridFuture<V> putAsync(K key, V val, @Nullable GridCacheEntryEx<K,V> entry, long ttl, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheEntryImpl.putAsync in interface GridCacheProjectionEx<K,V>putAsync in class GridCacheAdapter<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 GridFuture<Boolean> putxAsync(K key, V val, @Nullable GridCacheEntryEx<K,V> entry, long ttl, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheEntryImpl.putxAsync in interface GridCacheProjectionEx<K,V>putxAsync in class GridCacheAdapter<K,V>key - Key.val - Value.entry - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.ttl - Optional time-to-live. If negative, leave ttl value unchanged.filter - Optional filter.public V putIfAbsent(K key, V val) throws GridException
GridCacheMode.PARTITIONED or GridCacheMode.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, GridCacheStore.load(GridCacheTx, Object) method will be used.
If the returned value is not needed, method GridCacheProjection.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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putIfAbsent in interface GridCacheProjection<K,V>putIfAbsent in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.GridException - If put operation failed.public GridFuture<V> putIfAbsentAsync(K key, V val)
GridCacheMode.PARTITIONED or GridCacheMode.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, GridCacheStore.load(GridCacheTx, Object) method will be used.
If the returned value is not needed, method GridCacheProjection.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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putIfAbsentAsync in interface GridCacheProjection<K,V>putIfAbsentAsync in class GridCacheAdapter<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 GridException
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putxIfAbsent in interface GridCacheProjection<K,V>putxIfAbsent in class GridCacheAdapter<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.GridException - If put operation failed.public GridFuture<Boolean> putxIfAbsentAsync(K key, V val)
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putxIfAbsentAsync in interface GridCacheProjection<K,V>putxIfAbsentAsync in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.public V replace(K key, V val) throws GridException
GridCacheMode.PARTITIONED or GridCacheMode.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, GridCacheStore.load(GridCacheTx, Object) method will be used.
If the returned value is not needed, method GridCacheProjection.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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replace in interface GridCacheProjection<K,V>replace in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.GridException - If replace operation failed.public GridFuture<V> replaceAsync(K key, V val)
GridCacheMode.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, GridCacheStore.load(GridCacheTx, Object) method will be used.
If the returned value is not needed, method GridCacheProjection.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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replaceAsync in interface GridCacheProjection<K,V>replaceAsync in class GridCacheAdapter<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 GridException
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replacex in interface GridCacheProjection<K,V>replacex in class GridCacheAdapter<K,V>key - Key to store in cache.val - Value to be associated with the given key.True if replace happened, false otherwise.GridException - If replace operation failed.public GridFuture<Boolean> replacexAsync(K key, V val)
This method will return true if value is stored in cache and false otherwise.
Unlike GridCacheProjection.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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replacexAsync in interface GridCacheProjection<K,V>replacexAsync in class GridCacheAdapter<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 GridException
'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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replace in interface GridCacheProjection<K,V>replace in class GridCacheAdapter<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.GridException - If replace operation failed.public GridFuture<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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replaceAsync in interface GridCacheProjection<K,V>replaceAsync in class GridCacheAdapter<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.public GridCacheReturn<V> replacex(K key, V oldVal, V newVal) throws GridException
'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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replacex in interface GridCacheProjectionEx<K,V>replacex in class GridCacheAdapter<K,V>key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.GridException - If replace operation failed.public GridCacheReturn<V> removex(K key, V val) throws GridException
If write-through is enabled, the value will be removed from GridCacheStore
via GridCacheStore.remove(GridCacheTx, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removex in interface GridCacheProjectionEx<K,V>removex in class GridCacheAdapter<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.GridException - If remove failed.public GridFuture<GridCacheReturn<V>> 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 GridCacheStore
via GridCacheStore.remove(GridCacheTx, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removexAsync in interface GridCacheProjectionEx<K,V>removexAsync in class GridCacheAdapter<K,V>key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.public GridFuture<GridCacheReturn<V>> 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 GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.replacexAsync in interface GridCacheProjectionEx<K,V>replacexAsync in class GridCacheAdapter<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(Map<? extends K,? extends V> m, GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
If write-through is enabled, the stored values will be persisted to GridCacheStore
via GridCacheStore.putAll(GridCacheTx, Map) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putAll in interface GridCacheProjection<K,V>putAll in class GridCacheAdapter<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.GridException - If put operation failed.public GridFuture<?> putAllAsync(Map<? extends K,? extends V> m, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter)
If write-through is enabled, the stored values will be persisted to GridCacheStore
via GridCacheStore.putAll(GridCacheTx, Map) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.putAllAsync in interface GridCacheProjection<K,V>putAllAsync in class GridCacheAdapter<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.public void transform(K key, GridClosure<V,V> transformer) throws GridException
valTransform closure to the previous value associated with
given key in cache. Result of closure application is guaranteed to be atomic, however, closure
itself can be applied more than once.
Note that transform closure must not throw any exceptions. If exception is thrown from apply
method, the transaction will be invalidated and entries participating in transaction will be nullified.
Unlike GridCacheProjection.putx(Object, Object, GridPredicate[]) or GridCacheProjection.put(Object, Object, GridPredicate[])
methods, this method will not transfer the whole updated value over the network, but instead will
transfer the transforming closure that will be applied on each remote node involved in transaction.
It may add significant performance gain when dealing with large values as the value is much larger
than the closure itself. If write-through is enabled, the stored value will be persisted to
GridCacheStore via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.transform in interface GridCacheProjection<K,V>transform in class GridCacheAdapter<K,V>key - Key to store in cache.transformer - Closure to be applied to the previous value in cache. If this closure returns
null, the associated value will be removed from cache.GridException - On any error occurred while storing value in cache.public <R> R transformAndCompute(K key, GridClosure<V,GridBiTuple<V,R>> transformer) throws GridException
transformer closure to the previous value associated with given key in cache,
closure should return GridBiTuple instance where first value is new value stored in cache
and second value is returned as result of this method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.transformAndCompute in interface GridCacheProjection<K,V>transformAndCompute in class GridCacheAdapter<K,V>key - Key to store in cache.transformer - Closure to be applied to the previous value in cache.GridException - On any error occurred while storing value in cache.public GridFuture<?> transformAsync(K key, GridClosure<V,V> transformer, @Nullable GridCacheEntryEx<K,V> entry, long ttl)
GridCacheEntryImpl.transformAsync in interface GridCacheProjectionEx<K,V>transformAsync in class GridCacheAdapter<K,V>key - Key.transformer - Transformer closure.entry - Cached entry.ttl - Optional time-to-lve.public void transformAll(@Nullable Map<? extends K,? extends GridClosure<V,V>> m) throws GridException
Note that transform closure must not throw any exceptions. If exception is thrown from apply
method, the transaction will be invalidated and entries participating in transaction will be nullified.
Unlike GridCacheProjection.putAll(Map, GridPredicate[]) method, this method will not transfer
the whole updated value over the network, but instead will transfer the transforming closures
that will be applied on each remote node involved in transaction. It may add significant
performance gain when dealing with large values as the value is much larger than the closure itself.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.transformAll in interface GridCacheProjection<K,V>transformAll in class GridCacheAdapter<K,V>m - Map containing keys and closures to be applied to values.GridException - On any error occurred while storing value in cache.public GridFuture<?> transformAllAsync(@Nullable Map<? extends K,? extends GridClosure<V,V>> m)
Note that transform closure must not throw any exceptions. If exception is thrown from apply
method, the transaction will be invalidated and entries participating in transaction will be nullified.
Unlike GridCacheProjection.putAll(Map, GridPredicate[]) method, this method will not transfer
the whole updated value over the network, but instead will transfer the transforming closures
that will be applied on each remote node involved in transaction. It may add significant performance
gain when dealing with large values as the value is much larger than the closure itself.
If write-through is enabled, the stored value will be persisted to GridCacheStore
via GridCacheStore.put(GridCacheTx, Object, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.transformAllAsync in interface GridCacheProjection<K,V>transformAllAsync in class GridCacheAdapter<K,V>m - Map containing keys and closures to be applied to values.public V remove(K key, @Nullable GridCacheEntryEx<K,V> entry, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheEntryImpl.remove in interface GridCacheProjectionEx<K,V>remove in class GridCacheAdapter<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.filter - Optional filter.GridException - If failed.public GridFuture<V> removeAsync(K key, @Nullable GridCacheEntryEx<K,V> entry, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheEntryImpl.removeAsync in interface GridCacheProjectionEx<K,V>removeAsync in class GridCacheAdapter<K,V>key - Key to remove.entry - Optional cached entry.filter - Optional filter.public void removeAll(Collection<? extends K> keys, GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
If write-through is enabled, the values will be removed from GridCacheStore
via GridCacheStore.removeAll(GridCacheTx, Collection) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAll in interface GridCacheProjection<K,V>removeAll in class GridCacheAdapter<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.GridException - If remove failed.public GridFuture<?> removeAllAsync(Collection<? extends K> keys, GridPredicate<GridCacheEntry<K,V>>[] filter)
If write-through is enabled, the values will be removed from GridCacheStore
via GridCacheStore.removeAll(GridCacheTx, Collection) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAllAsync in interface GridCacheProjection<K,V>removeAllAsync in class GridCacheAdapter<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, @Nullable GridCacheEntryEx<K,V> entry, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheEntryImpl.removex in interface GridCacheProjectionEx<K,V>removex in class GridCacheAdapter<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.filter - Optional filter.GridException - If failed.public GridFuture<Boolean> removexAsync(K key, @Nullable GridCacheEntryEx<K,V> entry, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheEntryImpl.removexAsync in interface GridCacheProjectionEx<K,V>removexAsync in class GridCacheAdapter<K,V>key - Key to remove.entry - Cached entry. If not provided, equivalent to {GridCacheProjection#put}.filter - Optional filter.public boolean remove(K key, V val) throws GridException
If write-through is enabled, the value will be removed from GridCacheStore
via GridCacheStore.remove(GridCacheTx, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.remove in interface GridCacheProjection<K,V>remove in class GridCacheAdapter<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.GridException - If remove failed.public GridFuture<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 GridCacheStore
via GridCacheStore.remove(GridCacheTx, Object) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAsync in interface GridCacheProjection<K,V>removeAsync in class GridCacheAdapter<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 void removeAll(GridPredicate<GridCacheEntry<K,V>>[] filter) throws GridException
null, then all entries in cache will be enrolled
into transaction.
USE WITH CARE - if your cache has many entries that pass through the filter or if filter is empty, then transaction will quickly become very heavy and slow. Also, locks are acquired in undefined order, so it may cause a deadlock when used with other concurrent transactional updates.
If write-through is enabled, the values will be removed from GridCacheStore
via GridCacheStore.removeAll(GridCacheTx, Collection) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAll in interface GridCacheProjection<K,V>removeAll in class GridCacheAdapter<K,V>filter - Filter used to supply keys for remove operation (if null,
then nothing will be removed).GridException - If remove failed.public GridFuture<?> removeAllAsync(GridPredicate<GridCacheEntry<K,V>>[] filter)
null, then all entries in cache will be enrolled
into transaction.
USE WITH CARE - if your cache has many entries that pass through the filter or if filter is empty, then transaction will quickly become very heavy and slow.
If write-through is enabled, the values will be removed from GridCacheStore
via GridCacheStore.removeAll(GridCacheTx, Collection) method.
GridCacheFlag.LOCAL, GridCacheFlag.READ.removeAllAsync in interface GridCacheProjection<K,V>removeAllAsync in class GridCacheAdapter<K,V>filter - Filter used to supply keys for remove operation (if null,
then nothing will be removed).@Nullable public V get(K key, @Nullable GridPredicate<GridCacheEntry<K,V>> filter) throws GridException
get in class GridCacheAdapter<K,V>key - Key.filter - Filter to evaluate.GridException - If failed.public final Map<K,V> getAll(Collection<? extends K> keys, GridPredicate<GridCacheEntry<K,V>> filter) throws GridException
getAll in class GridCacheAdapter<K,V>keys - Keys.filter - Filter to evaluate.GridException - If read failed.public GridFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, @Nullable GridCacheEntryEx<K,V> entry, @Nullable UUID subjId, @Nullable GridPredicate<GridCacheEntry<K,V>>[] filter)
getAllAsync in class GridCacheAdapter<K,V>public GridFuture<Boolean> txLockAsync(Collection<? extends K> keys, long timeout, GridCacheTxLocalEx<K,V> tx, boolean isRead, boolean retval, GridCacheTxIsolation isolation, boolean invalidate, GridPredicate<GridCacheEntry<K,V>>[] filter)
txLockAsync in class GridCacheAdapter<K,V>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.filter - Optional filter.public GridCacheTxLocalAdapter<K,V> newTx(boolean implicit, boolean implicitSingle, GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, boolean invalidate, boolean syncCommit, boolean syncRollback, boolean swapOrOffheapEnabled, boolean storeEnabled, int txSize, @Nullable Object grpLockKey, boolean partLock)
newTx in class GridCacheAdapter<K,V>implicit - True if transaction is implicit.implicitSingle - Implicit-with-single-key flag.concurrency - Concurrency.isolation - Isolation.timeout - transaction timeout.invalidate - Invalidation flag.syncCommit - Synchronous commit flag.syncRollback - Synchronous rollback flag.swapOrOffheapEnabled - If true then swap storage will be used.storeEnabled - if true then read/write through will be used.txSize - Expected transaction size.grpLockKey - Group lock key if this is a group-lock transaction.partLock - True if partition is locked.public GridFuture<Boolean> lockAllAsync(@Nullable Collection<? extends K> keys, long timeout, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter)
GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
GridCacheFlag.LOCAL, GridCacheFlag.READ.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.public void unlockAll(@Nullable Collection<? extends K> keys, @Nullable GridPredicate<GridCacheEntry<K,V>>... filter) throws GridException
GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
GridCacheFlag.LOCAL, GridCacheFlag.READ.keys - Keys to unlock.filter - Optional filter which needs to pass for individual entries
to be unlocked.GridException - If unlock execution resulted in error.protected GridFuture asyncOp(Callable<?> op)
op - Operation closure.public void onDeferredDelete(GridCacheEntryEx<K,V> entry, GridCacheVersion ver)
onDeferredDelete in class GridCacheAdapter<K,V>entry - Entry.ver - Version.Copyright © 2014. All rights reserved.