public interface CacheProjection<K,V> extends Iterable<javax.cache.Cache.Entry<K,V>>
'get(..)' methods to synchronously or asynchronously get values from cache.
All 'get(..)' methods are transactional and will participate in an ongoing transaction
if there is one.
'put(..)', 'putIfAbsent(..)', and 'replace(..)' methods to
synchronously or asynchronously put single or multiple entries into cache.
All these methods are transactional and will participate in an ongoing transaction
if there is one.
'remove(..)' methods to synchronously or asynchronously remove single or multiple keys
from cache. All 'remove(..)' methods are transactional and will participate in an ongoing transaction
if there is one.
'contains(..)' method to check if cache contains certain keys or values locally.
'forEach(..)', 'forAny(..)', and 'reduce(..)' methods to visit
every local cache entry within this projection.
flagsOn(..)', 'flagsOff(..)', and 'projection(..)' methods to
set specific flags and filters on a cache projection.
'keySet(..)', 'values(..)', and 'entrySet(..)' to provide
views on cache keys, values, and entries.
'peek(..)' methods to peek at values in global or transactional memory, swap
storage, or persistent storage.
'reload(..)' methods to reload latest values from persistent storage.
'promote(..)' methods to load specified keys from swap storage into
global cache memory.
'lock(..)', 'unlock(..)', and 'isLocked(..)' methods to acquire, release,
and check on distributed locks on a single or multiple keys in cache. All locking methods
are not transactional and will not enlist keys into ongoing transaction, if any.
'clear(..)' methods to clear elements from cache, and optionally from
swap storage. All 'clear(..)' methods are not transactional and will not enlist cleared
keys into ongoing transaction, if any.
'evict(..)' methods to evict elements from cache, and optionally store
them in underlying swap storage for later access. All 'evict(..)' methods are not
transactional and will not enlist evicted keys into ongoing transaction, if any.
'txStart(..)' methods to perform various cache
operations within a transaction (see Transaction for more information).
queries() method to get an instance of CacheQueries service for working
with distributed cache queries.
'gridProjection(..)' methods which provide ClusterGroup only
for nodes on which given keys reside. All 'gridProjection(..)' methods are not
transactional and will not enlist keys into ongoing transaction.
toMap() to convert this interface into standard Java ConcurrentMap interface.
'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.
'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 Transaction documentation for more information
about transactions.
With affinity-based-group-locking the keys are grouped by affinity-key. This means that
only keys with identical affinity-key (see CacheAffinityKeyMapped) can participate in the
transaction, and only one lock on the affinity-key will be acquired for the whole transaction.
Affinity-group-locked transactions are started via
#txStartAffinity(Object, TransactionConcurrency, TransactionIsolation, long, int) method.
With partition-based-group-locking the keys are grouped by partition ID. This means that
only keys belonging to identical partition (see CacheAffinity.partition(Object)) can participate in the
transaction, and only one lock on the whole partition will be acquired for the whole transaction.
Partition-group-locked transactions are started via
#txStartPartition(int, TransactionConcurrency, TransactionIsolation, long, int) method.
Group locking should always be used for transactions whenever possible. If your requirements fit either affinity-based or partition-based scenarios outlined above then group-locking can significantly improve performance of your application, often by an order of magnitude.
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.
Integer is used as a key for a portable object):
CacheProjectionYou won't be able to work with deserialized form if class definition for theprj = Ignition.grid().cache(null); // Value will be serialized and stored in cache in portable format. prj.put(1, new Value()); // Value will be deserialized since it's stored in portable format. Value val = prj.get(1);
Value is not on
classpath. Even if you have the class definition, you should always avoid full deserialization if it's not
needed for performance reasons. To work with portable format directly you should create special projection
using keepPortable() method:
CacheProjectionSeeprj = Ignition.grid().cache(null).keepPortable(); // Value is not deserialized and returned in portable format. GridPortableObject po = prj.get(1);
keepPortable() method JavaDoc for more details.| Modifier and Type | Method and Description |
|---|---|
<K1,V1> GridCache<K1,V1> |
cache()
Gets base cache for this projection.
|
void |
clear()
Deprecated.
Deprecated in favor of
clear(long) method. |
void |
clear(K key)
Clears key on all nodes that store it's data.
|
void |
clear(long timeout)
Clears cache on all nodes that store it's data.
|
void |
clearAll(Set<K> keys)
Clears keys on all nodes that store it's data.
|
IgniteInternalFuture<?> |
clearAsync() |
IgniteInternalFuture<?> |
clearAsync(K key) |
IgniteInternalFuture<?> |
clearAsync(Set<K> keys) |
void |
clearLocally()
Clears all entries from this cache only if the entry is not
currently locked or participating in a transaction.
|
boolean |
clearLocally(K key)
Clears an entry from this cache and swap storage only if the entry
is not currently locked, and is not participating in a transaction.
|
void |
clearLocallyAll(Set<K> keys)
Clears entries from this cache and swap storage only if the entry
is not currently locked, and is not participating in a transaction.
|
boolean |
containsKey(K key) |
IgniteInternalFuture<Boolean> |
containsKeyAsync(K key) |
boolean |
containsKeys(Collection<? extends K> keys) |
IgniteInternalFuture<Boolean> |
containsKeysAsync(Collection<? extends K> keys) |
boolean |
containsValue(V val)
Returns
true if this cache contains given value. |
javax.cache.Cache.Entry<K,V> |
entry(K key)
Gets entry from cache with the specified key.
|
Set<javax.cache.Cache.Entry<K,V>> |
entrySet()
Gets set of all entries cached on this node.
|
Set<javax.cache.Cache.Entry<K,V>> |
entrySet(int part)
Gets set containing cache entries that belong to provided partition or
null
if partition is not found locally. |
boolean |
evict(K key)
Evicts entry associated with given key from cache.
|
void |
evictAll()
Attempts to evict all cache entries.
|
void |
evictAll(Collection<? extends K> keys)
Attempts to evict all entries associated with keys.
|
Set<CacheFlag> |
flags()
Gets cache flags enabled on this projection.
|
CacheProjection<K,V> |
flagsOff(CacheFlag... flags)
Gets cache projection base on this but with the specified flags turned off.
|
CacheProjection<K,V> |
flagsOn(CacheFlag... flags)
Gets cache projection base on this one, but with the specified flags turned on.
|
V |
get(K key)
Retrieves value mapped to the specified key from cache.
|
Map<K,V> |
getAll(Collection<? extends K> keys)
Retrieves values mapped to the specified keys from cache.
|
IgniteInternalFuture<Map<K,V>> |
getAllAsync(Collection<? extends K> keys)
Asynchronously retrieves values mapped to the specified keys from cache.
|
IgniteInternalFuture<V> |
getAsync(K key)
Asynchronously retrieves value mapped to the specified key from cache.
|
int |
globalPrimarySize()
Gets the number of all primary entries cached across all nodes (excluding backups).
|
int |
globalSize()
Gets the number of all entries cached across all nodes.
|
ClusterGroup |
gridProjection()
Gets grid projection for this cache.
|
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.
|
<K1,V1> CacheProjection<K1,V1> |
keepPortable()
Creates projection that will operate with portable objects.
|
Set<K> |
keySet()
Set of keys cached on this node.
|
Set<K> |
keySet(CacheEntryPredicate... filter)
Set of keys cached on this node.
|
Iterable<javax.cache.Cache.Entry<K,V>> |
localEntries(CachePeekMode[] peekModes) |
V |
localPeek(K key,
CachePeekMode[] peekModes,
IgniteCacheExpiryPolicy plc) |
void |
localRemoveAll() |
int |
localSize(CachePeekMode[] peekModes) |
boolean |
lock(K key,
long timeout,
CacheEntryPredicate... filter)
Synchronously acquires lock on a cached object with given
key only if the passed in filter (if any) passes.
|
boolean |
lockAll(Collection<? extends K> keys,
long timeout,
CacheEntryPredicate... filter)
All or nothing synchronous lock for passed in keys.
|
IgniteInternalFuture<Boolean> |
lockAllAsync(Collection<? extends K> keys,
long timeout,
CacheEntryPredicate... filter)
All or nothing synchronous lock for passed in keys.
|
IgniteInternalFuture<Boolean> |
lockAsync(K key,
long timeout,
CacheEntryPredicate... filter)
Asynchronously acquires lock on a cached object with given
key only if the passed in filter (if any) passes.
|
String |
name()
Gets name of this cache (
null for default cache). |
int |
nearSize()
Gets size of near cache key set.
|
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.
|
Set<javax.cache.Cache.Entry<K,V>> |
primaryEntrySet()
Gets set of cache entries for which this node is primary.
|
Set<K> |
primaryKeySet()
Set of keys for which this node is primary.
|
int |
primarySize()
Gets the number of all primary entries cached on this node.
|
Collection<V> |
primaryValues()
Collection of cached values for which this node is primary.
|
CacheProjection<K,V> |
projection(CacheEntryPredicate filter)
Gets cache projection based on given entry filter.
|
<K1,V1> CacheProjection<K1,V1> |
projection(Class<? super K1> keyType,
Class<? super V1> valType)
Gets cache projection only for given key and value type.
|
V |
promote(K key)
This method promotes cache entry by given key, if any, from offheap or swap storage
into memory.
|
void |
promoteAll(Collection<? extends K> keys)
This method unswaps cache entries by given keys, if any, from swap storage
into memory.
|
V |
put(K key,
V val,
CacheEntryPredicate... filter)
Stores given key-value pair in cache.
|
void |
putAll(Map<? extends K,? extends V> m,
CacheEntryPredicate... filter)
Stores given key-value pairs in cache.
|
IgniteInternalFuture<?> |
putAllAsync(Map<? extends K,? extends V> m,
CacheEntryPredicate... filter)
Asynchronously stores given key-value pairs in cache.
|
IgniteInternalFuture<V> |
putAsync(K key,
V val,
CacheEntryPredicate... 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.
|
IgniteInternalFuture<V> |
putIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
boolean |
putx(K key,
V val,
CacheEntryPredicate... filter)
Stores given key-value pair in cache.
|
IgniteInternalFuture<Boolean> |
putxAsync(K key,
V val,
CacheEntryPredicate... 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.
|
IgniteInternalFuture<Boolean> |
putxIfAbsentAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if cache had no previous mapping for it.
|
CacheQueries<K,V> |
queries()
Returns queries facade responsible for creating various SQL, TEXT, or SCAN queries.
|
V |
reload(K key)
Reloads a single key from persistent storage.
|
IgniteInternalFuture<V> |
reloadAsync(K key)
Asynchronously reloads a single key from persistent storage.
|
V |
remove(K key,
CacheEntryPredicate... filter)
Removes given key mapping from cache.
|
boolean |
remove(K key,
V val)
Removes given key mapping from cache if one exists and value is equal to the passed in value.
|
void |
removeAll()
Removes mappings from cache for entries for which the optionally passed in filters do
pass.
|
void |
removeAll(Collection<? extends K> keys,
CacheEntryPredicate... filter)
Removes given key mappings from cache for entries for which the optionally passed in filters do
pass.
|
IgniteInternalFuture<?> |
removeAllAsync() |
IgniteInternalFuture<?> |
removeAllAsync(Collection<? extends K> keys,
CacheEntryPredicate... filter)
Asynchronously removes given key mappings from cache for entries for which the optionally
passed in filters do pass.
|
IgniteInternalFuture<V> |
removeAsync(K key,
CacheEntryPredicate... filter)
Asynchronously removes given key mapping from cache.
|
IgniteInternalFuture<Boolean> |
removeAsync(K key,
V val)
Asynchronously removes given key mapping from cache if one exists and value is equal to the passed in value.
|
boolean |
removex(K key,
CacheEntryPredicate... filter)
Removes given key mapping from cache.
|
IgniteInternalFuture<Boolean> |
removexAsync(K key,
CacheEntryPredicate... filter)
Asynchronously removes given key mapping from cache.
|
V |
replace(K key,
V val)
Stores given key-value pair in cache only if there is a previous mapping for it.
|
boolean |
replace(K key,
V oldVal,
V newVal)
Stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
IgniteInternalFuture<V> |
replaceAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if there is a previous mapping for it.
|
IgniteInternalFuture<Boolean> |
replaceAsync(K key,
V oldVal,
V newVal)
Asynchronously stores given key-value pair in cache only if only if the previous value is equal to the
'oldVal' passed in. |
boolean |
replacex(K key,
V val)
Stores given key-value pair in cache only if only if there is a previous mapping for it.
|
IgniteInternalFuture<Boolean> |
replacexAsync(K key,
V val)
Asynchronously stores given key-value pair in cache only if only if there is a previous mapping for it.
|
int |
size()
Gets the number of all entries cached on this node.
|
int |
size(CachePeekMode[] peekModes) |
IgniteInternalFuture<Integer> |
sizeAsync(CachePeekMode[] peekModes) |
ConcurrentMap<K,V> |
toMap()
Converts this API into standard Java
ConcurrentMap interface. |
Transaction |
tx()
Gets transaction started by this thread or
null if this thread does
not have a transaction. |
Transaction |
txStart()
Starts transaction with default isolation, concurrency, timeout, and invalidation policy.
|
Transaction |
txStart(TransactionConcurrency concurrency,
TransactionIsolation isolation)
Starts new transaction with the specified concurrency and isolation.
|
Transaction |
txStart(TransactionConcurrency concurrency,
TransactionIsolation isolation,
long timeout,
int txSize)
Starts transaction with specified isolation, concurrency, timeout, invalidation flag,
and number of participating entries.
|
IgniteInternalTx |
txStartEx(TransactionConcurrency concurrency,
TransactionIsolation isolation) |
void |
unlock(K key,
CacheEntryPredicate... filter)
Unlocks given key only if current thread owns the lock.
|
void |
unlockAll(Collection<? extends K> keys,
CacheEntryPredicate... filter)
Unlocks given keys only if current thread owns the locks.
|
Collection<V> |
values()
Collection of values cached on this node.
|
String name()
null for default cache).ClusterGroup gridProjection()
<K1,V1> GridCache<K1,V1> cache()
K1 - Cache key type.V1 - Cache value type.Set<CacheFlag> flags()
CacheQueries<K,V> queries()
<K1,V1> CacheProjection<K1,V1> projection(Class<? super K1> keyType, Class<? super V1> valType)
non-null key-value
pairs that have matching key and value pairs will be used in this projection.K1 - Key type.V1 - Value type.keyType - Key type.valType - Value type.CacheProjection<K,V> projection(@Nullable CacheEntryPredicate filter)
#projection(org.apache.ignite.lang.IgniteBiPredicate)
method, this filter will not be used for pre-filtering.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'.CacheProjection<K,V> flagsOn(@Nullable CacheFlag... flags)
flags - Flags to turn on (if empty, then no-op).CacheProjection<K,V> flagsOff(@Nullable CacheFlag... flags)
flags - Flags to turn off (if empty, then all flags will be turned off).<K1,V1> CacheProjection<K1,V1> keepPortable()
Projection returned by this method will force cache not to deserialize portable objects, so keys and values will be returned from cache API methods without changes. Therefore, signature of the projection can contain only following types:
org.gridgain.grid.portables.PortableObject for portable classesString and array of StringsUUID and array of UUIDsDate and array of DatesTimestamp and array of Timestamps
For example, if you use Integer as a key and Value class as a value
(which will be stored in portable format), you should acquire following projection
to avoid deserialization:
CacheProjectionprj = cache.keepPortable(); // Value is not deserialized and returned in portable format. GridPortableObject po = prj.get(1);
Note that this method makes sense only if cache is working in portable mode
(org.apache.ignite.configuration.CacheConfiguration#isPortableEnabled() returns true. If not,
this method is no-op and will return current projection.
boolean isEmpty()
true if this map contains no key-value mappings.true if this map contains no key-value mappings.ConcurrentMap<K,V> toMap()
ConcurrentMap interface.ConcurrentMap representation of given cache projection.boolean containsKey(K key)
key - Key.True if cache contains mapping for a given key.IgniteInternalFuture<Boolean> containsKeyAsync(K key)
key - Key.boolean containsKeys(Collection<? extends K> keys)
keys - Keys,True if cache contains all keys.IgniteInternalFuture<Boolean> containsKeysAsync(Collection<? extends K> keys)
keys - Keys to check.boolean containsValue(V val)
true if this cache contains given value.val - Value to check.True if given value is present in cache.NullPointerException - if the value is null.@Nullable V reload(K key) throws IgniteCheckedException
CacheStore#load(Transaction, Object)
method.
key - Key to reload.IgniteCheckedException - If reloading failed.IgniteInternalFuture<V> reloadAsync(K key)
CacheStore#load(Transaction, Object)
method.
key - Key to reload.@Nullable V peek(K key)
GridCachePeekMode.SMART
peek mode.
This method will not load value from any persistent store or from a remote node.
GridCachePeekMode.SMART mode
semantics. If you need to look at global cached value even from within transaction,
you can use peek(Object, Collection) method.key - Entry key.NullPointerException - If key is null.@Nullable V localPeek(K key, CachePeekMode[] peekModes, @Nullable IgniteCacheExpiryPolicy plc) throws IgniteCheckedException
key - Key.peekModes - Peek modes.plc - Expiry policy if TTL should be updated.IgniteCheckedException - If failed.Iterable<javax.cache.Cache.Entry<K,V>> localEntries(CachePeekMode[] peekModes) throws IgniteCheckedException
peekModes - Peek modes.IgniteCheckedException - If failed.@Nullable V peek(K key, @Nullable Collection<GridCachePeekMode> modes) throws IgniteCheckedException
non-null value is found, it will be immediately returned.
Note that if modes are not provided this method works exactly the same way as
peek(Object), implicitly using GridCachePeekMode.SMART mode.
key - Entry key.modes - Optional set of peek modes.IgniteCheckedException - If peek operation failed.NullPointerException - If key is null.@Nullable V get(K key) throws IgniteCheckedException
null
means entry did not pass the provided filter or cache has no mapping for the
key.
If the value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disable, and if read-through is allowed, value
will be loaded from CacheStore persistent storage via
CacheStore#load(Transaction, Object) method.
CacheFlag.LOCAL flag is set on projection.key - Key to retrieve the value for.IgniteCheckedException - If get operation failed.CacheFlagException - If failed projection flags validation.NullPointerException - if the key is null.IgniteInternalFuture<V> getAsync(K key)
null
means entry did not pass the provided filter or cache has no mapping for the
key.
If the value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore persistent storage via
CacheStore#load(Transaction, Object) method.
CacheFlag.LOCAL flag is set on projection.key - Key for the value to get.NullPointerException - if the key is null.CacheFlagException - If projection flags validation failed.Map<K,V> getAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException
If some value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore persistent storage via
CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method.
CacheFlag.LOCAL flag is set on projection.keys - Keys to get.IgniteCheckedException - If get operation failed.CacheFlagException - If failed projection flags validation.IgniteInternalFuture<Map<K,V>> getAllAsync(@Nullable Collection<? extends K> keys)
If some value is not present in cache, then it will be looked up from swap storage. If
it's not present in swap, or if swap is disabled, and if read-through is allowed, value
will be loaded from CacheStore persistent storage via
CacheStore#loadAll(Transaction, Collection, org.apache.ignite.lang.IgniteBiInClosure) method.
CacheFlag.LOCAL flag is set on projection.keys - Key for the value to get.CacheFlagException - If projection flags validation failed.@Nullable V put(K key, V val, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
CacheMode.PARTITIONED or CacheMode.REPLICATED caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) should
always be used instead of this one to avoid the overhead associated with returning of the previous value.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.filter - Optional filter to check prior to putting value in cache. Note
that filter check is atomic with put operation.null
if entry did not pass the filter, or if there was no mapping for the key in swap
or in persistent storage.NullPointerException - If either key or value are null.IgniteCheckedException - If put operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<V> putAsync(K key, V val, @Nullable CacheEntryPredicate... filter)
CacheMode.REPLICATED caches, the value will be loaded from swap
and, if it's not there, and read-through is allowed, from the underlying
CacheStore storage. In case of CacheMode.PARTITIONED caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap and read-through is allowed,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method #putx(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) should
always be used instead of this one to avoid the overhead associated with returning of the previous value.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.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.NullPointerException - If either key or value are null.CacheFlagException - If projection flags validation failed.boolean putx(K key, V val, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
This method will return true if value is stored in cache and false otherwise.
Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous
value and, therefore, does not have any overhead associated with returning a value. It
should be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.filter - Optional filter to check prior to putting value in cache. Note
that filter check is atomic with put operation.True if optional filter passed and value was stored in cache,
false otherwise. Note that this method will return true if filter is not
specified.NullPointerException - If either key or value are null.IgniteCheckedException - If put operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<Boolean> putxAsync(K key, V val, @Nullable CacheEntryPredicate... filter)
This method will return true if value is stored in cache and false otherwise.
Unlike #put(Object, Object, org.apache.ignite.lang.IgnitePredicate[]) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.filter - Optional filter to check prior to putting value in cache. Note
that filter check is atomic with put operation.true if optional filter
passed and value was stored in cache, false otherwise. Note that future will
return true if filter is not specified.NullPointerException - If either key or value are null.CacheFlagException - If projection flags validation failed.@Nullable V putIfAbsent(K key, V val) throws IgniteCheckedException
CacheMode.PARTITIONED or CacheMode.REPLICATED caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method putxIfAbsent(Object, Object) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.NullPointerException - If either key or value are null.IgniteCheckedException - If put operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<V> putIfAbsentAsync(K key, V val)
CacheMode.PARTITIONED or CacheMode.REPLICATED caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method putxIfAbsentAsync(Object, Object) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.NullPointerException - If either key or value are null.CacheFlagException - If projection flags validation failed.boolean putxIfAbsent(K key, V val) throws IgniteCheckedException
This method will return true if value is stored in cache and false otherwise.
Unlike putIfAbsent(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.true if value is stored in cache and false otherwise.NullPointerException - If either key or value are null.IgniteCheckedException - If put operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<Boolean> putxIfAbsentAsync(K key, V val)
This method will return true if value is stored in cache and false otherwise.
Unlike putIfAbsent(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.NullPointerException - If either key or value are null.CacheFlagException - If projection flags validation failed.@Nullable V replace(K key, V val) throws IgniteCheckedException
CacheMode.PARTITIONED or CacheMode.REPLICATED caches,
the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method replacex(Object, Object) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.NullPointerException - If either key or value are null.IgniteCheckedException - If replace operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<V> replaceAsync(K key, V val)
CacheMode.PARTITIONED caches, the value will be loaded from the primary node,
which in its turn may load the value from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method replacex(Object, Object) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.NullPointerException - If either key or value are null.CacheFlagException - If projection flags validation failed.boolean replacex(K key, V val) throws IgniteCheckedException
This method will return true if value is stored in cache and false otherwise.
Unlike replace(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.True if replace happened, false otherwise.NullPointerException - If either key or value are null.IgniteCheckedException - If replace operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<Boolean> replacexAsync(K key, V val)
This method will return true if value is stored in cache and false otherwise.
Unlike replaceAsync(Object, Object) method, it does not return previous
value and, therefore, does not have any overhead associated with returning of a value. It
should always be used whenever return value is not required.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.val - Value to be associated with the given key.NullPointerException - If either key or value are null.CacheFlagException - If projection flags validation failed.boolean replace(K key, V oldVal, V newVal) throws IgniteCheckedException
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.True if replace happened, false otherwise.NullPointerException - If either key or value are null.IgniteCheckedException - If replace operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<Boolean> replaceAsync(K key, V oldVal, V newVal)
'oldVal' passed in.
This method will return true if value is stored in cache and false otherwise.
If write-through is enabled, the stored value will be persisted to CacheStore
via CacheStore#put(Transaction, Object, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to store in cache.oldVal - Old value to match.newVal - Value to be associated with the given key.NullPointerException - If either key or value are null.CacheFlagException - If projection flags validation failed.void putAll(@Nullable Map<? extends K,? extends V> m, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
If write-through is enabled, the stored values will be persisted to CacheStore
via CacheStore#putAll(Transaction, Map) method.
CacheFlag.LOCAL, CacheFlag.READ.m - Key-value pairs to store in cache.filter - Optional entry filter. If provided, then entry will
be stored only if the filter returned true.IgniteCheckedException - If put operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<?> putAllAsync(@Nullable Map<? extends K,? extends V> m, @Nullable CacheEntryPredicate... filter)
If write-through is enabled, the stored values will be persisted to CacheStore
via CacheStore#putAll(Transaction, Map) method.
CacheFlag.LOCAL, CacheFlag.READ.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.CacheFlagException - If projection flags validation failed.Set<K> keySet()
Iterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the keys cached on this node.
Set<K> keySet(@Nullable CacheEntryPredicate... filter)
Iterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the keys cached on this node.
filter - Optional filter to check prior to getting key form cache. Note
that filter is checked atomically together with get operation.Set<K> primaryKeySet()
null because they were invalidated. You can remove elements from
this set, but you cannot add elements to this set. All removal operation will be
reflected on the cache itself.
Iterator over this set will not fail if set was concurrently updated by another thread. This means that iterator may or may not return latest keys depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the keys cached on this node.
Collection<V> values()
Iterator over this collection will not fail if collection was concurrently updated by another thread. This means that iterator may or may not return latest values depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the values cached on this node.
Collection<V> primaryValues()
null
because they were invalided. You can remove elements from this collection,
but you cannot add elements to this collection. All removal operation will be
reflected on the cache itself.
Iterator over this collection will not fail if collection was concurrently updated by another thread. This means that iterator may or may not return latest values depending on whether they were added before or after current iterator position.
NOTE: this operation is not distributed and returns only the values cached on this node.
Set<javax.cache.Cache.Entry<K,V>> entrySet()
NOTE: this operation is not distributed and returns only the entries cached on this node.
@Nullable Set<javax.cache.Cache.Entry<K,V>> entrySet(int part)
null
if partition is not found locally.
NOTE: this operation is not distributed and returns only the entries cached on this node.
part - Partition.null if partition is
not found locally.Set<javax.cache.Cache.Entry<K,V>> primaryEntrySet()
NOTE: this operation is not distributed and returns only the entries cached on this node.
Transaction txStart() throws IllegalStateException
CacheConfiguration at startup.IllegalStateException - If transaction is already started by this thread.UnsupportedOperationException - If cache is CacheAtomicityMode.ATOMIC.Transaction txStart(TransactionConcurrency concurrency, TransactionIsolation isolation)
concurrency - Concurrency.isolation - Isolation.IllegalStateException - If transaction is already started by this thread.UnsupportedOperationException - If cache is CacheAtomicityMode.ATOMIC.IgniteInternalTx txStartEx(TransactionConcurrency concurrency, TransactionIsolation isolation)
concurrency - Concurrency.isolation - Isolation.Transaction txStart(TransactionConcurrency concurrency, TransactionIsolation isolation, long timeout, int txSize)
concurrency - Concurrency.isolation - Isolation.timeout - Timeout.txSize - Number of entries participating in transaction (may be approximate).IllegalStateException - If transaction is already started by this thread.UnsupportedOperationException - If cache is CacheAtomicityMode.ATOMIC.@Nullable Transaction tx()
null if this thread does
not have a transaction.null if this thread
does not have a transaction.@Nullable javax.cache.Cache.Entry<K,V> entry(K key)
Note that this method can return null if projection is configured as
pre-filtered and entry key and value don't pass key-value filter of the projection.
key - Entry key.null if projection pre-filtering was not passed.boolean evict(K key)
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entry will
be swapped to offheap, and then to disk.
CacheFlag.READ.key - Key to evict from cache.True if entry could be evicted, false otherwise.void evictAll()
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entry will
be swapped to offheap, and then to disk.
CacheFlag.READ.void evictAll(@Nullable Collection<? extends K> keys)
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entry will
be swapped to offheap, and then to disk.
CacheFlag.READ.keys - Keys to evict.void clearLocally()
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entries will
also be cleared from swap.
Note that this operation is local as it merely clears entries from local cache. It does not remove entries from remote caches or from underlying persistent storage.
CacheFlag.READ.boolean clearLocally(K key)
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entries will
also be cleared from swap.
Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.
CacheFlag.READ.key - Key to clearLocally.True if entry was successfully cleared from cache, false
if entry was in use at the time of this method invocation and could not be
cleared.void clearLocallyAll(Set<K> keys)
If CacheConfiguration.isSwapEnabled() is set to true and
CacheFlag.SKIP_SWAP is not enabled, the evicted entries will
also be cleared from swap.
Note that this operation is local as it merely clears an entry from local cache. It does not remove entries from remote caches or from underlying persistent storage.
CacheFlag.READ.keys - Keys to clearLocally.void clear(K key) throws IgniteCheckedException
clearLocally(Object) method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
key - Key to clear.IgniteCheckedException - In case of cache could not be cleared on any of the nodes.void clearAll(Set<K> keys) throws IgniteCheckedException
clearLocallyAll(Set) method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
keys - Keys to clear.IgniteCheckedException - In case of cache could not be cleared on any of the nodes.void clear()
throws IgniteCheckedException
clear(long) method.clearLocally() method which only
clears local node's cache.
Ignite will make the best attempt to clear caches on all nodes. If some caches could not be cleared, then exception will be thrown.
This method is identical to calling clear(0).
IgniteCheckedException - In case of cache could not be cleared on any of the nodes.IgniteInternalFuture<?> clearAsync()
IgniteInternalFuture<?> clearAsync(K key)
key - Key to clear.IgniteInternalFuture<?> clearAsync(Set<K> keys)
keys - Keys to clear.void clear(long timeout)
throws IgniteCheckedException
clearLocally() method which only
clears local node's cache.
Ignite will make the best attempt to clearLocally caches on all nodes. If some caches could not be cleared, then exception will be thrown.
timeout - Timeout for clearLocally all task in milliseconds (0 for never).
Set it to larger value for large caches.IgniteCheckedException - In case of cache could not be cleared on any of the nodes.@Nullable V remove(K key, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
CacheMode.PARTITIONED or CacheMode.REPLICATED
caches, the value will be loaded from the primary node, which in its turn may load the value
from the disk-based swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[]) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key whose mapping is to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.null
if there was no value for this key.NullPointerException - If key is null.IgniteCheckedException - If remove operation failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<V> removeAsync(K key, CacheEntryPredicate... filter)
CacheMode.PARTITIONED or CacheMode.REPLICATED
caches, the value will be loaded from the primary node, which in its turn may load the value
from the swap storage, and consecutively, if it's not in swap,
from the underlying persistent storage. If value has to be loaded from persistent
storage, CacheStore#load(Transaction, Object) method will be used.
If the returned value is not needed, method #removex(Object, org.apache.ignite.lang.IgnitePredicate[]) should
always be used instead of this one to avoid the overhead associated with returning of the
previous value.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.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.NullPointerException - if the key is null.CacheFlagException - If projection flags validation failed.boolean removex(K key, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key whose mapping is to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.True if filter passed validation and entry was removed, false otherwise.
Note that if filter is not specified, this method will return true.NullPointerException - if the key is null.IgniteCheckedException - If remove failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<Boolean> removexAsync(K key, @Nullable CacheEntryPredicate... filter)
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key whose mapping is to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.true
if optional filters passed validation and remove did occur, false otherwise.
Note that if filter is not specified, this method will return true.NullPointerException - if the key is null.CacheFlagException - If projection flags validation failed.boolean remove(K key, V val) throws IgniteCheckedException
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.True if entry was removed and passed in value matched the cached one,
false otherwise.NullPointerException - if the key or value is null.IgniteCheckedException - If remove failed.CacheFlagException - If projection flags validation failed.IgniteInternalFuture<Boolean> removeAsync(K key, V val)
This method will return true if remove did occur, which means that all optionally
provided filters have passed and there was something to remove, false otherwise.
If write-through is enabled, the value will be removed from CacheStore
via CacheStore#remove(Transaction, Object) method.
CacheFlag.LOCAL, CacheFlag.READ.key - Key whose mapping is to be removed from cache.val - Value to match against currently cached value.true
if currently cached value will match the passed in one.NullPointerException - if the key or value is null.CacheFlagException - If projection flags validation failed.void removeAll(@Nullable Collection<? extends K> keys, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
If write-through is enabled, the values will be removed from CacheStore
via CacheStore#removeAll(Transaction, Collection) method.
CacheFlag.LOCAL, CacheFlag.READ.keys - Keys whose mappings are to be removed from cache.filter - Optional filter to check prior to removing value form cache. Note
that filter is checked atomically together with remove operation.IgniteCheckedException - If remove failed.CacheFlagException - If flags validation failed.IgniteInternalFuture<?> removeAllAsync(@Nullable Collection<? extends K> keys, @Nullable CacheEntryPredicate... filter)
If write-through is enabled, the values will be removed from CacheStore
via CacheStore#removeAll(Transaction, Collection) method.
CacheFlag.LOCAL, CacheFlag.READ.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.CacheFlagException - If flags validation failed.void removeAll()
throws IgniteCheckedException
null, then all entries in cache will be enrolled
into transaction.
USE WITH CARE - if your cache has many entries that pass through the filter or if filter is empty, then transaction will quickly become very heavy and slow. Also, locks are acquired in undefined order, so it may cause a deadlock when used with other concurrent transactional updates.
If write-through is enabled, the values will be removed from CacheStore
via CacheStore#removeAll(Transaction, Collection) method.
CacheFlag.LOCAL, CacheFlag.READ.IgniteCheckedException - If remove failed.CacheFlagException - If flags validation failed.IgniteInternalFuture<?> removeAllAsync()
void localRemoveAll()
throws IgniteCheckedException
IgniteCheckedException - If failed.boolean lock(K key, long timeout, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to lock.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration), -1 for immediate failure if
lock cannot be acquired immediately).filter - Optional filter to validate prior to acquiring the lock.True if all filters passed and lock was acquired,
false otherwise.IgniteCheckedException - If lock acquisition resulted in error.CacheFlagException - If flags validation failed.IgniteInternalFuture<Boolean> lockAsync(K key, long timeout, @Nullable CacheEntryPredicate... filter)
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to lock.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration, -1 for immediate failure if
lock cannot be acquired immediately).filter - Optional filter to validate prior to acquiring the lock.true
whenever all filters pass and locks are acquired before timeout is expired,
false otherwise.CacheFlagException - If flags validation failed.boolean lockAll(@Nullable Collection<? extends K> keys, long timeout, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.keys - Keys to lock.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration).filter - Optional filter that needs to atomically pass in order for the locks
to be acquired.True if all filters passed and locks were acquired before
timeout has expired, false otherwise.IgniteCheckedException - If lock acquisition resulted in error.CacheFlagException - If flags validation failed.IgniteInternalFuture<Boolean> lockAllAsync(@Nullable Collection<? extends K> keys, long timeout, @Nullable CacheEntryPredicate... filter)
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.keys - Keys to lock.timeout - Timeout in milliseconds to wait for lock to be acquired
('0' for no expiration).filter - Optional filter that needs to atomically pass in order for the locks
to be acquired.true if all filters passed and locks were acquired before
timeout has expired, false otherwise.CacheFlagException - If flags validation failed.void unlock(K key, CacheEntryPredicate... filter) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.key - Key to unlock.filter - Optional filter that needs to pass prior to unlock taking effect.IgniteCheckedException - If unlock execution resulted in error.CacheFlagException - If flags validation failed.void unlockAll(@Nullable Collection<? extends K> keys, @Nullable CacheEntryPredicate... filter) throws IgniteCheckedException
TransactionConcurrency.PESSIMISTIC concurrency control for transaction
which will acquire explicit locks for relevant cache operations.
CacheFlag.LOCAL, CacheFlag.READ.keys - Keys to unlock.filter - Optional filter which needs to pass for individual entries
to be unlocked.IgniteCheckedException - If unlock execution resulted in error.CacheFlagException - If flags validation failed.boolean isLocked(K key)
This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
key - Key to check.True if lock is owned by some node.boolean isLockedByThread(K key)
This is a local in-VM operation and does not involve any network trips or access to persistent storage in any way.
key - Key to check.True if key is locked by current thread.int size()
GridCache projection. It is essentially the
size of cache key set and is semantically identical to {Cache.keySet().size().
NOTE: this operation is not distributed and returns only the number of entries cached on this node.
int localSize(CachePeekMode[] peekModes) throws IgniteCheckedException
peekModes - Peek modes.IgniteCheckedException - If failed.int size(CachePeekMode[] peekModes) throws IgniteCheckedException
peekModes - Peek modes.IgniteCheckedException - If failed.IgniteInternalFuture<Integer> sizeAsync(CachePeekMode[] peekModes)
peekModes - Peek modes.int globalSize()
throws IgniteCheckedException
NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
IgniteCheckedExceptionint nearSize()
Note that for LOCAL non-distributed caches this method will always return 0
0 if cache is not CacheMode.PARTITIONED.int primarySize()
CacheMode.LOCAL non-distributed
cache mode, this method is identical to size().
For CacheMode.PARTITIONED and CacheMode.REPLICATED modes, this method will
return number of primary entries cached on this node (excluding any backups). The complexity of
this method is O(P), where P is the total number of partitions.
NOTE: this operation is not distributed and returns only the number of primary entries cached on this node.
int globalPrimarySize()
throws IgniteCheckedException
NOTE: this operation is distributed and will query all participating nodes for their primary cache sizes.
IgniteCheckedException@Nullable V promote(K key) throws IgniteCheckedException
CacheFlag.SKIP_SWAP, CacheFlag.READ.key - Key to promote entry for.null for non-existing key.IgniteCheckedException - If promote failed.CacheFlagException - If flags validation failed.void promoteAll(@Nullable Collection<? extends K> keys) throws IgniteCheckedException
CacheFlag.SKIP_SWAP, CacheFlag.READ.keys - Keys to promote entries for.IgniteCheckedException - If promote failed.CacheFlagException - If flags validation failed.
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0-RC3 Release Date : March 24 2015