GridGain™ 3.6.0e
Enterprise Edition

org.gridgain.grid.cache
Interface GridCacheProjection<K,V>

All Superinterfaces:
GridMetadataAware, Iterable<GridCacheEntry<K,V>>, Serializable
All Known Subinterfaces:
GridCache<K,V>

public interface GridCacheProjection<K,V>
extends Iterable<GridCacheEntry<K,V>>, GridMetadataAware

This interface provides a rich API for working with distributed caches. It includes the following main functionality:

Extended Put And Remove Methods

All methods that end with 'x' provide the same functionality as their sibling methods that don't end with 'x', however instead of returning a previous value they return a boolean flag indicating whether operation succeeded or not. Returning a previous value may involve a network trip or a persistent store lookup and should be avoided whenever not needed.

Predicate Filters

All filters passed into methods on this API are checked atomically. In other words the value returned by the methods is guaranteed to be consistent with the filters passed in. Note that filters are optional, and if not passed in, then methods will still work as is without filter validation.

Transactions

Cache API supports distributed transactions. All 'get(..)', 'put(..)', 'replace(..)', and 'remove(..)' operations are transactional and will participate in an ongoing transaction, if any. Other methods like 'peek(..)' or various 'contains(..)' methods may be transaction-aware, i.e. check in-transaction entries first, but will not affect the current state of transaction. See GridCacheTx documentation for more information about transactions.

Null Keys or Values

Neither null keys or values are allowed to be stored in cache. If a null value happens to be in cache (e.g. after invalidation or remove), then cache will treat this case as there is no value at all.

All API method with @Nullable annotation on method parameters or return values either accept or may return a null value. Parameters that do not have this annotation cannot be null and invoking method with a null parameter in this case will result in NullPointerException.

Peer Class Loading

All classes passed into cache API will be automatically deployed to any participating grid nodes. No explicit deployment step is required.

Wiki & Forum:


Wiki
Forum

 

Method Summary
 Object affinityKey(K key)
          Maps passed in key to a key which will be used for node affinity.
 Collection<GridRichNode> affinityNodes(K key)
          Gets primary and backup nodes for the key.
 int[] allPartitions(GridProjection p)
          Gets partition ids for which nodes of the given projection has ownership (either primary or backup).
 int[] backupPartitions(GridProjection p, int... levels)
          Gets partition ids for which nodes of the given projection has backup ownership.
<K,V> GridCache<K,V>
cache()
          Gets base cache for this projection.
 boolean clear(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          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 clearAll()
          Clears all entries from this cache only if the entry is not currently locked or participating in a transaction.
 void clearAll(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Clears all entries from this cache only if the entry is not currently locked, and is not participating in a transaction.
 void clearAll(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Clears all entries from this cache only if the entry is not currently locked or participating in a transaction.
 void clearAll(K... keys)
          Clears all entries from this cache only if the entry is not currently locked, is not participating in a transaction.
 boolean compact(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Optimizes the size of an entry with given key.
 void compactAll(Collection<K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Optimizes the size of entries with given keys.
 void compactAll(K... keys)
          Optimizes the size of entries with given keys.
 boolean containsAllEntries(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Returns true if all cache entries pass through the filter.
 boolean containsAllKeys(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Returns true if this cache contains mappings for all the keys.
 boolean containsAllKeys(GridPredicate<? super K>... filter)
          Returns true if this cache contains mappings for all the keys that pass through the filter.
 boolean containsAllKeys(K... keys)
          Returns true if this cache contains mappings for all the keys.
 boolean containsAllValues(Collection<? extends V> vals, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Returns true if this cache contains all the values.
 boolean containsAllValues(GridPredicate<? super V>... filter)
          Returns true if all cache values pass through the filter.
 boolean containsAllValues(V... vals)
          Returns true if this cache contains all the given values.
 boolean containsAnyEntries(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Returns true if passed in predicate evaluates to true for any of the cache entries.
 boolean containsAnyKeys(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Returns true if this cache contains mappings for at least one of the keys.
 boolean containsAnyKeys(GridPredicate<? super K>... filter)
          Returns true if this cache contains mappings for at least one of the keys.
 boolean containsAnyKeys(K... keys)
          Returns true if this cache contains mappings for at least one of the keys.
 boolean containsAnyValues(Collection<? extends V> vals, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Returns true if this cache contains mappings for at least one of the values.
 boolean containsAnyValues(GridPredicate<? super V>... filter)
          Returns true if at least one of cache values passes through the filter.
 boolean containsAnyValues(V... vals)
          Returns true if this cache contains mappings for at least one of the values.
 boolean containsKey(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Returns true if this cache contains a mapping for the specified key.
 boolean containsValue(V val, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Returns true if this cache contains given value.
 GridCacheQuery<K,V> createQuery(GridCacheQueryType type)
          Creates user's query for given query type.
 GridCacheQuery<K,V> createQuery(GridCacheQueryType type, Class<?> cls, String clause)
          Creates user's query for given query type, queried class, and query clause which is generally a where clause.
 GridCacheQuery<K,V> createQuery(GridCacheQueryType type, String clsName, String clause)
          Creates user's query for given query type, queried class, and query clause which is generally a where clause.
<R1,R2> GridCacheReduceQuery<K,V,R1,R2>
createReduceQuery()
          Creates user's reduce query.
<R1,R2> GridCacheReduceQuery<K,V,R1,R2>
createReduceQuery(GridCacheQueryType type)
          Creates user's reduce query.
<R1,R2> GridCacheReduceQuery<K,V,R1,R2>
createReduceQuery(GridCacheQueryType type, Class<?> cls, String clause)
          Creates user's reduce query.
<R1,R2> GridCacheReduceQuery<K,V,R1,R2>
createReduceQuery(GridCacheQueryType type, String clsName, String clause)
          Creates user's reduce query.
<T> GridCacheTransformQuery<K,V,T>
createTransformQuery()
          Creates user's transform query.
<T> GridCacheTransformQuery<K,V,T>
createTransformQuery(GridCacheQueryType type)
          Creates user's transform query.
<T> GridCacheTransformQuery<K,V,T>
createTransformQuery(GridCacheQueryType type, Class<?> cls, String clause)
          Creates user's transform query.
<T> GridCacheTransformQuery<K,V,T>
createTransformQuery(GridCacheQueryType type, String clsName, String clause)
          Creates user's transform query.
 GridCacheEntry<K,V> entry(K key)
          Gets entry from cache with the specified key.
 GridPredicate<? super GridCacheEntry<K,V>> entryPredicate()
          Gets entry predicate on which this projection is based on or null if entry predicate is not defined.
 Set<GridCacheEntry<K,V>> entrySet()
          Gets set containing all cache entries.
 Set<GridCacheEntry<K,V>> entrySet(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Gets set containing all cache entries for given keys.
 Set<GridCacheEntry<K,V>> entrySet(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Gets set containing all cache entries.
 Set<GridCacheEntry<K,V>> entrySet(K... keys)
          Gets set containing all cache entries for given keys.
 boolean evict(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Evicts entry associated with given key from cache.
 void evictAll()
          Attempts to evict all cache entries.
 void evictAll(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Attempts to evict all entries associated with keys.
 void evictAll(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Attempts to evict all cache entries.
 void evictAll(K... keys)
          Attempts to evict all entries associated with keys.
 Set<GridCacheFlag> flags()
           
 GridCacheProjection<K,V> flagsOff(GridCacheFlag... flags)
          Gets cache projection base on this but with the specified flags turned off.
 GridCacheProjection<K,V> flagsOn(GridCacheFlag... flags)
          Gets cache projection base on this one, but with the specified flags turned on.
 boolean forAll(GridPredicate<? super GridCacheEntry<K,V>> vis)
          Tests whether the predicate holds for all entries.
 boolean forAll(GridPredicate<? super GridCacheEntry<K,V>> vis, Collection<? extends K> keys)
          Tests whether the predicate holds for all entries.
 boolean forAll(GridPredicate<? super GridCacheEntry<K,V>> vis, K... keys)
          Tests whether the predicate holds for all entries.
 GridFuture<Boolean> forAllAsync(GridPredicate<? super GridCacheEntry<K,V>> vis)
          Asynchronously tests whether the predicate holds for all entries.
 GridFuture<Boolean> forAllAsync(GridPredicate<? super GridCacheEntry<K,V>> vis, Collection<? extends K> keys)
          Asynchronously tests whether the predicate holds for all entries.
 GridFuture<Boolean> forAllAsync(GridPredicate<? super GridCacheEntry<K,V>> vis, K... keys)
          Asynchronously tests whether the predicate holds for all entries.
 void forEach(GridInClosure<? super GridCacheEntry<K,V>> vis)
          Executes visitor closure on each cache element.
 void forEach(GridInClosure<? super GridCacheEntry<K,V>> vis, Collection<? extends K> keys)
          Executes visitor closure on each cache element.
 void forEach(GridInClosure<? super GridCacheEntry<K,V>> vis, K... keys)
          Executes visitor closure on each cache element.
 GridFuture<?> forEachAsync(GridInClosure<? super GridCacheEntry<K,V>> vis)
          Asynchronously executes visitor closure on each cache element.
 GridFuture<?> forEachAsync(GridInClosure<? super GridCacheEntry<K,V>> vis, Collection<? extends K> keys)
          Asynchronously executes visitor closure on each cache element.
 GridFuture<?> forEachAsync(GridInClosure<? super GridCacheEntry<K,V>> vis, K... keys)
          Asynchronously executes visitor closure on each cache element.
 V get(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Retrieves value mapped to the specified key from cache.
 Map<K,V> getAll(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Retrieves values mapped to the specified keys from cache.
 Map<K,V> getAll(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Retrieves all values whose entries pass the provided filter.
 Map<K,V> getAll(K... keys)
          Retrieves values mapped to the specified keys from cache.
 GridFuture<Map<K,V>> getAllAsync(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously retrieves values mapped to the specified keys from cache.
 GridFuture<Map<K,V>> getAllAsync(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously retrieves all values whose entries pass the provided filter.
 GridFuture<Map<K,V>> getAllAsync(K... keys)
          Asynchronously retrieves values mapped to the specified keys from cache.
 GridFuture<V> getAsync(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously retrieves value mapped to the specified key from cache.
 GridProjection gridProjection()
          Provides grid projection for all nodes participating in this cache.
 GridProjection gridProjection(Collection<? extends K> keys)
          This method provides GridProjection for all nodes to which the passed in keys are mapped.
 GridProjection gridProjection(GridPredicate<? super K>... filter)
          This method provides GridProjection for all nodes to which all the keys whose entries pass through the filter are mapped.
 GridProjection gridProjection(K... keys)
          This method provides GridProjection for all nodes to which the passed in keys are mapped.
 void inTx(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, GridInClosure<GridCacheProjection<K,V>>... closures)
          Starts transaction with specified isolation and concurrency and sequentially executes given closures within it.
<R> Collection<R>
inTx(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, GridOutClosure<? super R>... closures)
          Starts transaction with specified isolation and concurrency and sequentially executes given closures within it.
 void inTx(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, boolean invalidate, GridInClosure<GridCacheProjection<K,V>>... closures)
          Starts transaction with specified isolation, concurrency, timeout, and invalidation flag and sequentially executes given closures within it.
<R> Collection<R>
inTx(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, boolean invalidate, GridOutClosure<? super R>... closures)
          Starts transaction with specified isolation, concurrency, timeout, and invalidation flag and sequentially executes given closures within it.
 void inTx(GridInClosure<GridCacheProjection<K,V>>... closures)
          Starts new transaction with default isolation, concurrency, and invalidation policy and sequentially executes given closures within it.
<R> Collection<R>
inTx(GridOutClosure<? super R>... closures)
          Starts transaction and sequentially executes given closures within it.
 void inTx(long timeout, GridInClosure<GridCacheProjection<K,V>>... closures)
          Starts new transaction with the specified timeout, isolation, concurrency and invalidation policy and sequentially executes given closures within it.
<R> Collection<R>
inTx(long timeout, GridOutClosure<? super R>... closures)
          Starts new transaction with the specified timeout, isolation, concurrency and invalidation policy and sequentially executes given closures within it.
 GridFuture<?> inTxAsync(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, GridInClosure<GridCacheProjection<K,V>>... closures)
          Starts transaction with specified isolation and concurrency and sequentially executes given closures within it.
<R> GridFuture<Collection<R>>
inTxAsync(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, GridOutClosure<? super R>... closures)
          Starts transaction with specified isolation and concurrency and sequentially executes given closures within it.
 GridFuture<?> inTxAsync(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, boolean invalidate, GridInClosure<GridCacheProjection<K,V>>... closures)
          Starts transaction with specified isolation, concurrency, timeout, and invalidation flag and sequentially executes given closures within it.
<R> GridFuture<Collection<R>>
inTxAsync(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, boolean invalidate, GridOutClosure<? super R>... closures)
          Starts transaction with specified isolation, concurrency, timeout, and invalidation flag and sequentially executes given closures within it.
 GridFuture<?> inTxAsync(GridInClosure<GridCacheProjection<K,V>>... closures)
          Starts new transaction with default isolation, concurrency, and invalidation policy and sequentially executes given closures within it.
<R> GridFuture<Collection<R>>
inTxAsync(GridOutClosure<? super R>... closures)
          Starts transaction and sequentially executes given closures within it.
 GridFuture<?> inTxAsync(long timeout, GridInClosure<GridCacheProjection<K,V>>... closures)
          Starts new transaction with the specified timeout, isolation, concurrency and invalidation policy and sequentially executes given closures within it.
<R> GridFuture<Collection<R>>
inTxAsync(long timeout, GridOutClosure<? super R>... closures)
          Starts new transaction with the specified timeout, isolation, concurrency and invalidation policy and sequentially executes given closures within it.
 boolean invalidate(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Invalidates (nullifies) an entry with given key.
 void invalidateAll(Collection<K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Invalidates (nullifies) all entries.
 void invalidateAll(K... keys)
          Invalidates (nullifies) all entries.
 boolean isAllLocked(Collection<? extends K> keys)
          Checks if every key provided is locked by some grid node.
 boolean isAllLocked(GridPredicate<? super K>... filter)
          Checks if every key provided by the filter is locked by some grid node.
 boolean isAllLocked(K... keys)
          Checks if every key provided is locked by some grid node.
 boolean isAllLockedByThread(Collection<? extends K> keys)
          Checks if every key provided is locked by the current thread.
 boolean isAllLockedByThread(GridPredicate<? super K>... filter)
          Checks if every key provided by the filter is locked by the current thread.
 boolean isAllLockedByThread(K... keys)
          Checks if every key provided is locked by the current thread.
 boolean isEmpty()
          Returns true if this map contains no key-value mappings.
 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.
 Set<K> keySet()
          Set of cached keys.
 Set<K> keySet(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Set of cached keys.
 Set<K> keySet(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Set of cached keys.
 Set<K> keySet(K... keys)
          Set of cached keys.
 int keySize()
          Gets size of cache key set.
 GridPredicate2<K,V> keyValuePredicate()
          Gets key-value predicate on which this projection is based on or null if key-value predicate is not defined.
 boolean lock(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Synchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes.
 boolean lock(K key, long timeout, GridPredicate<? super GridCacheEntry<K,V>>... 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, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          All or nothing synchronous lock for passed in keys.
 boolean lockAll(Collection<? extends K> keys, long timeout, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          All or nothing synchronous lock for passed in keys.
 boolean lockAll(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          All or nothing synchronous lock for passed in filter.
 boolean lockAll(K... keys)
          All or nothing synchronous lock for passed in keys.
 boolean lockAll(long timeout, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          All or nothing synchronous lock for passed in filter.
 boolean lockAll(long timeout, K... keys)
          All or nothing synchronous lock for passed in keys.
 GridFuture<Boolean> lockAllAsync(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          All or nothing synchronous lock for passed in keys.
 GridFuture<Boolean> lockAllAsync(Collection<? extends K> keys, long timeout, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          All or nothing synchronous lock for passed in keys.
 GridFuture<Boolean> lockAllAsync(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          All or nothing asynchronous lock for passed in filter.
 GridFuture<Boolean> lockAllAsync(K... keys)
          All or nothing synchronous lock for passed in keys.
 GridFuture<Boolean> lockAllAsync(long timeout, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          All or nothing asynchronous lock for passed in filter.
 GridFuture<Boolean> lockAllAsync(long timeout, K... keys)
          All or nothing synchronous lock for passed in keys.
 GridFuture<Boolean> lockAsync(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes.
 GridFuture<Boolean> lockAsync(K key, long timeout, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes.
 Map<GridRichNode,Collection<K>> mapKeysToNodes(Collection<? extends K> keys)
          This method provides ability to detect which keys are mapped to which nodes.
 Map<GridRichNode,Collection<K>> mapKeysToNodes(GridPredicate<? super K>... filter)
          This method provides ability to detect which keys are mapped to which nodes.
 Map<GridRichNode,Collection<K>> mapKeysToNodes(K... keys)
          This method provides ability to detect which keys are mapped to which nodes.
 GridRichNode mapKeyToNode(K key)
          This method provides ability to detect to which primary node the given key is mapped.
 Map<Integer,GridRichNode> mapPartitionsToNodes(Collection<Integer> parts)
          Gets primary nodes for the given partitions.
 Map<Integer,GridRichNode> mapPartitionsToNodes(int[] parts)
          Gets primary nodes for the given partitions.
 Map<Integer,GridRichNode> mapPartitionsToNodes(int part, int... parts)
          Gets primary nodes for the given partitions.
 GridRichNode mapPartitionToNode(int part)
          Gets primary node for the given partition.
 String name()
          Gets name of this cache (null for default cache).
<K,V> GridCacheProjection<K,V>
parent()
          Returns parent projection from which this projection was created.
 int partition(K key)
          Gets partition id for the given key.
 int partitions()
          Gets number of partitions in cache according to configured affinity function.
 V peek(K key)
          Peeks at in-memory cached value using default GridCachePeekMode.SMART peek mode.
 V peek(K key, Collection<GridCachePeekMode> modes)
          Peeks at cached value using optional set of peek modes.
 V peek(K key, GridCachePeekMode... modes)
          Peeks at cached value using optional set of peek modes.
 V peek(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Peeks at in-memory cached value using default GridCachePeekMode.SMART peek mode.
 Map<K,V> peekAll(Collection<? extends K> keys)
          Peeks at in-memory cached values using default GridCachePeekMode.SMART peek mode.
 Map<K,V> peekAll(Collection<? extends K> keys, Collection<GridCachePeekMode> modes)
          Peeks at cached values using optional set of peek modes.
 Map<K,V> peekAll(Collection<? extends K> keys, GridCachePeekMode... modes)
          Peeks at cached values using optional set of peek modes.
 Map<K,V> peekAll(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Peeks at in-memory cached value using default GridCachePeekMode.SMART peek mode.
 Map<K,V> peekAll(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Peeks at in-memory cached value using default GridCachePeekMode.SMART peek mode.
 Map<K,V> peekAll(K... keys)
          Peeks at in-memory cached values using default GridCachePeekMode.SMART peek mode.
 GridFuture<Map<K,V>> peekAllAsync(Collection<? extends K> keys, Collection<GridCachePeekMode> modes)
          Asynchronously peeks at cached values using optional set of peek modes.
 GridFuture<Map<K,V>> peekAllAsync(Collection<? extends K> keys, GridCachePeekMode... modes)
          Asynchronously peeks at cached values using optional set of peek modes.
 GridFuture<V> peekAsync(K key, Collection<GridCachePeekMode> modes)
          Asynchronously peeks at cached value using optional set of peek modes.
 GridFuture<V> peekAsync(K key, GridCachePeekMode... modes)
          Asynchronously peeks at cached value using optional set of peek modes.
 Set<GridCacheEntry<K,V>> primaryEntrySet()
          Gets set containing cache entries for which local node is the primary node.
 Set<GridCacheEntry<K,V>> primaryEntrySet(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Gets set containing cache entries for which local node is the primary node.
 Set<GridCacheEntry<K,V>> primaryEntrySet(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Gets set containing cache entries for which local node is the primary node.
 Set<GridCacheEntry<K,V>> primaryEntrySet(K... keys)
          Gets set containing cache entries for which local node is the primary node.
 Set<K> primaryKeySet()
          Set of cached primary keys for which local node is the primary node.
 Set<K> primaryKeySet(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Set of cached primary keys for which local node is the primary node.
 Set<K> primaryKeySet(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Set of cached primary keys for which local node is the primary node.
 Set<K> primaryKeySet(K... keys)
          Set of cached primary keys for which local node is the primary node.
 int[] primaryPartitions(GridProjection p)
          Gets partition ids for which nodes of the given projection has primary ownership.
 Collection<V> primaryValues()
          Collection of primary cached values.for which local node is the primary node.
 Collection<V> primaryValues(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Collection of primary cached values.for which local node is the primary node.
 Collection<V> primaryValues(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Collection of primary cached values.for which local node is the primary node.
 Collection<V> primaryValues(K... keys)
          Collection of primary cached values.for which local node is the primary node.
<K1,V1> GridCacheProjection<K1,V1>
projection(Class<?> keyType, Class<?> valType)
          Gets cache projection only for given key and value type.
 GridCacheProjection<K,V> projection(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Gets cache projection based on given entry filter.
 GridCacheProjection<K,V> projection(GridPredicate2<K,V>... p)
          Gets cache projection based on given key-value predicate.
 V put(K key, V val, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Stores given key-value pair in cache.
 void putAll(Map<? extends K,? extends V> m, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Stores given key-value pairs in cache.
 GridFuture<?> putAllAsync(Map<? extends K,? extends V> m, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously stores given key-value pairs in cache.
 GridFuture<V> putAsync(K key, V val, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously stores given key-value pair in cache.
 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, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Stores given key-value pair in cache.
 GridFuture<Boolean> putxAsync(K key, V val, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Stores given key-value pair in cache.
 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.
<R> R
reduce(GridReducer<? super GridCacheEntry<K,V>,R> rdc)
          Visits every cache entry and then reduces the result.
<R> R
reduce(GridReducer<? super GridCacheEntry<K,V>,R> rdc, Collection<? extends K> keys)
          Visits specified cache entries and then reduces the result.
<R> R
reduce(GridReducer<? super GridCacheEntry<K,V>,R> rdc, K... keys)
          Visits specified cache entries and then reduces the result.
<R> GridFuture<R>
reduceAsync(GridReducer<? super GridCacheEntry<K,V>,R> rdc)
          Asynchronously visits every cache entry and then reduces the result.
<R> GridFuture<R>
reduceAsync(GridReducer<? super GridCacheEntry<K,V>,R> rdc, Collection<? extends K> keys)
          Asynchronously visits specified cache entries and then reduces the result.
<R> GridFuture<R>
reduceAsync(GridReducer<? super GridCacheEntry<K,V>,R> rdc, K... keys)
          Asynchronously visits specified cache entries and then reduces the result.
 V reload(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Reloads a single key from persistent storage.
 void reloadAll()
          Reloads all currently cached keys form persistent storage.
 void reloadAll(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Reloads specified entries from underlying persistent storage.
 void reloadAll(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Reloads all currently cached entries which pass the passed in filter from the underlying persistent storage.
 void reloadAll(K... keys)
          Reloads specified entries from underlying persistent storage.
 GridFuture<?> reloadAllAsync()
          Asynchronously reloads all specified entries from underlying persistent storage.
 GridFuture<?> reloadAllAsync(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously reloads all specified entries from underlying persistent storage.
 GridFuture<?> reloadAllAsync(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously reloads all currently cached entries which pass the filter from the underlying persistent storage.
 GridFuture<?> reloadAllAsync(K... keys)
          Asynchronously reloads all specified entries from underlying persistent storage.
 GridFuture<V> reloadAsync(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously reloads a single key from persistent storage.
 V remove(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          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(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Removes given key mappings from cache for entries for which the optionally passed in filters do pass.
 void removeAll(GridPredicate<? super 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<? super 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<? super 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, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously removes given key mapping from cache.
 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, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Removes given key mapping from cache.
 GridFuture<Boolean> removexAsync(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Asynchronously removes given key mapping from cache.
 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.
 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.
 int size()
          Gets size of this cache projection.
 ConcurrentMap<K,V> toMap()
          Converts this API into standard Java ConcurrentMap interface.
 GridCacheTx tx()
          Gets transaction started by this thread or null if this thread does not have a transaction.
 GridCacheTx txStart()
          Starts transaction with default isolation, concurrency, timeout, and invalidation policy.
 GridCacheTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation)
          Starts new transaction with the specified concurrency and isolation.
 GridCacheTx txStart(GridCacheTxConcurrency concurrency, GridCacheTxIsolation isolation, long timeout, boolean invalidate)
          Starts transaction with specified isolation, concurrency, timeout, and invalidation flag.
 GridCacheTx txStart(long timeout)
          Starts new transaction with the specified timeout and default concurrency, isolation, and invalidation policy.
 void unlock(K key, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Unlocks given key only if current thread owns the lock.
 void unlockAll(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Unlocks given keys only if current thread owns the locks.
 void unlockAll(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Unlock the keys supplied by the given filter only if current thread owns the locks.
 void unlockAll(K... keys)
          Unlocks given keys only if current thread owns the locks.
 V unswap(K key)
          This method unswaps cache entry by given key, if any, from swap storage into memory.
 void unswapAll(Collection<? extends K> keys)
          This method unswaps cache entries by given keys, if any, from swap storage into memory.
 void unswapAll(K... keys)
          This method unswaps cache entries by given keys, if any, from swap storage into memory.
 Collection<V> values()
          Collection of cached values.
 Collection<V> values(Collection<? extends K> keys, GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Collection of cached values for given keys.
 Collection<V> values(GridPredicate<? super GridCacheEntry<K,V>>... filter)
          Collection of cached values.
 Collection<V> values(K... keys)
          Collection of cached values for given keys.
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.gridgain.grid.GridMetadataAware
addMeta, addMetaIfAbsent, addMetaIfAbsent, allMeta, copyMeta, copyMeta, hasMeta, hasMeta, meta, putMetaIfAbsent, putMetaIfAbsent, removeMeta, removeMeta, replaceMeta
 

Method Detail

name

String name()
Gets name of this cache (null for default cache).

Returns:
Cache name.

parent

@Nullable
<K,V> GridCacheProjection<K,V> parent()
Returns parent projection from which this projection was created.

Type Parameters:
K - Key type of parent projection.
V - Value type of parent projection.
Returns:
Parent projection from which this projection was created.

cache

<K,V> GridCache<K,V> cache()
Gets base cache for this projection.

Type Parameters:
K - Cache key type.
V - Cache value type.
Returns:
Base cache for this projection.

flags

Set<GridCacheFlag> flags()
Returns:
Flags for this projection (empty set if no flags have been set).

keyValuePredicate

@Nullable
GridPredicate2<K,V> keyValuePredicate()
Gets key-value predicate on which this projection is based on or null if key-value predicate is not defined.

Returns:
Key-value filter on which this projection is based on.

entryPredicate

@Nullable
GridPredicate<? super GridCacheEntry<K,V>> entryPredicate()
Gets entry predicate on which this projection is based on or null if entry predicate is not defined.

Returns:
Entry filter on which this projection is based on.

projection

<K1,V1> GridCacheProjection<K1,V1> projection(Class<?> keyType,
                                              Class<?> valType)
Gets cache projection only for given key and value type. Only non-null key-value pairs that have matching key and value pairs will be used in this projection.

Cache Flags

The resulting projection will have flag GridCacheFlag.STRICT set on it.

Type Parameters:
K1 - Key type.
V1 - Value type.
Parameters:
keyType - Key type.
valType - Value type.
Returns:
Cache projection for given key and value types.

projection

GridCacheProjection<K,V> projection(@Nullable
                                    GridPredicate2<K,V>... p)
Gets cache projection based on given key-value predicate. Whenever makes sense, this predicate will be used to pre-filter cache operations. If operation passed pre-filtering, this filter will be passed through to cache operations as well.

For example, for GridCacheProjection.putAll(Map, GridPredicate[]) method only elements that pass the filter will be given to GridCache.putAll(m, filter) where it will be checked once again prior to put.

Cache Flags

The resulting projection will have flag GridCacheFlag.STRICT set on it.

Parameters:
p - Key-value predicate for this projection. If null, then the same projection is returned.
Returns:
Projection for given key-value predicate.

projection

GridCacheProjection<K,V> projection(@Nullable
                                    GridPredicate<? super GridCacheEntry<K,V>>... filter)
Gets cache projection based on given entry filter. This filter will be simply passed through to all cache operations on this projection. Unlike GridCacheProjection.projection(GridPredicate2[]) method, this filter will not be used for pre-filtering.

Parameters:
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'.
Returns:
Projection based on given filter.

flagsOn

GridCacheProjection<K,V> flagsOn(@Nullable
                                 GridCacheFlag... flags)
Gets cache projection base on this one, but with the specified flags turned on.

Cache Flags

The resulting projection will inherit all the flags from this projection.

Parameters:
flags - Flags to turn on (if empty, then no-op).
Returns:
New projection based on this one, but with the specified flags turned on.

flagsOff

GridCacheProjection<K,V> flagsOff(@Nullable
                                  GridCacheFlag... flags)
Gets cache projection base on this but with the specified flags turned off.

Cache Flags

The resulting projection will inherit all the flags from this projection except for the ones that were turned off.

Parameters:
flags - Flags to turn off (if empty, then all flags will be turned off).
Returns:
New projection based on this one, but with the specified flags turned off.

isEmpty

boolean isEmpty()
Returns true if this map contains no key-value mappings.

Returns:
true if this map contains no key-value mappings.

containsKey

boolean containsKey(K key,
                    @Nullable
                    GridPredicate<? super GridCacheEntry<K,V>>... filter)
Returns true if this cache contains a mapping for the specified key.

Throws:
NullPointerException - if the key is null.
Parameters:
key - key whose presence in this map is to be tested.
filter - Filter to test prior to checking containment.
Returns:
true if this map contains a mapping for the specified key.

containsAllKeys

boolean containsAllKeys(@Nullable
                        Collection<? extends K> keys,
                        @Nullable
                        GridPredicate<? super GridCacheEntry<K,V>>... filter)
Returns true if this cache contains mappings for all the keys. If passed in keys are empty or null, then true is returned.

Parameters:
keys - Keys to check.
filter - Filter to test prior to checking for containment.
Returns:
true if this cache contains mappings for all given keys.

containsAllKeys

boolean containsAllKeys(@Nullable
                        K... keys)
Returns true if this cache contains mappings for all the keys. If passed in keys are empty, then true is returned.

Parameters:
keys - Keys to check.
Returns:
true if this cache contains mappings for all the keys.

containsValue

boolean containsValue(V val,
                      @Nullable
                      GridPredicate<? super GridCacheEntry<K,V>>... filter)
Returns true if this cache contains given value.

Throws:
NullPointerException - if the value is null.
Parameters:
val - Value to check.
filter - Filter to test prior to checking for containment.
Returns:
True if given value is present in cache.

containsAllKeys

boolean containsAllKeys(@Nullable
                        GridPredicate<? super K>... filter)
Returns true if this cache contains mappings for all the keys that pass through the filter. If cache is empty then true is returned.

Parameters:
filter - Key filter to check.
Returns:
True if this filter returns true for all cache keys.

containsAnyKeys

boolean containsAnyKeys(@Nullable
                        Collection<? extends K> keys,
                        @Nullable
                        GridPredicate<? super GridCacheEntry<K,V>>... filter)
Returns true if this cache contains mappings for at least one of the keys. If passed in keys are empty, then false is returned.

Parameters:
keys - Keys to check.
filter - Filter to test prior to checking containment.
Returns:
true if this cache contains mappings for at least one of the keys.

containsAnyKeys

boolean containsAnyKeys(@Nullable
                        K... keys)
Returns true if this cache contains mappings for at least one of the keys. If passed in keys are empty, then false is returned.

Parameters:
keys - Keys to check.
Returns:
true if this cache contains mappings for at least one of the keys.

containsAnyKeys

boolean containsAnyKeys(@Nullable
                        GridPredicate<? super K>... filter)
Returns true if this cache contains mappings for at least one of the keys. If cache is empty, then false is returned.

Parameters:
filter - Key filter to check.
Returns:
true if this cache contains mappings for at least one of the keys that passes through the filter.

containsAllValues

boolean containsAllValues(@Nullable
                          Collection<? extends V> vals,
                          @Nullable
                          GridPredicate<? super GridCacheEntry<K,V>>... filter)
Returns true if this cache contains all the values. If cache is empty, then true is returned.

Parameters:
vals - Values to check.
filter - Filter to test prior to checking containment.
Returns:
true if this cache contains all the values.

containsAllValues

boolean containsAllValues(@Nullable
                          V... vals)
Returns true if this cache contains all the given values. If cache is empty, then true is returned.

Parameters:
vals - Values to check.
Returns:
true if this cache contains all the values.

containsAllValues

boolean containsAllValues(@Nullable
                          GridPredicate<? super V>... filter)
Returns true if all cache values pass through the filter. If cache is empty, then true is returned.

Parameters:
filter - Value filter to check.
Returns:
true if all cache values pass through the filter.

containsAnyValues

boolean containsAnyValues(@Nullable
                          Collection<? extends V> vals,
                          @Nullable
                          GridPredicate<? super GridCacheEntry<K,V>>... filter)
Returns true if this cache contains mappings for at least one of the values. If cache is empty, then false is returned.

Parameters:
vals - Values to check.
filter - Filter to test prior to checking containment.
Returns:
true if this cache contains mappings for at least one of the values.

containsAnyValues

boolean containsAnyValues(@Nullable
                          V... vals)
Returns true if this cache contains mappings for at least one of the values. If cache is empty, then false is returned.

Parameters:
vals - Values to check.
Returns:
true if this cache contains mappings for at least one of the values.

containsAnyValues

boolean containsAnyValues(@Nullable
                          GridPredicate<? super V>... filter)
Returns true if at least one of cache values passes through the filter. If cache is empty, then false is returned.

Parameters:
filter - Filter to check.
Returns:
true if at least one of cache values passes through the filter.

containsAnyEntries

boolean containsAnyEntries(@Nullable
                           GridPredicate<? super GridCacheEntry<K,V>>... filter)
Returns true if passed in predicate evaluates to true for any of the cache entries. If cache is empty, then false is returned.

Parameters:
filter - Entry filter to check.
Returns:
True if passed in predicate evaluates to true for any of the cache entries, false otherwise.

containsAllEntries

boolean containsAllEntries(@Nullable
                           GridPredicate<? super GridCacheEntry<K,V>>... filter)
Returns true if all cache entries pass through the filter. If cache is empty, then true is returned.

Parameters:
filter - Entry filter to check.
Returns:
True if all cache entries pass through the filter.

forEach

void forEach(GridInClosure<? super GridCacheEntry<K,V>> vis,
             @Nullable
             Collection<? extends K> keys)
Executes visitor closure on each cache element.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Closure which will be invoked for each cache entry.
keys - Keys to visit.

forEachAsync

GridFuture<?> forEachAsync(GridInClosure<? super GridCacheEntry<K,V>> vis,
                           @Nullable
                           Collection<? extends K> keys)
Asynchronously executes visitor closure on each cache element.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Closure which will be invoked for each cache entry.
keys - Keys to visit.
Returns:
Future which will complete whenever this operation completes.

forEach

void forEach(GridInClosure<? super GridCacheEntry<K,V>> vis)
Executes visitor closure on each cache element.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Closure which will be invoked for each cache entry.

forEachAsync

GridFuture<?> forEachAsync(GridInClosure<? super GridCacheEntry<K,V>> vis)
Asynchronously executes visitor closure on each cache element.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Closure which will be invoked for each cache entry.
Returns:
Future which will complete whenever this operation completes.

forEach

void forEach(GridInClosure<? super GridCacheEntry<K,V>> vis,
             @Nullable
             K... keys)
Executes visitor closure on each cache element.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Closure which will be invoked for each cache entry.
keys - Keys to visit.

forEachAsync

GridFuture<?> forEachAsync(GridInClosure<? super GridCacheEntry<K,V>> vis,
                           @Nullable
                           K... keys)
Asynchronously executes visitor closure on each cache element.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Closure which will be invoked for each cache entry.
keys - Keys to visit.
Returns:
Future which will complete whenever this operation completes.

forAll

boolean forAll(GridPredicate<? super GridCacheEntry<K,V>> vis)
Tests whether the predicate holds for all entries. If cache is empty, then true is returned.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Predicate to test for each cache entry.
Returns:
True if the given predicate holds for all visited entries, false otherwise.

forAllAsync

GridFuture<Boolean> forAllAsync(GridPredicate<? super GridCacheEntry<K,V>> vis)
Asynchronously tests whether the predicate holds for all entries. If cache is empty, then true is returned.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Predicate to test for each cache entry.
Returns:
Future which will complete whenever this operation completes.

forAll

boolean forAll(GridPredicate<? super GridCacheEntry<K,V>> vis,
               @Nullable
               Collection<? extends K> keys)
Tests whether the predicate holds for all entries. If cache is empty, then true is returned.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Predicate to test for each cache entry.
keys - Keys to visit.
Returns:
True if the given predicate holds for all visited entries, false otherwise.

forAllAsync

GridFuture<Boolean> forAllAsync(GridPredicate<? super GridCacheEntry<K,V>> vis,
                                @Nullable
                                Collection<? extends K> keys)
Asynchronously tests whether the predicate holds for all entries. If cache is empty, then true is returned.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Predicate to test for each cache entry.
keys - Keys to visit.
Returns:
Future which will complete whenever this operation completes.

forAll

boolean forAll(GridPredicate<? super GridCacheEntry<K,V>> vis,
               @Nullable
               K... keys)
Tests whether the predicate holds for all entries. If cache is empty, then true is returned.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Predicate to test for each cache entry.
keys - Keys to visit.
Returns:
True if the given predicate holds for all visited entries, false otherwise.

forAllAsync

GridFuture<Boolean> forAllAsync(GridPredicate<? super GridCacheEntry<K,V>> vis,
                                @Nullable
                                K... keys)
Asynchronously tests whether the predicate holds for all entries. If cache is empty, then true is returned.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
vis - Predicate to test for each cache entry.
keys - Keys to visit.
Returns:
Future which will complete whenever this operation completes.

reduce

@Nullable
<R> R reduce(GridReducer<? super GridCacheEntry<K,V>,R> rdc)
Visits every cache entry and then reduces the result.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
rdc - Reducer which will be invoked for all keys-value pairs and eventually return a value at the end.
Returns:
Reduced value provided by reducer.

reduceAsync

<R> GridFuture<R> reduceAsync(GridReducer<? super GridCacheEntry<K,V>,R> rdc)
Asynchronously visits every cache entry and then reduces the result.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
rdc - Reducer which will be invoked for all keys-value pairs and eventually return a value at the end.
Returns:
Future which will complete whenever this operation completes.

reduce

@Nullable
<R> R reduce(GridReducer<? super GridCacheEntry<K,V>,R> rdc,
                      @Nullable
                      Collection<? extends K> keys)
Visits specified cache entries and then reduces the result.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
rdc - Reducer which will be invoked for all keys-value pairs and eventually return a value at the end.
keys - Keys to visit.
Returns:
Reduced value provided by reducer.

reduceAsync

<R> GridFuture<R> reduceAsync(GridReducer<? super GridCacheEntry<K,V>,R> rdc,
                              @Nullable
                              Collection<? extends K> keys)
Asynchronously visits specified cache entries and then reduces the result.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
rdc - Reducer which will be invoked for all keys-value pairs and eventually return a value at the end.
keys - Keys to visit.
Returns:
Future which will complete whenever this operation completes.

reduce

@Nullable
<R> R reduce(GridReducer<? super GridCacheEntry<K,V>,R> rdc,
                      @Nullable
                      K... keys)
Visits specified cache entries and then reduces the result.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
rdc - Reducer which will be invoked for all keys-value pairs and eventually return a value at the end.
keys - Keys to visit.
Returns:
Reduced value provided by reducer.

reduceAsync

<R> GridFuture<R> reduceAsync(GridReducer<? super GridCacheEntry<K,V>,R> rdc,
                              @Nullable
                              K... keys)
Asynchronously visits specified cache entries and then reduces the result.

Transactions

This method is not transactional and will not enlist keys into transaction simply because they were visited. However, if you perform transactional operations on the visited entries, those operations will enlist the entry into transaction.

Parameters:
rdc - Reducer which will be invoked for all keys-value pairs and eventually return a value at the end.
keys - Keys to visit.
Returns:
Future which will complete whenever this operation completes.

reload

@Nullable
V reload(K key,
                  @Nullable
                  GridPredicate<? super GridCacheEntry<K,V>>... filter)
         throws GridException
Reloads a single key from persistent storage. This method delegates to GridCacheStore.load(String, GridCacheTx, Object) method.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Throws:
GridException - If reloading failed.
Parameters:
key - Key to reload.
filter - Optional filter. If provided, will be used to filter entries before loading and before they get set into cache.
Returns:
Reloaded value or current value if entry was updated while reloading.

reloadAsync

GridFuture<V> reloadAsync(K key,
                          @Nullable
                          GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously reloads a single key from persistent storage. This method delegates to GridCacheStore.load(String, GridCacheTx, Object) method.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Parameters:
key - Key to reload.
filter - Optional filter. If provided, will be used to filter entries before loading and before they get set into cache.
Returns:
Future to be completed whenever the entry is reloaded.

reloadAll

void reloadAll()
               throws GridException
Reloads all currently cached keys form persistent storage.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Throws:
GridException - If reloading failed.

reloadAllAsync

GridFuture<?> reloadAllAsync()
Asynchronously reloads all specified entries from underlying persistent storage.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Returns:
Future which will complete whenever reload completes.

reloadAll

void reloadAll(@Nullable
               Collection<? extends K> keys,
               @Nullable
               GridPredicate<? super GridCacheEntry<K,V>>... filter)
               throws GridException
Reloads specified entries from underlying persistent storage.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Throws:
GridException - if reloading failed.
Parameters:
keys - Keys to reload.
filter - Optional filter. If provided, will be used to filter key-value pairs to be put into cache.

reloadAllAsync

GridFuture<?> reloadAllAsync(@Nullable
                             Collection<? extends K> keys,
                             @Nullable
                             GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously reloads all specified entries from underlying persistent storage.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Parameters:
keys - Keys to reload.
filter - Optional filter. If provided, will be used to filter key-value pairs to be put into cache.
Returns:
Future which will complete whenever reload completes.

reloadAll

void reloadAll(@Nullable
               K... keys)
               throws GridException
Reloads specified entries from underlying persistent storage.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Throws:
GridException - if reloading failed.
Parameters:
keys - Keys to reload.

reloadAllAsync

GridFuture<?> reloadAllAsync(@Nullable
                             K... keys)
Asynchronously reloads all specified entries from underlying persistent storage.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Parameters:
keys - Keys to reload.
Returns:
Future which will complete whenever reload completes.

reloadAll

void reloadAll(@Nullable
               GridPredicate<? super GridCacheEntry<K,V>>... filter)
               throws GridException
Reloads all currently cached entries which pass the passed in filter from the underlying persistent storage. This method delegates to GridCacheStore.loadAll(String, GridCacheTx, Collection, GridInClosure2) method, and is different from GridCache.loadCache(GridPredicate2, long, Object...) in the sense that only all currently cached keys are reloaded.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Throws:
GridException - If reloading failed.
Parameters:
filter - Optional filter. If provided, will be used to filter key-value pairs to be put into cache.

reloadAllAsync

GridFuture<?> reloadAllAsync(@Nullable
                             GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously reloads all currently cached entries which pass the filter from the underlying persistent storage. This method delegates to GridCacheStore.loadAll(String, GridCacheTx, Collection, GridInClosure2) method, and is different from GridCache.loadCache(GridPredicate2, long, Object...) in the sense that only all currently cached keys are reloaded.

Transactions

This method does not participate in transactions, however it does not violate cache integrity and can be used safely with or without transactions.

Parameters:
filter - Optional filter. If provided, will be used to filter key-value pairs to be put into cache.
Returns:
Future which will complete whenever reload completes.

peek

@Nullable
V peek(K key)
Peeks at in-memory cached value using default GridCachePeekMode.SMART peek mode.

This method will not load value from any persistent store or from a remote node.

Transactions

This method does not participate in any transactions, however, it will peek at transactional value according to the GridCachePeekMode.SMART mode semantics. If you need to look at global cached value even from within transaction, you can use GridCacheProjection.peek(Object, GridCachePeekMode...) method.

Throws:
NullPointerException - If key is null.
Parameters:
key - Entry key.
Returns:
Peeked value.

peek

@Nullable
V peek(K key,
                @Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
Peeks at in-memory cached value using default GridCachePeekMode.SMART peek mode.

This method will not load values from any persistent storage or from a remote node.

Transactions

This method does not participate in any transactions, however, it will peek at transactional value according to the GridCachePeekMode.SMART mode semantics. If you need to look at global cached value even from within transaction, you can use GridCacheProjection.peek(Object, GridCachePeekMode...) method.

Throws:
NullPointerException - If key is null.
Parameters:
key - Key to peek.
filter - Optional filter. If entry does not pass the filter, null is returned.
Returns:
Peeked value or null if entry does not have a value or did not pass the filter.

peekAll

Map<K,V> peekAll(@Nullable
                 Collection<? extends K> keys)
Peeks at in-memory cached values using default GridCachePeekMode.SMART peek mode.

This method will not load values from any persistent storage or from a remote node.

Transactions

This method does not participate in any transactions, however, it will peek at transactional value according to the GridCachePeekMode.SMART mode semantics. If you need to look at global cached value even from within transaction, you can use GridCacheProjection.peek(Object, GridCachePeekMode...) method.

Parameters:
keys - Keys to peek.
Returns:
Map of key-value pairs.

peekAll

Map<K,V> peekAll(@Nullable
                 Collection<? extends K> keys,
                 @Nullable
                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
Peeks at in-memory cached value using default GridCachePeekMode.SMART peek mode. Only values that pass the filter will be returned.

This method will not load values from any persistent storage or from a remote node.

Transactions

This method does not participate in any transactions, however, it will peek at transactional value according to the GridCachePeekMode.SMART mode semantics. If you need to look at global cached value even from within transaction, you can use GridCacheProjection.peek(Object, GridCachePeekMode...) method.

Parameters:
keys - Keys to get.
filter - Optional filter. If provided, will be used to filter entries prior to returning.
Returns:
Map of key-value pairs.

peekAll

Map<K,V> peekAll(@Nullable
                 K... keys)
Peeks at in-memory cached values using default GridCachePeekMode.SMART peek mode.

This method will not load values from any persistent storage or from a remote node.

Transactions

This method does not participate in any transactions, however, it will peek at transactional value according to the GridCachePeekMode.SMART mode semantics. If you need to look at global cached value even from within transaction, you can use GridCacheProjection.peek(Object, GridCachePeekMode...) method.

Parameters:
keys - Keys to get.
Returns:
Map of key-value pairs.

peekAll

Map<K,V> peekAll(@Nullable
                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
Peeks at in-memory cached value using default GridCachePeekMode.SMART peek mode. Only values that pass the filter will be returned.

This method will not load values from any persistent storage or from a remote node.

Transactions

This method does not participate in any transactions, however, it will peek at transactional value according to the GridCachePeekMode.SMART mode semantics. If you need to look at global cached value even from within transaction, you can use GridCacheProjection.peek(Object, GridCachePeekMode...) method.

Parameters:
filter - Only keys that pass through all provided filters will be retrieved.
Returns:
Map of key-value pairs.

peek

@Nullable
V peek(K key,
                @Nullable
                GridCachePeekMode... modes)
       throws GridException
Peeks at cached value using optional set of peek modes. This method will sequentially iterate over given peek modes in the order passed in, and try to peek at value using each peek mode. Once a 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 GridCacheProjection.peek(Object) implicitly using GridCachePeekMode.SMART mode.

Transactions

This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

Throws:
GridException - If peek operation failed.
NullPointerException - If key is null.
Parameters:
key - Entry key.
modes - Optional set of peek modes.
Returns:
Peeked value.

peek

@Nullable
V peek(K key,
                @Nullable
                Collection<GridCachePeekMode> modes)
       throws GridException
Peeks at cached value using optional set of peek modes. This method will sequentially iterate over given peek modes in the order passed in, and try to peek at value using each peek mode. Once a 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 GridCacheProjection.peek(Object), implicitly using GridCachePeekMode.SMART mode.

Transactions

This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

Throws:
GridException - If peek operation failed.
NullPointerException - If key is null.
Parameters:
key - Entry key.
modes - Optional set of peek modes.
Returns:
Peeked value.

peekAsync

@Nullable
GridFuture<V> peekAsync(K key,
                                 @Nullable
                                 GridCachePeekMode... modes)
Asynchronously peeks at cached value using optional set of peek modes. This method will sequentially iterate over given peek modes in the order passed in, and try to peek at value using each peek mode. Once a 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 GridCacheProjection.peek(Object), implicitly using GridCachePeekMode.SMART mode.

Transactions

This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

Throws:
NullPointerException - If key is null.
Parameters:
key - Entry key.
modes - Optional set of peek modes.
Returns:
Future for peeked entry value.

peekAsync

@Nullable
GridFuture<V> peekAsync(K key,
                                 @Nullable
                                 Collection<GridCachePeekMode> modes)
Asynchronously peeks at cached value using optional set of peek modes. This method will sequentially iterate over given peek modes in the order passed in, and try to peek at value using each peek mode. Once a 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 GridCacheProjection.peek(Object), implicitly using GridCachePeekMode.SMART mode.

Transactions

This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

Throws:
NullPointerException - If key is null.
Parameters:
key - Entry key.
modes - Optional set of peek modes.
Returns:
Future for peeked entry value.

peekAll

Map<K,V> peekAll(@Nullable
                 Collection<? extends K> keys,
                 @Nullable
                 GridCachePeekMode... modes)
                 throws GridException
Peeks at cached values using optional set of peek modes. This method will sequentially iterate over given peek modes in the order passed in, and try to peek at value using each peek mode. Once a 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 GridCacheProjection.peekAll(Collection), implicitly using GridCachePeekMode.SMART mode.

Transactions

This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

Throws:
GridException - If peek operation failed.
Parameters:
keys - Keys to peek.
modes - Peek modes.
Returns:
Map of peeked key-value pairs.

peekAll

Map<K,V> peekAll(@Nullable
                 Collection<? extends K> keys,
                 @Nullable
                 Collection<GridCachePeekMode> modes)
                 throws GridException
Peeks at cached values using optional set of peek modes. This method will sequentially iterate over given peek modes in the order passed in, and try to peek at value using each peek mode. Once a 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 GridCacheProjection.peekAll(Collection), implicitly using GridCachePeekMode.SMART mode.

Transactions

This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

Throws:
GridException - If peek operation failed.
Parameters:
keys - Keys to peek.
modes - Peek modes.
Returns:
Map of peeked key-value pairs.

peekAllAsync

GridFuture<Map<K,V>> peekAllAsync(@Nullable
                                  Collection<? extends K> keys,
                                  @Nullable
                                  GridCachePeekMode... modes)
Asynchronously peeks at cached values using optional set of peek modes. This method will sequentially iterate over given peek modes in the order passed in, and try to peek at value using each peek mode. Once a 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 GridCacheProjection.peek(Object), implicitly using GridCachePeekMode.SMART mode.

Transactions

This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

Parameters:
keys - Keys to peek.
modes - Peek modes.
Returns:
Future for map of peeked key-value pairs.

peekAllAsync

GridFuture<Map<K,V>> peekAllAsync(@Nullable
                                  Collection<? extends K> keys,
                                  @Nullable
                                  Collection<GridCachePeekMode> modes)
Asynchronously peeks at cached values using optional set of peek modes. This method will sequentially iterate over given peek modes in the order passed in, and try to peek at value using each peek mode. Once a 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 GridCacheProjection.peek(Object), implicitly using GridCachePeekMode.SMART mode.

Transactions

This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

Parameters:
keys - Keys to peek.
modes - Peek modes.
Returns:
Future for map of peeked key-value pairs.

get

@Nullable
V get(K key,
               @Nullable
               GridPredicate<? super GridCacheEntry<K,V>>... filter)
      throws GridException
Retrieves value mapped to the specified key from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. The return value of 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 GridCacheStore persistent storage via GridCacheStore.load(String, GridCacheTx, Object) method.

Transactions

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

Cache Flags

This method is not available if GridCacheFlag.LOCAL flag is set on projection.

Throws:
GridException - If get operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If failed projection flags validation.
NullPointerException - if the key is null.
Parameters:
key - Key to retrieve the value for.
filter - Filter to check prior to getting the value. Note that filter check together with getting the value is an atomic operation.
Returns:
Value for the given key.

getAsync

GridFuture<V> getAsync(K key,
                       @Nullable
                       GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously retrieves value mapped to the specified key from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. The return value of 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 GridCacheStore persistent storage via GridCacheStore.load(String, GridCacheTx, Object) method.

Transactions

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

Cache Flags

This method is not available if GridCacheFlag.LOCAL flag is set on projection.

Throws:
NullPointerException - if the key is null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
key - Key for the value to get.
filter - Filter to check prior to getting the value. Note that filter check together with getting the value is an atomic operation.
Returns:
Future for the get operation.

getAll

Map<K,V> getAll(@Nullable
                Collection<? extends K> keys,
                @Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
Retrieves values mapped to the specified keys from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. If requested key-value pair is not present in the returned map, then it means that its entry did not pass the provided filter or cache has no mapping for the key.

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 GridCacheStore persistent storage via GridCacheStore.loadAll(String, GridCacheTx, Collection, GridInClosure2) method.

Transactions

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

Cache Flags

This method is not available if GridCacheFlag.LOCAL flag is set on projection.

Throws:
GridException - If get operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If failed projection flags validation.
Parameters:
keys - Keys to get.
filter - Only keys that pass through all provided filters will be retrieved.
Returns:
Map of key-value pairs.

getAllAsync

GridFuture<Map<K,V>> getAllAsync(@Nullable
                                 Collection<? extends K> keys,
                                 @Nullable
                                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously retrieves values mapped to the specified keys from cache. Value will only be returned if its entry passed the optional filter provided. Filter check is atomic, and therefore the returned value is guaranteed to be consistent with the filter. If requested key-value pair is not present in the returned map, then it means that its entry did not pass the provided filter or cache has no mapping for the key.

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 GridCacheStore persistent storage via GridCacheStore.loadAll(String, GridCacheTx, Collection, GridInClosure2) method.

Transactions

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

Cache Flags

This method is not available if GridCacheFlag.LOCAL flag is set on projection.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
keys - Key for the value to get.
filter - Only keys that pass through all provided filters will be retrieved.
Returns:
Future for the get operation.

getAll

Map<K,V> getAll(@Nullable
                K... keys)
                throws GridException
Retrieves values mapped to the specified keys from cache. If requested key-value pair is not present in the returned map, then it means that cache has no mapping for the key.

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 GridCacheStore persistent storage via GridCacheStore.loadAll(String, GridCacheTx, Collection, GridInClosure2) method.

Transactions

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

Cache Flags

This method is not available if GridCacheFlag.LOCAL flag is set on projection.

Throws:
GridException - If get operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If failed projection flags validation.
Parameters:
keys - Keys to get.
Returns:
Map of key-value pairs.

getAllAsync

GridFuture<Map<K,V>> getAllAsync(@Nullable
                                 K... keys)
Asynchronously retrieves values mapped to the specified keys from cache. If requested key-value pair is not present in the returned map, then it means that cache has no mapping for the key.

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 GridCacheStore persistent storage via GridCacheStore.loadAll(String, GridCacheTx, Collection, GridInClosure2) method.

Transactions

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

Cache Flags

This method is not available if GridCacheFlag.LOCAL flag is set on projection.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
keys - Keys to get.
Returns:
Map of key-value pairs.

getAll

Map<K,V> getAll(@Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
Retrieves all values whose entries pass the provided filter. Note, that a new map will be created, and therefore, if filter accepts all, or close to all, cache entries, the created map may get very large and affect performance and memory consumption. In this case it is more advisable to use GridCacheProjection.projection(GridPredicate[]) based on entry filter, as it is simply a view on the underlying cache and not a copy.

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 GridCacheStore persistent storage via GridCacheStore.loadAll(String, GridCacheTx, Collection, GridInClosure2) method.

Transactions

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

Cache Flags

This method is not available if GridCacheFlag.LOCAL flag is set on projection.

Throws:
GridException - If get operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
filter - Only keys that pass through all provided filters will be retrieved.
Returns:
Map of key-value pairs.

getAllAsync

GridFuture<Map<K,V>> getAllAsync(@Nullable
                                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously retrieves all values whose entries pass the provided filter. Note, that a new map will be created, and therefore, if filter accepts all, or close to all, cache entries, the created map may get very large and affect performance and memory consumption. In this case it is more advisable to use GridCacheProjection.projection(GridPredicate[]) based on entry filter, as it is simply a view on the underlying cache and not a copy.

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 GridCacheStore persistent storage via GridCacheStore.loadAll(String, GridCacheTx, Collection, GridInClosure2) method.

Transactions

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

Cache Flags

This method is not available if GridCacheFlag.LOCAL flag is set on projection.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
filter - Only keys that pass through all provided filters will be retrieved.
Returns:
Future for the get operation.

put

@Nullable
V put(K key,
               V val,
               @Nullable
               GridPredicate<? super GridCacheEntry<K,V>>... filter)
      throws GridException
Stores given key-value pair 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 cache previously contained value for the given key, then this value is returned. Otherwise, in case of GridCacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying GridCacheStore storage. In case of 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, GridCacheStore.load(String, GridCacheTx, Object) method will be used.

If the returned value is not needed, method GridCacheProjection.putx(Object, Object, GridPredicate[]) 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
GridException - If put operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
Previous value associated with specified key, or null if entry did not pass the filter, or if there was no mapping for the key in swap or in persistent storage.

putAsync

GridFuture<V> putAsync(K key,
                       V val,
                       @Nullable
                       GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously stores given key-value pair 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 cache previously contained value for the given key, then this value is returned. Otherwise, in case of GridCacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying GridCacheStore storage. In case of 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, GridCacheStore.load(String, GridCacheTx, Object) method will be used.

If the returned value is not needed, method GridCacheProjection.putx(Object, Object, GridPredicate[]) 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
Future for the put operation.

putx

boolean putx(K key,
             V val,
             @Nullable
             GridPredicate<? super GridCacheEntry<K,V>>... filter)
             throws GridException
Stores given key-value pair 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.

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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
GridException - If put operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
True if value was stored in cache, false otherwise.

putxAsync

GridFuture<Boolean> putxAsync(K key,
                              V val,
                              @Nullable
                              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Stores given key-value pair 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.

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 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
Future for the put operation.

putIfAbsent

@Nullable
V putIfAbsent(K key,
                       V val)
              throws GridException
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. Otherwise, in case of GridCacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying GridCacheStore storage. In case of 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, GridCacheStore.load(String, 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
GridException - If put operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
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.

putIfAbsentAsync

GridFuture<V> putIfAbsentAsync(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. Otherwise, in case of GridCacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying GridCacheStore storage. In case of 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, GridCacheStore.load(String, 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
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.

putxIfAbsent

boolean putxIfAbsent(K key,
                     V val)
                     throws GridException
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 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
GridException - If put operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
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.

putxIfAbsentAsync

GridFuture<Boolean> putxIfAbsentAsync(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 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
key - Key to store in cache.
val - Value to be associated with the given key.
Returns:
Future for this put operation.

replace

@Nullable
V replace(K key,
                   V val)
          throws GridException
Stores given key-value pair in cache only if if there is a previous mapping for it. If cache previously contained value for the given key, then this value is returned. Otherwise, in case of GridCacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying GridCacheStore storage. In case of 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, GridCacheStore.load(String, 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
GridException - If replace operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
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.

replaceAsync

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. If cache previously contained value for the given key, then this value is returned. Otherwise, in case of GridCacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying GridCacheStore storage. In case of 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, GridCacheStore.load(String, 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
key - Key to store in cache.
val - Value to be associated with the given key.
Returns:
Future for replace operation.

replacex

boolean replacex(K key,
                 V val)
                 throws GridException
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 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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
GridException - If replace operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
key - Key to store in cache.
val - Value to be associated with the given key.
Returns:
True if replace happened, false otherwise.

replacexAsync

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.

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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
key - Key to store in cache.
val - Value to be associated with the given key.
Returns:
Future for the replace operation.

replace

boolean replace(K key,
                V oldVal,
                V newVal)
                throws GridException
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 GridCacheStore via GridCacheStore.put(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
GridException - If replace operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
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.

replaceAsync

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.

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(String, GridCacheTx, Object, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If either key or value are null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
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.

putAll

void putAll(@Nullable
            Map<? extends K,? extends V> m,
            @Nullable
            GridPredicate<? super GridCacheEntry<K,V>>... filter)
            throws GridException
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 GridCacheStore via GridCacheStore.putAll(String, GridCacheTx, Map) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If put operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.

putAllAsync

GridFuture<?> putAllAsync(@Nullable
                          Map<? extends K,? extends V> m,
                          @Nullable
                          GridPredicate<? super GridCacheEntry<K,V>>... filter)
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 GridCacheStore via GridCacheStore.putAll(String, GridCacheTx, Map) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
Future for putAll operation.

keySet

Set<K> keySet()
Set of cached keys. Note that this set will contain mappings for all keys, even if their values are 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.

Returns:
Key set for this cache.

keySet

Set<K> keySet(@Nullable
              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Set of cached keys. Note that this set will contain mappings for all keys, even if their values are 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.

If filter is provided, then only the keys for the entries that pass provided filters are included in the set.

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.

Parameters:
filter - Filter for the key set. If not provided then key set for the whole cache is returned.
Returns:
Key set for this cache.

keySet

Set<K> keySet(@Nullable
              Collection<? extends K> keys,
              @Nullable
              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Set of cached keys. Note that this set will contain mappings for all cached keys, even if their values are 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.

If filter is provided, then only the keys for the entries that pass provided filters are returned.

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.

Parameters:
keys - Only keys specified here will be returned in the set.
filter - Filter for the key set. If not provided then key set for the whole cache is returned.
Returns:
Key set for this cache.

keySet

Set<K> keySet(@Nullable
              K... keys)
Set of cached keys. Note that this set will contain mappings for all cached keys, even if their values are 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.

Parameters:
keys - Only keys specified here will be returned in the set.
Returns:
Key set for this cache.

primaryKeySet

Set<K> primaryKeySet()
Set of cached primary keys for which local node is the primary node. This set is dynamic and may change with grid topology changes. Note that this set will contain mappings for all keys, even if their values are 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.

Returns:
Primary key set for the current node.

primaryKeySet

Set<K> primaryKeySet(@Nullable
                     GridPredicate<? super GridCacheEntry<K,V>>... filter)
Set of cached primary keys for which local node is the primary node. This set is dynamic and may change with grid topology changes. Note that this set will contain mappings for all keys, even if their values are 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.

Parameters:
filter - Filter for the key set. If not provided then primary key set for the current node is returned.
Returns:
Primary key set for the current node.

primaryKeySet

Set<K> primaryKeySet(@Nullable
                     Collection<? extends K> keys,
                     @Nullable
                     GridPredicate<? super GridCacheEntry<K,V>>... filter)
Set of cached primary keys for which local node is the primary node. This set is dynamic and may change with grid topology changes. Note that this set will contain mappings for all keys, even if their values are 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.

If filter is provided, then only the keys for the entries that pass provided filters are returned.

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.

Parameters:
keys - Only keys specified here will be returned in the set.
filter - Filter for the key set. If not provided then primary key set for the current node is returned.
Returns:
Primary key set for the current node.

primaryKeySet

Set<K> primaryKeySet(@Nullable
                     K... keys)
Set of cached primary keys for which local node is the primary node. This set is dynamic and may change with grid topology changes. Note that this set will contain mappings for all keys, even if their values are 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.

Parameters:
keys - Only keys specified here will be returned in the set.
Returns:
Primary key set for the current node.

values

Collection<V> values()
Collection of cached values. Note that this collection will not contain values that are 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.

Returns:
Collection of cached values.

values

Collection<V> values(@Nullable
                     GridPredicate<? super GridCacheEntry<K,V>>... filter)
Collection of cached values. Note that this collection will not contain values that are 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.

If filter is provided, then only the values for the entries that pass provided filters are returned.

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.

Parameters:
filter - Filter for the collection of values. If not provided then values for the whole cache is returned.
Returns:
Collection of cached values.

values

Collection<V> values(@Nullable
                     Collection<? extends K> keys,
                     @Nullable
                     GridPredicate<? super GridCacheEntry<K,V>>... filter)
Collection of cached values for given keys. Note that this collection will not contain values that are 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.

If filter is provided, then only the values for the entries that pass provided filters are returned.

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.

Parameters:
keys - Keys for which value pairs will be returned.
filter - Filter for the collection of values. If not provided then values for the whole cache is returned.
Returns:
Collection of cached values.

values

Collection<V> values(@Nullable
                     K... keys)
Collection of cached values for given keys. Note that this collection will not contain values that are 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.

Parameters:
keys - Keys for which value pairs will be returned.
Returns:
Collection of cached values.

primaryValues

Collection<V> primaryValues()
Collection of primary cached values.for which local node is the primary node. This collection is dynamic and may change with grid topology changes. Note that this collection will not contain values that are 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.

Returns:
Collection of primary cached values for the current node.

primaryValues

Collection<V> primaryValues(@Nullable
                            GridPredicate<? super GridCacheEntry<K,V>>... filter)
Collection of primary cached values.for which local node is the primary node. This collection is dynamic and may change with grid topology changes. Note that this collection will not contain values that are 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.

If filter is provided, then only the values for the entries that pass provided filters are returned.

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.

Parameters:
filter - Filter for the collection of values. If not provided then primary values for the current node is returned.
Returns:
Collection of primary cached values for the current node.

primaryValues

Collection<V> primaryValues(@Nullable
                            Collection<? extends K> keys,
                            @Nullable
                            GridPredicate<? super GridCacheEntry<K,V>>... filter)
Collection of primary cached values.for which local node is the primary node. This collection is dynamic and may change with grid topology changes. Note that this collection will not contain values that are 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.

If filter is provided, then only the values for the entries that pass provided filters are returned.

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.

Parameters:
keys - Keys for which value pairs will be returned.
filter - Filter for the collection of values. If not provided then primary values for the current node is returned.
Returns:
Collection of primary cached values for the current node.

primaryValues

Collection<V> primaryValues(@Nullable
                            K... keys)
Collection of primary cached values.for which local node is the primary node. This collection is dynamic and may change with grid topology changes. Note that this collection will not contain values that are 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.

Parameters:
keys - Keys for which value pairs will be returned.
Returns:
Collection of primary cached values for the current node.

entrySet

Set<GridCacheEntry<K,V>> entrySet()
Gets set containing all cache entries. 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.

Returns:
Set containing all current cache entries.

entrySet

Set<GridCacheEntry<K,V>> entrySet(@Nullable
                                  Collection<? extends K> keys,
                                  @Nullable
                                  GridPredicate<? super GridCacheEntry<K,V>>... filter)
Gets set containing all cache entries for given keys. 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.

If optional filters are provided, then only entries that successfully pass the filters will be included in the resulting set.

Parameters:
keys - Keys to get entries for.
filter - Filter for all entries in the set.
Returns:
Cache entries for specified keys (possibly empty).

entrySet

Set<GridCacheEntry<K,V>> entrySet(@Nullable
                                  K... keys)
Gets set containing all cache entries for given keys. 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.

Parameters:
keys - Keys to get entries for.
Returns:
Cache entries for specified keys (possibly empty).

entrySet

Set<GridCacheEntry<K,V>> entrySet(@Nullable
                                  GridPredicate<? super GridCacheEntry<K,V>>... filter)
Gets set containing all cache entries. 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.

If optional filters are provided, then only entries that successfully pass the filters will be included in the resulting set.

Parameters:
filter - Key filter for entries.
Returns:
Entries that pass through key filter.

primaryEntrySet

Set<GridCacheEntry<K,V>> primaryEntrySet()
Gets set containing cache entries for which local node is the primary node. This set is dynamic and may change with grid topology changes. 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.

Returns:
Set containing primary cache entries for the current node.

primaryEntrySet

Set<GridCacheEntry<K,V>> primaryEntrySet(@Nullable
                                         Collection<? extends K> keys,
                                         @Nullable
                                         GridPredicate<? super GridCacheEntry<K,V>>... filter)
Gets set containing cache entries for which local node is the primary node. This set is dynamic and may change with grid topology changes. 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.

If optional filters are provided, then only entries that successfully pass the filters will be included in the resulting set.

Parameters:
keys - Keys to get entries for.
filter - Filter for primary entries in the set.
Returns:
Primary cache entries for specified keys (possibly empty).

primaryEntrySet

Set<GridCacheEntry<K,V>> primaryEntrySet(@Nullable
                                         K... keys)
Gets set containing cache entries for which local node is the primary node. This set is dynamic and may change with grid topology changes. 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.

Parameters:
keys - Keys to get entries for.
Returns:
Primary cache entries for specified keys (possibly empty).

primaryEntrySet

Set<GridCacheEntry<K,V>> primaryEntrySet(@Nullable
                                         GridPredicate<? super GridCacheEntry<K,V>>... filter)
Gets set containing cache entries for which local node is the primary node. This set is dynamic and may change with grid topology changes. 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.

If optional filters are provided, then only entries that successfully pass the filters will be included in the resulting set.

Parameters:
filter - Key filter for entries.
Returns:
Primary cache entries that pass through key filter.

createQuery

GridCacheQuery<K,V> createQuery(GridCacheQueryType type)
Creates user's query for given query type. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
Returns:
Created query.

createQuery

GridCacheQuery<K,V> createQuery(GridCacheQueryType type,
                                @Nullable
                                Class<?> cls,
                                @Nullable
                                String clause)
Creates user's query for given query type, queried class, and query clause which is generally a where clause. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
cls - Query class (may be null for GridCacheQueryType.SCAN queries).
clause - Query clause (should be null for GridCacheQueryType.SCAN queries).
Returns:
Created query.

createQuery

GridCacheQuery<K,V> createQuery(GridCacheQueryType type,
                                @Nullable
                                String clsName,
                                @Nullable
                                String clause)
Creates user's query for given query type, queried class, and query clause which is generally a where clause. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
clsName - Query class name (may be null for GridCacheQueryType.SCAN queries).
clause - Query clause (should be null for GridCacheQueryType.SCAN queries).
Returns:
Created query.

createTransformQuery

<T> GridCacheTransformQuery<K,V,T> createTransformQuery()
Creates user's transform query. For more information refer to GridCacheQuery documentation.

Returns:
Created query.

createTransformQuery

<T> GridCacheTransformQuery<K,V,T> createTransformQuery(GridCacheQueryType type)
Creates user's transform query. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
Returns:
Created query.

createTransformQuery

<T> GridCacheTransformQuery<K,V,T> createTransformQuery(GridCacheQueryType type,
                                                        @Nullable
                                                        Class<?> cls,
                                                        @Nullable
                                                        String clause)
Creates user's transform query. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
cls - Query class (may be null for GridCacheQueryType.SCAN queries).
clause - Query clause (should be null for GridCacheQueryType.SCAN queries).
Returns:
Created query.

createTransformQuery

<T> GridCacheTransformQuery<K,V,T> createTransformQuery(GridCacheQueryType type,
                                                        @Nullable
                                                        String clsName,
                                                        @Nullable
                                                        String clause)
Creates user's transform query. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
clsName - Query class name (may be null for GridCacheQueryType.SCAN queries).
clause - Query clause (should be null for GridCacheQueryType.SCAN queries).
Returns:
Created query.

createReduceQuery

<R1,R2> GridCacheReduceQuery<K,V,R1,R2> createReduceQuery()
Creates user's reduce query. For more information refer to GridCacheQuery documentation.

Returns:
Created query.

createReduceQuery

<R1,R2> GridCacheReduceQuery<K,V,R1,R2> createReduceQuery(GridCacheQueryType type)
Creates user's reduce query. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
Returns:
Created query.

createReduceQuery

<R1,R2> GridCacheReduceQuery<K,V,R1,R2> createReduceQuery(GridCacheQueryType type,
                                                          @Nullable
                                                          Class<?> cls,
                                                          @Nullable
                                                          String clause)
Creates user's reduce query. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
cls - Query class (may be null for GridCacheQueryType.SCAN queries).
clause - Query clause (should be null for GridCacheQueryType.SCAN queries).
Returns:
Created query.

createReduceQuery

<R1,R2> GridCacheReduceQuery<K,V,R1,R2> createReduceQuery(GridCacheQueryType type,
                                                          @Nullable
                                                          String clsName,
                                                          @Nullable
                                                          String clause)
Creates user's reduce query. For more information refer to GridCacheQuery documentation.

Parameters:
type - Query type.
clsName - Query class name (may be null for GridCacheQueryType.SCAN queries).
clause - Query clause (should be null for GridCacheQueryType.SCAN queries).
Returns:
Created query.

txStart

GridCacheTx txStart()
                    throws IllegalStateException
Starts transaction with default isolation, concurrency, timeout, and invalidation policy. All defaults are set in GridCacheConfiguration at startup.

Throws:
IllegalStateException - If transaction is already started by this thread.
Returns:
New transaction

txStart

GridCacheTx txStart(long timeout)
Starts new transaction with the specified timeout and default concurrency, isolation, and invalidation policy.

Throws:
IllegalStateException - If transaction is already started by this thread.
Parameters:
timeout - Transaction timeout.
Returns:
New transaction.

txStart

GridCacheTx txStart(GridCacheTxConcurrency concurrency,
                    GridCacheTxIsolation isolation)
Starts new transaction with the specified concurrency and isolation.

Throws:
IllegalStateException - If transaction is already started by this thread.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
Returns:
New transaction.

txStart

GridCacheTx txStart(GridCacheTxConcurrency concurrency,
                    GridCacheTxIsolation isolation,
                    long timeout,
                    boolean invalidate)
Starts transaction with specified isolation, concurrency, timeout, and invalidation flag.

Throws:
IllegalStateException - If transaction is already started by this thread.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
timeout - Timeout.
invalidate - Invalidation policy.
Returns:
New transaction.

tx

@Nullable
GridCacheTx tx()
Gets transaction started by this thread or null if this thread does not have a transaction.

Returns:
Transaction started by this thread or null if this thread does not have a transaction.

entry

@Nullable
GridCacheEntry<K,V> entry(K key)
Gets entry from cache with the specified key. The returned entry can be used even after entry key has been removed from cache. In that case, every operation on returned entry will result in creation of a new entry.

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.

Parameters:
key - Entry key.
Returns:
Cache entry or null if projection pre-filtering was not passed.

evict

boolean evict(K key,
              @Nullable
              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Evicts entry associated with given key from cache. Note, that entry will be evicted only if it's not used (not participating in any locks or transactions).

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.SKIP_SWAP is not enabled, the evicted entry will be swapped to disk.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Parameters:
key - Key to evict from cache.
filter - Optional filter that entry should pass before it will be evicted.
Returns:
True if entry could be evicted, false otherwise.

evictAll

void evictAll()
Attempts to evict all cache entries. Note, that entry will be evicted only if it's not used (not participating in any locks or transactions).

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.SKIP_SWAP is not enabled, the evicted entries will be swapped to disk.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.


evictAll

void evictAll(@Nullable
              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Attempts to evict all cache entries. Note, that entry will be evicted only if it's not used (not participating in any locks or transactions).

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.SKIP_SWAP is not enabled, the evicted entries will be swapped to disk.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Parameters:
filter - Optional filter that entry should pass before it will be evicted.

evictAll

void evictAll(@Nullable
              Collection<? extends K> keys,
              @Nullable
              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Attempts to evict all entries associated with keys. Note, that entry will be evicted only if it's not used (not participating in any locks or transactions).

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.SKIP_SWAP is not enabled, the evicted entries will be swapped to disk.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Parameters:
keys - Keys to evict.
filter - Optional filter that entry should pass before it will be evicted.

evictAll

void evictAll(@Nullable
              K... keys)
Attempts to evict all entries associated with keys. Note, that entry will be evicted only if it's not used (not participating in any locks or transactions).

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.SKIP_SWAP is not enabled, the evicted entries will be swapped to disk.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Parameters:
keys - Keys to evict.

clearAll

void clearAll()
Clears all entries from this cache only if the entry is not currently locked or participating in a transaction.

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.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.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.


clearAll

void clearAll(@Nullable
              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Clears all entries from this cache only if the entry is not currently locked or participating in a transaction.

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.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.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Parameters:
filter - Optional entry filter that entry should pass before it will be cleared.

clearAll

void clearAll(@Nullable
              Collection<? extends K> keys,
              @Nullable
              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Clears all entries from this cache only if the entry is not currently locked, and is not participating in a transaction.

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.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.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Parameters:
keys - Keys to clear.
filter - Optional entry filter that entry should pass before it will be cleared.

clearAll

void clearAll(@Nullable
              K... keys)
Clears all entries from this cache only if the entry is not currently locked, is not participating in a transaction.

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.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.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Parameters:
keys - Keys to clear.

clear

boolean clear(K key,
              @Nullable
              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Clears an entry from this cache and swap storage only if the entry is not currently locked, and is not participating in a transaction.

If GridCacheConfiguration.isSwapEnabled() is set to true and GridCacheFlag.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.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Parameters:
key - Key to clear.
filter - Optional entry filter that entry should pass before it will be evicted.
Returns:
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.

invalidate

boolean invalidate(K key,
                   @Nullable
                   GridPredicate<? super GridCacheEntry<K,V>>... filter)
                   throws GridException
Invalidates (nullifies) an entry with given key. This operation is local and non-transactional.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Throws:
GridException - In case of operation failure.
Parameters:
key - Key to invalidate entry for.
filter - Optional filter that entry should pass prior to invalidation.
Returns:
true if entry was invalidated, false otherwise.

invalidateAll

void invalidateAll(@Nullable
                   Collection<K> keys,
                   @Nullable
                   GridPredicate<? super GridCacheEntry<K,V>>... filter)
                   throws GridException
Invalidates (nullifies) all entries. This operation is local and non-transactional.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.READ.

Throws:
GridException - In case of operation failure.
Parameters:
keys - Keys to invalidate entries for.
filter - Optional filter that entry should pass prior to invalidation.

invalidateAll

void invalidateAll(@Nullable
                   K... keys)
                   throws GridException
Invalidates (nullifies) all entries. This operation is local and non-transactional.

Throws:
GridException - In case of operation failure.
Parameters:
keys - Keys to invalidate entries for.

compact

boolean compact(K key,
                @Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
Optimizes the size of an entry with given key. If entry value is null at the time of the call then entry is removed locally.

Throws:
GridException - If failed to compact.
Parameters:
key - Key to optimize entry for.
filter - Optional filter that entry should pass prior to optimization.
Returns:
true if entry was cleared from cache (if value was null).

compactAll

void compactAll(@Nullable
                Collection<K> keys,
                @Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
Optimizes the size of entries with given keys. If value of single processed entry is null at the time of the call then this entry is removed locally.

Throws:
GridException - If failed to compact.
Parameters:
keys - Keys to optimize entries for.
filter - Optional filter that entry should pass prior to optimization.

compactAll

void compactAll(@Nullable
                K... keys)
                throws GridException
Optimizes the size of entries with given keys. If value of single processed entry is null at the time of the call then this entry is removed locally.

Throws:
GridException - If failed to compact.
Parameters:
keys - Keys to optimize entries for.

remove

@Nullable
V remove(K key,
                  @Nullable
                  GridPredicate<? super GridCacheEntry<K,V>>... filter)
         throws GridException
Removes given key mapping from cache. If cache previously contained value for the given key, then this value is returned. Otherwise, in case of GridCacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying GridCacheStore storage. In case of 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, GridCacheStore.load(String, GridCacheTx, Object) method will be used.

If the returned value is not needed, method GridCacheProjection.removex(Object, GridPredicate[]) 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 GridCacheStore via GridCacheStore.remove(String, GridCacheTx, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - If key is null.
GridException - If remove operation failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
Previous value associated with specified key, or null if there was no value for this key.

removeAsync

GridFuture<V> removeAsync(K key,
                          GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously removes given key mapping from cache. If cache previously contained value for the given key, then this value is returned. Otherwise, in case of GridCacheMode.REPLICATED caches, the value will be loaded from swap and, if it's not there, and read-through is allowed, from the underlying GridCacheStore storage. In case of 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 and read-through is allowed, from the underlying persistent storage. If value has to be loaded from persistent storage, GridCacheStore.load(String, GridCacheTx, Object) method will be used.

If the returned value is not needed, method GridCacheProjection.removex(Object, GridPredicate[]) 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 GridCacheStore via GridCacheStore.remove(String, GridCacheTx, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - if the key is null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
Future for the remove operation.

removex

boolean removex(K key,
                @Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
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 GridCacheStore via GridCacheStore.remove(String, GridCacheTx, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - if the key is null.
GridException - If remove failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
True if filter passed validation and entry was removed, false otherwise.

removexAsync

GridFuture<Boolean> removexAsync(K key,
                                 @Nullable
                                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously 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 GridCacheStore via GridCacheStore.remove(String, GridCacheTx, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - if the key is null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
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.
Returns:
Future for the remove operation. The future will return true if optional filters passed validation and remove did occur, false otherwise.

remove

boolean remove(K key,
               V val)
               throws GridException
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 GridCacheStore via GridCacheStore.remove(String, GridCacheTx, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - if the key or value is null.
GridException - If remove failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
Parameters:
key - Key whose mapping is to be removed from cache.
val - Value to match against currently cached value.
Returns:
True if filter passed validation, false otherwise.

removeAsync

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.

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(String, GridCacheTx, Object) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
NullPointerException - if the key or value is null.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If projection flags validation failed.
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

void removeAll(@Nullable
               Collection<? extends K> keys,
               @Nullable
               GridPredicate<? super GridCacheEntry<K,V>>... filter)
               throws GridException
Removes given key mappings from cache for entries for which the optionally passed in filters do pass.

If write-through is enabled, the values will be removed from GridCacheStore via GridCacheStore.removeAll(String, GridCacheTx, Collection) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If remove failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
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.

removeAllAsync

GridFuture<?> removeAllAsync(@Nullable
                             Collection<? extends K> keys,
                             @Nullable
                             GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously removes given key mappings from cache for entries for which the optionally passed in filters do pass.

If write-through is enabled, the values will be removed from GridCacheStore via GridCacheStore.removeAll(String, GridCacheTx, Collection) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
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.
Returns:
Future for the remove operation. The future will complete whenever remove operation completes.

removeAll

void removeAll(@Nullable
               GridPredicate<? super GridCacheEntry<K,V>>... filter)
               throws GridException
Removes mappings from cache for entries for which the optionally passed in filters do pass. If passed in filters are 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(String, GridCacheTx, Collection) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If remove failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
filter - Filter used to supply keys for remove operation (if null, then nothing will be removed).

removeAllAsync

GridFuture<?> removeAllAsync(@Nullable
                             GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously removes mappings from cache for entries for which the optionally passed in filters do pass. If passed in filters are 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(String, GridCacheTx, Collection) method.

Transactions

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

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
filter - Filter used to supply keys for remove operation (if null, then nothing will be removed).
Returns:
Future for the remove operation. The future will complete whenever remove operation completes.

lock

boolean lock(K key,
             @Nullable
             GridPredicate<? super GridCacheEntry<K,V>>... filter)
             throws GridException
Synchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes. This method together with filter check will be executed as one atomic operation.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If lock acquisition resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
key - Key to lock.
filter - Optional filter to validate prior to acquiring the lock.
Returns:
True if all filters passed and lock was acquired, false otherwise.

lockAsync

GridFuture<Boolean> lockAsync(K key,
                              @Nullable
                              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes. This method together with filter check will be executed as one atomic operation.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
key - Key to lock.
filter - Optional filter to validate prior to acquiring the lock.
Returns:
Future for the lock operation. The future will return true whenever lock was successfully acquired, false otherwise.

lock

boolean lock(K key,
             long timeout,
             @Nullable
             GridPredicate<? super GridCacheEntry<K,V>>... filter)
             throws GridException
Synchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes. This method together with filter check will be executed as one atomic operation.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If lock acquisition resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
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.
Returns:
True if all filters passed and lock was acquired, false otherwise.

lockAsync

GridFuture<Boolean> lockAsync(K key,
                              long timeout,
                              @Nullable
                              GridPredicate<? super GridCacheEntry<K,V>>... filter)
Asynchronously acquires lock on a cached object with given key only if the passed in filter (if any) passes. This method together with filter check will be executed as one atomic operation.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
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.
Returns:
Future for the lock operation. The future will return true whenever all filters pass and locks are acquired before timeout is expired, false otherwise.

lockAll

boolean lockAll(@Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
All or nothing synchronous lock for passed in filter. The filter will be used to supply keys to be locked. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If lock acquisition resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
filter - Filter to supply keys to be locked.
Returns:
True if filters passed and all locks were acquired, false otherwise.

lockAllAsync

GridFuture<Boolean> lockAllAsync(@Nullable
                                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
All or nothing asynchronous lock for passed in filter. The filter will be used to supply keys to be locked. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
filter - Filter to supply keys to be locked.
Returns:
Future for the collection of locks. The future will return true if filters passed and all locks were acquired, false otherwise.

lockAll

boolean lockAll(long timeout,
                @Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
All or nothing synchronous lock for passed in filter. The filter will be used to supply keys to be locked. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If lock acquisition resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
timeout - Timeout in milliseconds to wait for lock to be acquired ('0' for no expiration).
filter - Filter to supply keys to be locked.
Returns:
True if all filters passed and locks were acquired before timeout has expired, false otherwise.

lockAllAsync

GridFuture<Boolean> lockAllAsync(long timeout,
                                 @Nullable
                                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
All or nothing asynchronous lock for passed in filter. The filter will be used to supply keys to be locked. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
timeout - Timeout in milliseconds to wait for lock to be acquired ('0' for no expiration).
filter - Filter to supply keys to be locked.
Returns:
Future for the collection of locks. The future will return true if all filters passed and locks were acquired before timeout has expired, false otherwise.

lockAll

boolean lockAll(@Nullable
                Collection<? extends K> keys,
                @Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

Throws:
GridException - If lock acquisition resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to lock.
filter - Optional filter that needs to atomically pass in order for the locks to be acquired.
Returns:
True if all locks were acquired.

lockAllAsync

GridFuture<Boolean> lockAllAsync(@Nullable
                                 Collection<? extends K> keys,
                                 @Nullable
                                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to lock.
filter - Optional filter that needs to atomically pass in order for the locks to be acquired.
Returns:
Future for the collection of locks. The future will return true if all filters passed and locks were acquired, false otherwise.

lockAll

boolean lockAll(@Nullable
                Collection<? extends K> keys,
                long timeout,
                @Nullable
                GridPredicate<? super GridCacheEntry<K,V>>... filter)
                throws GridException
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If lock acquisition resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
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.
Returns:
True if all filters passed and locks were acquired before timeout has expired, false otherwise.

lockAllAsync

GridFuture<Boolean> lockAllAsync(@Nullable
                                 Collection<? extends K> keys,
                                 long timeout,
                                 @Nullable
                                 GridPredicate<? super GridCacheEntry<K,V>>... filter)
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
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.
Returns:
Future for the collection of locks. The future will return true if all filters passed and locks were acquired before timeout has expired, false otherwise.

lockAll

boolean lockAll(@Nullable
                K... keys)
                throws GridException
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If lock acquisition resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to lock.
Returns:
This method always returns true or throws and exception.

lockAllAsync

GridFuture<Boolean> lockAllAsync(@Nullable
                                 K... keys)
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to lock.
Returns:
Future for the collection of locks. The future will return true after all locks were acquired.

lockAll

boolean lockAll(long timeout,
                @Nullable
                K... keys)
                throws GridException
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If lock acquisition resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to lock.
timeout - Timeout in milliseconds to wait for lock to be acquired ('0' for no expiration).
Returns:
True if all locks were acquired before timeout expired, false otherwise.

lockAllAsync

GridFuture<Boolean> lockAllAsync(long timeout,
                                 @Nullable
                                 K... keys)
All or nothing synchronous lock for passed in keys. This method together with filter check will be executed as one atomic operation. If at least one filter validation failed, no locks will be acquired.

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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to lock.
timeout - Timeout in milliseconds to wait for lock to be acquired ('0' for no expiration).
Returns:
Future for the collection of locks. The future will return true if all locks were acquired before timeout expired, false otherwise.

unlock

void unlock(K key,
            GridPredicate<? super GridCacheEntry<K,V>>... filter)
            throws GridException
Unlocks given key only if current thread owns the lock. If optional filter will not pass, then unlock will not happen. If the key being unlocked was never locked 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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If unlock execution resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
key - Key to unlock.
filter - Optional filter that needs to pass prior to unlock taking effect.

unlockAll

void unlockAll(@Nullable
               K... keys)
               throws GridException
Unlocks given keys only if current thread owns the locks. Only the keys that have been locked by calling thread 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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If unlock execution resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to unlock.

unlockAll

void unlockAll(@Nullable
               Collection<? extends K> keys,
               @Nullable
               GridPredicate<? super GridCacheEntry<K,V>>... filter)
               throws GridException
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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If unlock execution resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to unlock.
filter - Optional filter which needs to pass for individual entries to be unlocked.

unlockAll

void unlockAll(@Nullable
               GridPredicate<? super GridCacheEntry<K,V>>... filter)
               throws GridException
Unlock the keys supplied by the given filter only if current thread owns the locks. 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 GridCacheTxConcurrency.PESSIMISTIC concurrency control for transaction which will acquire explicit locks for relevant cache operations.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL, GridCacheFlag.READ.

Throws:
GridException - If unlock execution resulted in error.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
filter - Filter used to supply keys from cache (if null, then no key will be unlocked).

isLocked

boolean isLocked(K key)
Checks if any node owns a lock for this key.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Parameters:
key - Key to check.
Returns:
True if lock is owned by some node.

isAllLocked

boolean isAllLocked(@Nullable
                    GridPredicate<? super K>... filter)
Checks if every key provided by the filter is locked by some grid node.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Parameters:
filter - Key filter used to supply keys.
Returns:
True if all keys accepted by the given filter are locked by some nodes.

isAllLocked

boolean isAllLocked(Collection<? extends K> keys)
Checks if every key provided is locked by some grid node.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Parameters:
keys - Keys to check.
Returns:
True if all of the locks are currently locked by any of the grid nodes.

isAllLocked

boolean isAllLocked(K... keys)
Checks if every key provided is locked by some grid node.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Parameters:
keys - Keys to check.
Returns:
True if all of the locks are currently locked by any of the grid nodes.

isAllLockedByThread

boolean isAllLockedByThread(@Nullable
                            GridPredicate<? super K>... filter)
Checks if every key provided by the filter is locked by the current thread.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Parameters:
filter - Key filter used to supply keys.
Returns:
True if all keys accepted by the given filter are locked by current thread.

isAllLockedByThread

boolean isAllLockedByThread(@Nullable
                            Collection<? extends K> keys)
Checks if every key provided is locked by the current thread.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Parameters:
keys - Keys to check.
Returns:
True if every key provided is locked by the current thread.

isAllLockedByThread

boolean isAllLockedByThread(@Nullable
                            K... keys)
Checks if every key provided is locked by the current thread.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Parameters:
keys - Keys to check.
Returns:
True if every key provided is locked by the current thread.

isLockedByThread

boolean isLockedByThread(K key)
Checks if current thread owns a lock on this key.

This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.

Parameters:
key - Key to check.
Returns:
True if key is locked by current thread.

size

int size()
Gets size of this cache projection. Note that this method will have to iterate through the map entries to count all values that satisfy this projection.

If you would like to find out how many entries are there in cache altogether (including nulls), you should use GridCacheProjection.keySize() method on base GridCache which will return total size of internal hash table in constant time without iteration.

Returns:
the number of key-value mappings in this map.

keySize

int keySize()
Gets size of cache key set. This method is different from GridCacheProjection.size() method in a way that GridCacheProjection.size() method will only provide size for not-null values and has complexity of O(N), while keySize() will return the count of all cache entries and has O(1) complexity on base cache projection. It is essentially the size of cache key set and is semantically identical to {GridCache.keySet().size().

Returns:
Size of cache key set.

affinityNodes

Collection<GridRichNode> affinityNodes(K key)
Gets primary and backup nodes for the key. Node that primary node is always first in the returned collection.

Parameters:
key - Key to get affinity nodes for.
Returns:
Collection of primary and backup nodes for the key with primary node always first.

mapKeysToNodes

Map<GridRichNode,Collection<K>> mapKeysToNodes(@Nullable
                                               Collection<? extends K> keys)
This method provides ability to detect which keys are mapped to which nodes. Use it to determine which nodes are storing which keys prior to sending jobs that access these keys.

This method works as following:

Parameters:
keys - Keys to map to nodes.
Returns:
Map of node IDs to keys.

mapKeysToNodes

Map<GridRichNode,Collection<K>> mapKeysToNodes(@Nullable
                                               GridPredicate<? super K>... filter)
This method provides ability to detect which keys are mapped to which nodes. Use it to determine which nodes are storing which keys prior to sending jobs that access these keys.

This method works as following:

Parameters:
filter - Filter for keys to check.
Returns:
Map of node IDs to keys.

mapKeysToNodes

Map<GridRichNode,Collection<K>> mapKeysToNodes(@Nullable
                                               K... keys)
This method provides ability to detect which keys are mapped to which nodes. Use it to determine which nodes are storing which keys prior to sending jobs that access these keys.

This method works as following:

Parameters:
keys - Keys to map to nodes.
Returns:
Map of node IDs to keys.

mapKeyToNode

GridRichNode mapKeyToNode(K key)
This method provides ability to detect to which primary node the given key is mapped. Use it to determine which nodes are storing which keys prior to sending jobs that access these keys.

This method works as following:

Parameters:
key - Keys to map to a node.
Returns:
ID of primary node for the key.

gridProjection

GridProjection gridProjection()
Provides grid projection for all nodes participating in this cache.

Returns:
Grid projection for all cache nodes.

gridProjection

GridProjection gridProjection(@Nullable
                              Collection<? extends K> keys)
This method provides GridProjection for all nodes to which the passed in keys are mapped. It works as following:

Parameters:
keys - Keys to map to nodes.
Returns:
Grid projection for all nodes to which the passed in keys are mapped.

gridProjection

GridProjection gridProjection(@Nullable
                              K... keys)
This method provides GridProjection for all nodes to which the passed in keys are mapped. It works as following:

Parameters:
keys - Keys to map to nodes.
Returns:
Grid projection for all nodes to which the passed in keys are mapped.

gridProjection

GridProjection gridProjection(@Nullable
                              GridPredicate<? super K>... filter)
This method provides GridProjection for all nodes to which all the keys whose entries pass through the filter are mapped. It works as following:

Parameters:
filter - Filter used to supply keys.
Returns:
Grid projection for all nodes to which all keys that pass the filter are mapped.

unswap

@Nullable
V unswap(K key)
         throws GridException
This method unswaps cache entry by given key, if any, from swap storage into memory.

Transactions

This method is not transactional.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.SKIP_SWAP, GridCacheFlag.READ.

Throws:
GridException - If unswap failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
key - Key to unswap entry for.
Returns:
Unswapped entry value or null for non-existing key.

unswapAll

void unswapAll(@Nullable
               Collection<? extends K> keys)
               throws GridException
This method unswaps cache entries by given keys, if any, from swap storage into memory.

Transactions

This method is not transactional.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.SKIP_SWAP, GridCacheFlag.READ.

Throws:
GridException - If unswap failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to unswap entries for.

unswapAll

void unswapAll(@Nullable
               K... keys)
               throws GridException
This method unswaps cache entries by given keys, if any, from swap storage into memory.

Transactions

This method is not transactional.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.SKIP_SWAP, GridCacheFlag.READ.

Throws:
GridException - If unswap failed.
org.gridgain.grid.kernal.processors.cache.GridCacheFlagException - If flags validation failed.
Parameters:
keys - Keys to unswap entries for.

inTx

void inTx(GridInClosure<GridCacheProjection<K,V>>... closures)
          throws IllegalStateException,
                 GridException
Starts new transaction with default isolation, concurrency, and invalidation policy and sequentially executes given closures within it.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Parameters:
closures - Closures to execute in transaction.

inTxAsync

GridFuture<?> inTxAsync(GridInClosure<GridCacheProjection<K,V>>... closures)
                        throws GridException
Starts new transaction with default isolation, concurrency, and invalidation policy and sequentially executes given closures within it. Unlike its sibling GridCacheProjection.inTx(GridInClosure[]) this method does not block and immediately returns execution future.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
GridException - If cache failure occurred.
Parameters:
closures - Closures to execute in transaction.
Returns:
Execution future.

inTx

void inTx(long timeout,
          GridInClosure<GridCacheProjection<K,V>>... closures)
          throws IllegalStateException,
                 GridException
Starts new transaction with the specified timeout, isolation, concurrency and invalidation policy and sequentially executes given closures within it.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Parameters:
timeout - Transaction timeout.
closures - Closures to execute in transaction.

inTxAsync

GridFuture<?> inTxAsync(long timeout,
                        GridInClosure<GridCacheProjection<K,V>>... closures)
                        throws IllegalStateException,
                               GridException
Starts new transaction with the specified timeout, isolation, concurrency and invalidation policy and sequentially executes given closures within it. Unlike its sibling GridCacheProjection.inTx(long, GridInClosure[]) this method does not block and immediately returns execution future.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Parameters:
timeout - Transaction timeout.
closures - Closures to execute in transaction.
Returns:
Execution future.

inTx

void inTx(GridCacheTxConcurrency concurrency,
          GridCacheTxIsolation isolation,
          GridInClosure<GridCacheProjection<K,V>>... closures)
          throws IllegalStateException,
                 GridException
Starts transaction with specified isolation and concurrency and sequentially executes given closures within it.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
closures - Closures to execute in transaction.

inTxAsync

GridFuture<?> inTxAsync(GridCacheTxConcurrency concurrency,
                        GridCacheTxIsolation isolation,
                        GridInClosure<GridCacheProjection<K,V>>... closures)
                        throws IllegalStateException,
                               GridException
Starts transaction with specified isolation and concurrency and sequentially executes given closures within it. Unlike its sibling GridCacheProjection.inTx(GridCacheTxConcurrency, GridCacheTxIsolation, GridInClosure[]) this method does not block and immediately returns execution future.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
closures - Closures to execute in transaction.
Returns:
Execution future.

inTx

void inTx(GridCacheTxConcurrency concurrency,
          GridCacheTxIsolation isolation,
          long timeout,
          boolean invalidate,
          GridInClosure<GridCacheProjection<K,V>>... closures)
          throws IllegalStateException,
                 GridException
Starts transaction with specified isolation, concurrency, timeout, and invalidation flag and sequentially executes given closures within it.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
timeout - Timeout.
invalidate - Invalidation policy.
closures - Closures to execute in transaction.

inTxAsync

GridFuture<?> inTxAsync(GridCacheTxConcurrency concurrency,
                        GridCacheTxIsolation isolation,
                        long timeout,
                        boolean invalidate,
                        GridInClosure<GridCacheProjection<K,V>>... closures)
                        throws IllegalStateException,
                               GridException
Starts transaction with specified isolation, concurrency, timeout, and invalidation flag and sequentially executes given closures within it. Unlike its sibling GridCacheProjection.inTx(GridCacheTxConcurrency, GridCacheTxIsolation, long, boolean, GridInClosure[]) this method does not block and immediately returns execution future.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
timeout - Timeout.
invalidate - Invalidation policy.
closures - Closures to execute in transaction.
Returns:
Execution future.

inTx

<R> Collection<R> inTx(GridOutClosure<? super R>... closures)
                   throws IllegalStateException,
                          GridException
Starts transaction and sequentially executes given closures within it.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Type Parameters:
R - Type of out-closure return value.
Parameters:
closures - Closures to execute in transaction.
Returns:
Collection of execution results.

inTxAsync

<R> GridFuture<Collection<R>> inTxAsync(GridOutClosure<? super R>... closures)
                                    throws IllegalStateException,
                                           GridException
Starts transaction and sequentially executes given closures within it. Unlike its sibling GridCacheProjection.inTx(GridOutClosure[]) this method does not block and immediately returns execution future.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Type Parameters:
R - Type of out-closure return value.
Parameters:
closures - Closures to execute in transaction.
Returns:
Future of execution results.

inTx

<R> Collection<R> inTx(long timeout,
                       GridOutClosure<? super R>... closures)
                   throws IllegalStateException,
                          GridException
Starts new transaction with the specified timeout, isolation, concurrency and invalidation policy and sequentially executes given closures within it.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Type Parameters:
R - Type of out-closure return value.
Parameters:
timeout - Transaction timeout.
closures - Closures to execute in transaction.
Returns:
Collection of execution results.

inTxAsync

<R> GridFuture<Collection<R>> inTxAsync(long timeout,
                                        GridOutClosure<? super R>... closures)
                                    throws IllegalStateException,
                                           GridException
Starts new transaction with the specified timeout, isolation, concurrency and invalidation policy and sequentially executes given closures within it. Unlike its sibling GridCacheProjection.inTx(long, GridOutClosure[]) this method does not block and immediately returns execution future.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Type Parameters:
R - Type of out-closure return value.
Parameters:
timeout - Transaction timeout.
closures - Closures to execute in transaction.
Returns:
Future of execution results.

inTx

<R> Collection<R> inTx(GridCacheTxConcurrency concurrency,
                       GridCacheTxIsolation isolation,
                       GridOutClosure<? super R>... closures)
                   throws IllegalStateException,
                          GridException
Starts transaction with specified isolation and concurrency and sequentially executes given closures within it.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Type Parameters:
R - Type of out-closure return value.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
closures - Closures to execute in transaction.
Returns:
Collection of execution results.

inTxAsync

<R> GridFuture<Collection<R>> inTxAsync(GridCacheTxConcurrency concurrency,
                                        GridCacheTxIsolation isolation,
                                        GridOutClosure<? super R>... closures)
                                    throws IllegalStateException,
                                           GridException
Starts transaction with specified isolation and concurrency and sequentially executes given closures within it. Unlike its sibling GridCacheProjection.inTx(GridCacheTxConcurrency, GridCacheTxIsolation, GridOutClosure[]) this method does not block and immediately returns execution future.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Type Parameters:
R - Type of out-closure return value.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
closures - Closures to execute in transaction.
Returns:
Future of execution results.

inTx

<R> Collection<R> inTx(GridCacheTxConcurrency concurrency,
                       GridCacheTxIsolation isolation,
                       long timeout,
                       boolean invalidate,
                       GridOutClosure<? super R>... closures)
                   throws IllegalStateException,
                          GridException
Starts transaction with specified isolation, concurrency, timeout, and invalidation flag and sequentially executes given closures within it.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Type Parameters:
R - Type of out-closure return value.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
timeout - Timeout.
invalidate - Invalidation policy.
closures - Closures to execute in transaction.
Returns:
Collection of execution results.

inTxAsync

<R> GridFuture<Collection<R>> inTxAsync(GridCacheTxConcurrency concurrency,
                                        GridCacheTxIsolation isolation,
                                        long timeout,
                                        boolean invalidate,
                                        GridOutClosure<? super R>... closures)
                                    throws IllegalStateException,
                                           GridException
Starts transaction with specified isolation, concurrency, timeout, and invalidation flag and sequentially executes given closures within it. Unlike its sibling GridCacheProjection.inTx(GridCacheTxConcurrency, GridCacheTxIsolation, long, boolean, GridOutClosure[]) this method does not block and immediately returns execution future.

Cache Flags

This method is not available if any of the following flags are set on projection: GridCacheFlag.LOCAL.

Throws:
IllegalStateException - If transaction is already started by this thread.
GridException - If cache failure occurred.
Type Parameters:
R - Type of out-closure return value.
Parameters:
concurrency - Concurrency.
isolation - Isolation.
timeout - Timeout.
invalidate - Invalidation policy.
closures - Closures to execute in transaction.
Returns:
Future of execution results.

toMap

ConcurrentMap<K,V> toMap()
Converts this API into standard Java ConcurrentMap interface.

Returns:
ConcurrentMap representation of given cache.

partitions

int partitions()
Gets number of partitions in cache according to configured affinity function.

Returns:
Number of cache partitions.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

partition

int partition(K key)
Gets partition id for the given key.

Parameters:
key - Key to get partition id for.
Returns:
Partition id.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

primaryPartitions

int[] primaryPartitions(GridProjection p)
Gets partition ids for which nodes of the given projection has primary ownership.

Note that since GridRichNode implements GridProjection, to find out primary partitions for a single node just pass a single node into this method.

Parameters:
p - Grid projection.
Returns:
Partition ids for which given projection has primary ownership.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

backupPartitions

int[] backupPartitions(GridProjection p,
                       @Nullable
                       int... levels)
Gets partition ids for which nodes of the given projection has backup ownership. Note that you can find a back up at a certain level, e.g. first backup or third backup by specifying the 'levels parameter. If no 'level' is specified then all backup partitions are returned.

Note that since GridRichNode implements GridProjection, to find out backup partitions for a single node, just pass that single node into this method.

Parameters:
p - Grid projection.
levels - Optional backup levels. If they are empty then this method checks all backup levels. Level numbers starts with 0.
Returns:
Partition ids for which given projection has backup ownership.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

allPartitions

int[] allPartitions(GridProjection p)
Gets partition ids for which nodes of the given projection has ownership (either primary or backup).

Note that since GridRichNode implements GridProjection, to find out all partitions for a single node, just pass that single node into this method.

Parameters:
p - Grid projection.
Returns:
Partition ids for which given projection has ownership.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

mapPartitionToNode

GridRichNode mapPartitionToNode(int part)
Gets primary node for the given partition.

Parameters:
part - Partition id.
Returns:
Primary node for the given partition.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

mapPartitionsToNodes

Map<Integer,GridRichNode> mapPartitionsToNodes(int part,
                                               @Nullable
                                               int... parts)
Gets primary nodes for the given partitions.

Parameters:
part - Partition id.
parts - Optional additional partition ids.
Returns:
Mapping of given partitions to their primary nodes.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

mapPartitionsToNodes

Map<Integer,GridRichNode> mapPartitionsToNodes(int[] parts)
Gets primary nodes for the given partitions.

Parameters:
parts - Partition ids.
Returns:
Mapping of given partitions to their primary nodes.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

mapPartitionsToNodes

Map<Integer,GridRichNode> mapPartitionsToNodes(Collection<Integer> parts)
Gets primary nodes for the given partitions.

Parameters:
parts - Partition ids.
Returns:
Mapping of given partitions to their primary nodes.
See Also:
GridCacheAffinity, GridCacheConfiguration.getAffinity(), GridCacheConfigurationAdapter.setAffinity(GridCacheAffinity)

affinityKey

Object affinityKey(K key)
Maps passed in key to a key which will be used for node affinity.

Parameters:
key - Key to map.
Returns:
Key to be used for node-to-affinity mapping (may be the same key as passed in).

GridGain™ 3.6.0e
Enterprise Edition

GridGain - Real Time Big Data
Enterprise Edition, ver. 3.6.0e.13012012
2012 Copyright © GridGain Systems
Follow us:   Follow GridGain on Github Follow GridGain on Facebook Join GridGain User Group Follow GridGain on Twitter Follow GridGain on YouTube