org.apache.ignite.internal.processors.cache.distributed.near

## Class GridNearAtomicCache<K,V>

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheAdapter<K,V>
  - - org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter<K,V>
    - - org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter<K,V>
      - - org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache<K,V>

All Implemented Interfaces:
  Externalizable, Serializable, Iterable<javax.cache.Cache.Entry<K,V>>, IgniteInternalCache<K,V>

    public class GridNearAtomicCache<K,V>
    extends GridNearCacheAdapter<K,V>

Near cache for atomic cache.

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter

`GridCacheAdapter.AsyncOp<T>, GridCacheAdapter.CacheExpiryPolicy, GridCacheAdapter.FutureHolder, GridCacheAdapter.TopologyVersionAwareJob, GridCacheAdapter.UpdateGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutAndGetTimeStatClosure<T>, GridCacheAdapter.UpdatePutTimeStatClosure<T>, GridCacheAdapter.UpdateRemoveTimeStatClosure<T>, GridCacheAdapter.UpdateTimeStatClosure<T>`

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter

`cacheCfg, CLEAR_ALL_SPLIT_THRESHOLD, ctx, gridCfg, keyCheck, lastFut, locNodeId, log, map, MAX_RETRIES, metrics, mxBean, RET2NULL`

### Constructor Summary

Constructors
Constructor and Description
`GridNearAtomicCache()` Empty constructor required for `Externalizable`.
`GridNearAtomicCache(GridCacheContext<K,V> ctx)`

### Method Summary

Methods
`GridDhtCacheAdapter<K,V>` `dht()`
`void` `dht(GridDhtAtomicCache<K,V> dht)`
`protected IgniteInternalFuture<Map<K,V>>` `getAllAsync(Collection<? extends K> keys, boolean forcePrimary, boolean skipTx, UUID subjId, String taskName, boolean deserializePortable, boolean skipVals, boolean canRemap)`
`V` `getAndPut(K key, V val, CacheEntryPredicate[] filter)`
`IgniteInternalFuture<V>` `getAndPutAsync0(K key, V val, CacheEntryPredicate... filter)`
`V` `getAndPutIfAbsent(K key, V val)` Stores given key-value pair in cache only if cache had no previous mapping for it.
`IgniteInternalFuture<V>` `getAndPutIfAbsentAsync(K key, V val)` Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
`V` `getAndRemove(K key)` Removes given key mapping from cache.
`IgniteInternalFuture<V>` `getAndRemoveAsync(K key)` Asynchronously removes given key mapping from cache.
`V` `getAndReplace(K key, V val)` Stores given key-value pair in cache only if there is a previous mapping for it.
`IgniteInternalFuture<V>` `getAndReplaceAsync(K key, V val)` Asynchronously stores given key-value pair in cache only if there is a previous mapping for it.
`<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)`
`IgniteInternalFuture<?>` `localRemoveAll(CacheEntryPredicate filter)`
`protected IgniteInternalFuture<Boolean>` `lockAllAsync(Collection<KeyCacheObject> keys, long timeout, IgniteTxLocalEx tx, boolean isInvalidate, boolean isRead, boolean retval, TransactionIsolation isolation, long accessTtl)`
`void` `onDeferredDelete(GridCacheEntryEx entry, GridCacheVersion ver)`
`void` `processDhtAtomicUpdateRequest(UUID nodeId, GridDhtAtomicUpdateRequest req, GridDhtAtomicUpdateResponse res)`
`void` `processNearAtomicUpdateResponse(GridNearAtomicUpdateRequest req, GridNearAtomicUpdateResponse res)`
`boolean` `put(K key, V val, CacheEntryPredicate[] filter)`
`void` `putAll(Map<? extends K,? extends V> m)` Stores given key-value pairs in cache.
`IgniteInternalFuture<?>` `putAllAsync(Map<? extends K,? extends V> m)` 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<Boolean>` `putAsync0(K key, V val, CacheEntryPredicate... filter)`
`boolean` `putIfAbsent(K key, V val)` Stores given key-value pair in cache only if cache had no previous mapping for it.
`IgniteInternalFuture<Boolean>` `putIfAbsentAsync(K key, V val)` Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
`boolean` `remove(K key)` Removes given key mapping from cache.
`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()` Removes mappings from cache.
`void` `removeAll(Collection<? extends K> keys)` Removes given key mappings from cache.
`IgniteInternalFuture<?>` `removeAllAsync()`
`IgniteInternalFuture<?>` `removeAllAsync(Collection<? extends K> keys)` Asynchronously removes given key mappings from cache for entries.
`void` `removeAllConflict(Map<KeyCacheObject,GridCacheVersion> drMap)` Removes DR data.
`IgniteInternalFuture<?>` `removeAllConflictAsync(Map<KeyCacheObject,GridCacheVersion> drMap)` Removes DR data asynchronously.
`IgniteInternalFuture<Boolean>` `removeAsync(K key, CacheEntryPredicate... filter)`
`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.
`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<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.
`boolean` `replace(K key, V val)` Stores given key-value pair in cache only if 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<Boolean>` `replaceAsync(K key, V val)` Asynchronously stores given key-value pair in cache only if 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.
`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<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.
`void` `start()` Starts this cache.
`V` `tryPutIfAbsent(K key, V val)` Tries to put value in cache.
`void` `unlockAll(Collection<? extends K> keys)` Unlocks given keys only if current thread owns the locks.

### Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter

`clearLocally, clearLocallyAll, entryEx, entryEx, entryExx, entrySet, entrySet, evict, evictAll, igfsDataSpaceMax, igfsDataSpaceUsed, init, isAllLockedNearOnly, isIgfsDataCache, isLocked, isLockedNearOnly, isMongoDataCache, isMongoMetaCache, isNear, keySet, loadAsync, localLoad, localLoadCache, localLoadCacheAsync, nearEntries, nearKeySet, nearSize, offHeapAllocatedSize, offHeapEntriesCount, onIgfsDataSizeChanged, onReconnected, peekExx, preloader, primaryEntrySet, primaryKeySet, primarySize, primarySizeLong, processGetResponse, promote, promoteAll, randomEntry, size, sizeLong, splitClearLocally, swapKeys, swapSize, toString, values`

### Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter

`lockAllAsync, removeVersionedEntry, txLockAsync`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheAdapter

`affinity, allEntries, asyncOp, asyncOpAcquire, asyncOpRelease, awaitLastFut, cache, checkJta, clear, clear, clearAll, clearAllAsync, clearAsync, clearAsync, clearLocally, clearLocally, commitTxAsync, configuration, containsKey, containsKeyAsync, containsKeys, containsKeysAsync, context, entries, entryEx, entryEx, entryExSafe, entrySet, entrySetx, expiry, expiryPolicy, forSubjectId, get, get, getAll, getAll, getAllAsync, getAllAsync, getAllAsync, getAllAsync0, getAllOutTx, getAllOutTxAsync, getAndPut, getAndPutAsync, getAndPutAsync, getAsync, getAsync, getAsync, getForcePrimary, getForcePrimaryAsync, getTopologySafe, igniteIterator, isColocated, isDht, isDhtAtomic, isEmpty, isLocal, isLockedByThread, iterator, iterator, keepPortable, keySet, keySetx, keySetx, loadAll, localEntries, localPeek, localSize, localSizeLong, lock, lockAll, lockAsync, log, map, metrics, metrics0, mxBean, name, onKernalStart, onKernalStop, onUndeploy, overflowSize, peekEx, peekEx, primaryKeySet, printMemoryStats, put, putAsync, putAsync, readExternal, readResolve, rebalance, removeAsync, removeEntry, removeIfObsolete, saveFuture, setSkipStore, size, sizeAsync, sizeLong, sizeLongAsync, skipStore, startInfo, stop, stopInfo, tx, txStart, txStart, txStartEx, unlock, validateCacheKey, validateCacheKeys, values, withExpiryPolicy, writeExternal`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### GridNearAtomicCache

    public GridNearAtomicCache()

Empty constructor required for `Externalizable`.

#### GridNearAtomicCache

    public GridNearAtomicCache(GridCacheContext<K,V> ctx)

Parameters:
  `ctx` - Context.

### Method Detail

#### start

    public void start()
               throws IgniteCheckedException

Starts this cache. Child classes should override this method to provide custom start-up behavior.

Overrides:
  `start` in class `GridCacheAdapter<K,V>`
Throws:
  `IgniteCheckedException` - If start failed.

#### dht

    public void dht(GridDhtAtomicCache<K,V> dht)

Parameters:
  `dht` - DHT cache.

#### dht

    public GridDhtCacheAdapter<K,V> dht()

Specified by:
  `dht` in class `GridNearCacheAdapter<K,V>`
Returns:
  DHT cache.

#### processNearAtomicUpdateResponse

    public void processNearAtomicUpdateResponse(GridNearAtomicUpdateRequest req,
                                       GridNearAtomicUpdateResponse res)

Parameters:
  `req` - Update request.
  `res` - Update response.

#### processDhtAtomicUpdateRequest

    public void processDhtAtomicUpdateRequest(UUID nodeId,
                                     GridDhtAtomicUpdateRequest req,
                                     GridDhtAtomicUpdateResponse res)

Parameters:
  `nodeId` - Sender node ID.
  `req` - Dht atomic update request.
  `res` - Dht atomic update response.

#### getAllAsync

    protected IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable
                                             Collection<? extends K> keys,
                                             boolean forcePrimary,
                                             boolean skipTx,
                                             @Nullable
                                             UUID subjId,
                                             String taskName,
                                             boolean deserializePortable,
                                             boolean skipVals,
                                             boolean canRemap)

Overrides:
  `getAllAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
  `forcePrimary` - Force primary.
  `skipTx` - Skip tx.
  `subjId` - Subj Id.
  `taskName` - Task name.
  `deserializePortable` - Deserialize portable.
  `skipVals` - Skip values.
  `canRemap` - Can remap flag.
Returns:
  Future for the get operation.
See Also:
  `GridCacheAdapter.getAllAsync(Collection)`

#### getAndPut

    public V getAndPut(K key,
              V val,
              @Nullable
              CacheEntryPredicate[] filter)
                throws IgniteCheckedException

Overrides:
  `getAndPut` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - Value.
  `filter` - Optional filter.
Returns:
  Previous value.
Throws:
  `IgniteCheckedException` - If failed.

#### put

    public boolean put(K key,
              V val,
              CacheEntryPredicate[] filter)
                throws IgniteCheckedException

Overrides:
  `put` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - Value.
  `filter` - Filter.
Returns:
  `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.
Throws:
  `IgniteCheckedException` - If put operation failed.

#### getAndPutAsync0

    public IgniteInternalFuture<V> getAndPutAsync0(K key,
                                          V val,
                                          @Nullable
                                          CacheEntryPredicate... filter)

Overrides:
  `getAndPutAsync0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - Value.
  `filter` - Optional filter.
Returns:
  Put operation future.

#### putAsync0

    public IgniteInternalFuture<Boolean> putAsync0(K key,
                                          V val,
                                          @Nullable
                                          CacheEntryPredicate... filter)

Overrides:
  `putAsync0` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - Value.
  `filter` - Optional filter.
Returns:
  Putx operation future.

#### getAndPutIfAbsent

    public V getAndPutIfAbsent(K key,
                      V val)
                        throws IgniteCheckedException

Stores given key-value pair in cache only if cache had no previous mapping for it. If cache previously contained value for the given key, then this value is returned. In case of `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 `IgniteInternalCache.putIfAbsent(Object, Object)` should always be used instead of this one to avoid the overhead associated with returning of the previous value.

If write-through is enabled, the stored value will be persisted to `CacheStore` via `CacheStore#put(Transaction, Object, Object)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `getAndPutIfAbsent` in interface `IgniteInternalCache<K,V>`
Overrides:
  `getAndPutIfAbsent` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  Previously contained value regardless of whether put happened or not.
Throws:
  `IgniteCheckedException` - If put operation failed.

#### getAndPutIfAbsentAsync

    public IgniteInternalFuture<V> getAndPutIfAbsentAsync(K key,
                                                 V val)

Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it. If cache previously contained value for the given key, then this value is returned. In case of `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 `IgniteInternalCache.putIfAbsentAsync(Object, Object)` should always be used instead of this one to avoid the overhead associated with returning of the previous value.

If write-through is enabled, the stored value will be persisted to `CacheStore` via `CacheStore#put(Transaction, Object, Object)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `getAndPutIfAbsentAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `getAndPutIfAbsentAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  Future of put operation which will provide previously contained value regardless of whether put happened or not.

#### putIfAbsent

    public boolean putIfAbsent(K key,
                      V val)
                        throws IgniteCheckedException

Stores given key-value pair in cache only if cache had no previous mapping for it.

This method will return `true` if value is stored in cache and `false` otherwise. Unlike `IgniteInternalCache.getAndPutIfAbsent(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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `putIfAbsent` in interface `IgniteInternalCache<K,V>`
Overrides:
  `putIfAbsent` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  `true` if value is stored in cache and `false` otherwise.
Throws:
  `IgniteCheckedException` - If put operation failed.

#### putIfAbsentAsync

    public IgniteInternalFuture<Boolean> putIfAbsentAsync(K key,
                                                 V val)

Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.

This method will return `true` if value is stored in cache and `false` otherwise. Unlike `IgniteInternalCache.getAndPutIfAbsent(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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `putIfAbsentAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `putIfAbsentAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  Future for this put operation.

#### tryPutIfAbsent

    @Nullable
    public V tryPutIfAbsent(K key,
                            V val)
                     throws IgniteCheckedException

Tries to put value in cache. Will fail with `GridCacheTryPutFailedException` if topology exchange is in progress.

Overrides:
  `tryPutIfAbsent` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `val` - value.
Returns:
  Old value.
Throws:
  `IgniteCheckedException` - In case of error.

#### getAndReplace

    public V getAndReplace(K key,
                  V val)
                    throws IgniteCheckedException

Stores given key-value pair in cache only if there is a previous mapping for it. In case of `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 `IgniteInternalCache.replace(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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `getAndReplace` in interface `IgniteInternalCache<K,V>`
Overrides:
  `getAndReplace` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  Previously contained value regardless of whether replace happened or not.
Throws:
  `IgniteCheckedException` - If replace operation failed.

#### getAndReplaceAsync

    public IgniteInternalFuture<V> getAndReplaceAsync(K key,
                                             V val)

Asynchronously stores given key-value pair in cache only if there is a previous mapping for it. If cache previously contained value for the given key, then this value is returned.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, 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 `IgniteInternalCache.replace(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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `getAndReplaceAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `getAndReplaceAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  Future for replace operation.

#### replace

    public boolean replace(K key,
                  V val)
                    throws IgniteCheckedException

Stores given key-value pair in cache only if only if there is a previous mapping for it.

This method will return `true` if value is stored in cache and `false` otherwise. Unlike `IgniteInternalCache.getAndReplace(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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `replace` in interface `IgniteInternalCache<K,V>`
Overrides:
  `replace` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  `True` if replace happened, `false` otherwise.
Throws:
  `IgniteCheckedException` - If replace operation failed.

#### replaceAsync

    public IgniteInternalFuture<Boolean> replaceAsync(K key,
                                             V val)

Asynchronously stores given key-value pair in cache only if only if there is a previous mapping for it.

This method will return `true` if value is stored in cache and `false` otherwise. Unlike `IgniteInternalCache.getAndReplaceAsync(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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `replaceAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `replaceAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `val` - Value to be associated with the given key.
Returns:
  Future for the replace operation.

#### replace

    public boolean replace(K key,
                  V oldVal,
                  V newVal)
                    throws IgniteCheckedException

Stores given key-value pair in cache only if only if the previous value is equal to the `'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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `replace` in interface `IgniteInternalCache<K,V>`
Overrides:
  `replace` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `oldVal` - Old value to match.
  `newVal` - Value to be associated with the given key.
Returns:
  `True` if replace happened, `false` otherwise.
Throws:
  `IgniteCheckedException` - If replace operation failed.

#### replaceAsync

    public 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.

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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `replaceAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `replaceAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `oldVal` - Old value to match.
  `newVal` - Value to be associated with the given key.
Returns:
  Future for the replace operation.

#### removex

    public GridCacheReturn removex(K key,
                          V val)
                            throws IgniteCheckedException

Removes given key mapping from cache if one exists and value is equal to the passed in value.

If write-through is enabled, the value will be removed from `CacheStore` via `CacheWriter.delete(Object)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `removex` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removex` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key whose mapping is to be removed from cache.
  `val` - Value to match against currently cached value.
Returns:
  Object containing actual old value and success flag.
Throws:
  `IgniteCheckedException` - If remove failed.

#### replacex

    public GridCacheReturn replacex(K key,
                           V oldVal,
                           V newVal)
                             throws IgniteCheckedException

Stores given key-value pair in cache only if only if the previous value is equal to the `'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 `CacheWriter.write(javax.cache.Cache.Entry)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `replacex` in interface `IgniteInternalCache<K,V>`
Overrides:
  `replacex` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `oldVal` - Old value to match.
  `newVal` - Value to be associated with the given key.
Returns:
  Object containing actual old value and success flag.
Throws:
  `IgniteCheckedException` - If replace operation failed.

#### removexAsync

    public 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.

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 `CacheWriter.delete(Object)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `removexAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removexAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key whose mapping is to be removed from cache.
  `val` - Value to match against currently cached value.
Returns:
  Future for the remove operation. The future will return object containing actual old value and success flag.

#### replacexAsync

    public 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.

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 `CacheWriter.write(javax.cache.Cache.Entry)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `replacexAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `replacexAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to store in cache.
  `oldVal` - Old value to match.
  `newVal` - Value to be associated with the given key.
Returns:
  Future for the replace operation. The future will return object containing actual old value and success flag.

#### putAll

    public void putAll(Map<? extends K,? extends V> m)
                throws IgniteCheckedException

Stores given key-value pairs in cache. If filters are provided, then entries will be stored in cache only if they pass the filter. Note that filter check is atomic, so value stored in cache is guaranteed to be consistent with the filters.

If write-through is enabled, the stored values will be persisted to `CacheStore` via `CacheStore#putAll(Transaction, Map)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `putAll` in interface `IgniteInternalCache<K,V>`
Overrides:
  `putAll` in class `GridCacheAdapter<K,V>`
Parameters:
  `m` - Key-value pairs to store in cache.
Throws:
  `IgniteCheckedException` - If put operation failed.

#### putAllAsync

    public IgniteInternalFuture<?> putAllAsync(Map<? extends K,? extends V> m)

Asynchronously stores given key-value pairs in cache. If filters are provided, then entries will be stored in cache only if they pass the filter. Note that filter check is atomic, so value stored in cache is guaranteed to be consistent with the filters.

If write-through is enabled, the stored values will be persisted to `CacheStore` via `CacheStore#putAll(Transaction, Map)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `putAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `putAllAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `m` - Key-value pairs to store in cache.
Returns:
  Future for putAll operation.

#### putAllConflict

    public void putAllConflict(Map<KeyCacheObject,GridCacheDrInfo> drMap)
                        throws IgniteCheckedException

Store DR data.

Specified by:
  `putAllConflict` in interface `IgniteInternalCache<K,V>`
Overrides:
  `putAllConflict` in class `GridCacheAdapter<K,V>`
Parameters:
  `drMap` - DR map.
Throws:
  `IgniteCheckedException` - If put operation failed.

#### putAllConflictAsync

    public IgniteInternalFuture<?> putAllConflictAsync(Map<KeyCacheObject,GridCacheDrInfo> drMap)
                                                throws IgniteCheckedException

Store DR data asynchronously.

Specified by:
  `putAllConflictAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `putAllConflictAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `drMap` - DR map.
Returns:
  Future.
Throws:
  `IgniteCheckedException` - If put operation failed.

#### invoke

    public <T> javax.cache.processor.EntryProcessorResult<T> invoke(K key,
                                                           javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                                                           Object... args)
                                                         throws IgniteCheckedException

Specified by:
  `invoke` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invoke` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `entryProcessor` - Entry processor.
  `args` - Arguments.
Returns:
  Invoke result.
Throws:
  `IgniteCheckedException` - If failed.

#### invokeAll

    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

Specified by:
  `invokeAll` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAll` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
  `entryProcessor` - Entry processor.
  `args` - Arguments.
Returns:
  Invoke results.
Throws:
  `IgniteCheckedException` - If failed.

#### invokeAllAsync

    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)

Specified by:
  `invokeAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAllAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `map` - Map containing keys and entry processors to be applied to values.
  `args` - Arguments.
Returns:
  Future.

#### invokeAsync

    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

Specified by:
  `invokeAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key.
  `entryProcessor` - Entry processor.
  `args` - Arguments.
Returns:
  Future.
Throws:
  `javax.cache.processor.EntryProcessorException`

#### invokeAll

    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

Specified by:
  `invokeAll` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAll` in class `GridCacheAdapter<K,V>`
Parameters:
  `map` - Map containing keys and entry processors to be applied to values.
  `args` - Arguments.
Returns:
  Invoke results.
Throws:
  `IgniteCheckedException` - If failed.

#### invokeAllAsync

    public <T> IgniteInternalFuture<Map<K,javax.cache.processor.EntryProcessorResult<T>>> invokeAllAsync(Set<? extends K> keys,
                                                                                                javax.cache.processor.EntryProcessor<K,V,T> entryProcessor,
                                                                                                Object... args)

Specified by:
  `invokeAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `invokeAllAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys.
  `entryProcessor` - Entry processor.
  `args` - Arguments.
Returns:
  Future.

#### getAndRemove

    public V getAndRemove(K key)
                   throws IgniteCheckedException

Removes given key mapping from cache. If cache previously contained value for the given key, then this value is returned. In case of `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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `getAndRemove` in interface `IgniteInternalCache<K,V>`
Overrides:
  `getAndRemove` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key whose mapping is to be removed from cache.
Returns:
  Previous value associated with specified key, or `null` if there was no value for this key.
Throws:
  `IgniteCheckedException` - If remove operation failed.

#### getAndRemoveAsync

    public IgniteInternalFuture<V> getAndRemoveAsync(K key)

Asynchronously removes given key mapping from cache. If cache previously contained value for the given key, then this value is returned. In case of `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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `getAndRemoveAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `getAndRemoveAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key whose mapping is to be removed from cache.
Returns:
  Future for the remove operation.

#### removeAll

    public void removeAll(Collection<? extends K> keys)
                   throws IgniteCheckedException

Removes given key mappings from cache.

If write-through is enabled, the values will be removed from `CacheStore` via `IgniteDataStreamer`.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `removeAll` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removeAll` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys whose mappings are to be removed from cache.
Throws:
  `IgniteCheckedException` - If remove failed.

#### removeAllAsync

    public IgniteInternalFuture<?> removeAllAsync(Collection<? extends K> keys)

Asynchronously removes given key mappings from cache for entries.

If write-through is enabled, the values will be removed from `CacheStore` via `IgniteDataStreamer`.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `removeAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removeAllAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `keys` - Keys whose mappings are to be removed from cache.
Returns:
  Future for the remove operation. The future will complete whenever remove operation completes.

#### remove

    public boolean remove(K key)
                   throws IgniteCheckedException

Removes given key mapping from cache.

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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `remove` in interface `IgniteInternalCache<K,V>`
Overrides:
  `remove` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key whose mapping is to be removed from cache.
Returns:
  `True` if filter passed validation and entry was removed, `false` otherwise. Note that if filter is not specified, this method will return `true`.
Throws:
  `IgniteCheckedException` - If remove failed.

#### removeAsync

    public IgniteInternalFuture<Boolean> removeAsync(K key,
                                            @Nullable
                                            CacheEntryPredicate... filter)

Overrides:
  `removeAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key to remove.
  `filter` - Optional filter.
Returns:
  Putx operation future.

#### remove

    public boolean remove(K key,
                 V val)
                   throws IgniteCheckedException

Removes given key mapping from cache if one exists and value is equal to the passed in value.

If write-through is enabled, the value will be removed from `CacheStore` via `CacheStore#remove(Transaction, Object)` method.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `remove` in interface `IgniteInternalCache<K,V>`
Overrides:
  `remove` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key whose mapping is to be removed from cache.
  `val` - Value to match against currently cached value.
Returns:
  `True` if entry was removed and passed in value matched the cached one, `false` otherwise.
Throws:
  `IgniteCheckedException` - If remove failed.

#### removeAsync

    public 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.

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.

## Transactions

This method is transactional and will enlist the entry into ongoing transaction if there is one.

Specified by:
  `removeAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removeAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `key` - Key whose mapping is to be removed from cache.
  `val` - Value to match against currently cached value.
Returns:
  Future for the remove operation. The future will return `true` if currently cached value will match the passed in one.

#### removeAll

    public void removeAll()
                   throws IgniteCheckedException

Removes mappings from cache.

USE WITH CARE - if your cache has many entries then transaction will quickly become very heavy and slow.

If write-through is enabled, the values will be removed from `CacheStore` via `IgniteDataStreamer`.

## Transactions

This method is not transactional.

Specified by:
  `removeAll` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removeAll` in class `GridDistributedCacheAdapter<K,V>`
Throws:
  `IgniteCheckedException` - If remove failed.

#### removeAllAsync

    public IgniteInternalFuture<?> removeAllAsync()

Specified by:
  `removeAllAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removeAllAsync` in class `GridDistributedCacheAdapter<K,V>`
Returns:
  Remove future.

#### localRemoveAll

    public IgniteInternalFuture<?> localRemoveAll(CacheEntryPredicate filter)

Overrides:
  `localRemoveAll` in class `GridCacheAdapter<K,V>`
Parameters:
  `filter` - Filter.
Returns:
  Future.

#### removeAllConflict

    public void removeAllConflict(Map<KeyCacheObject,GridCacheVersion> drMap)
                           throws IgniteCheckedException

Removes DR data.

Specified by:
  `removeAllConflict` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removeAllConflict` in class `GridCacheAdapter<K,V>`
Parameters:
  `drMap` - DR map.
Throws:
  `IgniteCheckedException` - If remove failed.

#### removeAllConflictAsync

    public IgniteInternalFuture<?> removeAllConflictAsync(Map<KeyCacheObject,GridCacheVersion> drMap)
                                                   throws IgniteCheckedException

Removes DR data asynchronously.

Specified by:
  `removeAllConflictAsync` in interface `IgniteInternalCache<K,V>`
Overrides:
  `removeAllConflictAsync` in class `GridCacheAdapter<K,V>`
Parameters:
  `drMap` - DR map.
Returns:
  Future.
Throws:
  `IgniteCheckedException` - If remove failed.

#### lockAllAsync

    protected IgniteInternalFuture<Boolean> lockAllAsync(Collection<KeyCacheObject> keys,
                                             long timeout,
                                             @Nullable
                                             IgniteTxLocalEx tx,
                                             boolean isInvalidate,
                                             boolean isRead,
                                             boolean retval,
                                             @Nullable
                                             TransactionIsolation isolation,
                                             long accessTtl)

Specified by:
  `lockAllAsync` in class `GridDistributedCacheAdapter<K,V>`
Parameters:
  `keys` - Keys to lock.
  `timeout` - Timeout.
  `tx` - Transaction
  `isInvalidate` - Invalidation flag.
  `isRead` - Indicates whether value is read or written.
  `retval` - Flag to return value.
  `isolation` - Transaction isolation.
  `accessTtl` - TTL for read operation.
Returns:
  Future for locks.

#### unlockAll

    public void unlockAll(@Nullable
                 Collection<? extends K> keys)
                   throws IgniteCheckedException

Unlocks given keys only if current thread owns the locks. Only the keys that have been locked by calling thread and pass through the filter (if any) will be unlocked. If none of the key locks is owned by current thread, then this method will do nothing.

## Transactions

Locks are not transactional and should not be used from within transactions. If you do need explicit locking within transaction, then you should use `TransactionConcurrency.PESSIMISTIC` concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Parameters:
  `keys` - Keys to unlock.
Throws:
  `IgniteCheckedException` - If unlock execution resulted in error.

#### onDeferredDelete

    public void onDeferredDelete(GridCacheEntryEx entry,
                        GridCacheVersion ver)

Specified by:
  `onDeferredDelete` in class `GridCacheAdapter<K,V>`
Parameters:
  `entry` - Entry.
  `ver` - Version.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.5.0-b1
Release Date | : December 1 2015