Apache Ignite C++
Public Member Functions | List of all members
ignite::cache::Cache< K, V > Class Template Reference

Main entry point for all Data Grid APIs. More...

#include <cache.h>

Public Member Functions

 Cache (impl::cache::CacheImpl *impl)
 Constructor. More...
 
const char * GetName () const
 Get name of this cache (null for default cache). More...
 
bool IsEmpty ()
 Checks whether this cache contains no key-value mappings. More...
 
bool IsEmpty (IgniteError &err)
 Checks whether this cache contains no key-value mappings. More...
 
bool ContainsKey (const K &key)
 Check if cache contains mapping for this key. More...
 
bool ContainsKey (const K &key, IgniteError &err)
 Check if cache contains mapping for this key. More...
 
bool ContainsKeys (const std::set< K > &keys)
 Check if cache contains mapping for these keys. More...
 
bool ContainsKeys (const std::set< K > &keys, IgniteError &err)
 Check if cache contains mapping for these keys. More...
 
LocalPeek (const K &key, int32_t peekModes)
 Peeks at cached value using optional set of peek modes. More...
 
LocalPeek (const K &key, int32_t peekModes, IgniteError &err)
 Peeks at cached value using optional set of peek modes. More...
 
Get (const K &key)
 Retrieves value mapped to the specified key from cache. More...
 
Get (const K &key, IgniteError &err)
 Retrieves value mapped to the specified key from cache. More...
 
std::map< K, V > GetAll (const std::set< K > &keys)
 Retrieves values mapped to the specified keys from cache. More...
 
std::map< K, V > GetAll (const std::set< K > &keys, IgniteError &err)
 Retrieves values mapped to the specified keys from cache. More...
 
void Put (const K &key, const V &val)
 Associates the specified value with the specified key in the cache. More...
 
void Put (const K &key, const V &val, IgniteError &err)
 Associates the specified value with the specified key in the cache. More...
 
void PutAll (const std::map< K, V > &vals)
 Stores given key-value pairs in cache. More...
 
void PutAll (const std::map< K, V > &vals, IgniteError &err)
 Stores given key-value pairs in cache. More...
 
GetAndPut (const K &key, const V &val)
 Associates the specified value with the specified key in this cache, returning an existing value if one existed. More...
 
GetAndPut (const K &key, const V &val, IgniteError &err)
 Associates the specified value with the specified key in this cache, returning an existing value if one existed. More...
 
GetAndReplace (const K &key, const V &val)
 Atomically replaces the value for a given key if and only if there is a value currently mapped by the key. More...
 
GetAndReplace (const K &key, const V &val, IgniteError &err)
 Atomically replaces the value for a given key if and only if there is a value currently mapped by the key. More...
 
GetAndRemove (const K &key)
 Atomically removes the entry for a key only if currently mapped to some value. More...
 
GetAndRemove (const K &key, IgniteError &err)
 Atomically removes the entry for a key only if currently mapped to some value. More...
 
bool PutIfAbsent (const K &key, const V &val)
 Atomically associates the specified key with the given value if it is not already associated with a value. More...
 
bool PutIfAbsent (const K &key, const V &val, IgniteError &err)
 Atomically associates the specified key with the given value if it is not already associated with a value. More...
 
GetAndPutIfAbsent (const K &key, const V &val)
 Stores given key-value pair in cache only if cache had no previous mapping for it. More...
 
GetAndPutIfAbsent (const K &key, const V &val, IgniteError &err)
 Stores given key-value pair in cache only if cache had no previous mapping for it. More...
 
bool Replace (const K &key, const V &val)
 Stores given key-value pair in cache only if there is a previous mapping for it. More...
 
bool Replace (const K &key, const V &val, IgniteError &err)
 Stores given key-value pair in cache only if there is a previous mapping for it. More...
 
bool Replace (const K &key, const V &oldVal, const V &newVal)
 Stores given key-value pair in cache only if only if the previous value is equal to the old value passed as argument. More...
 
bool Replace (const K &key, const V &oldVal, const V &newVal, IgniteError &err)
 Stores given key-value pair in cache only if only if the previous value is equal to the old value passed as argument. More...
 
void LocalEvict (const std::set< K > &keys)
 Attempts to evict all entries associated with keys. More...
 
void LocalEvict (const std::set< K > &keys, IgniteError &err)
 Attempts to evict all entries associated with keys. More...
 
void Clear ()
 Clear cache. More...
 
void Clear (IgniteError &err)
 Clear cache. More...
 
void Clear (const K &key)
 Clear entry from the cache and swap storage, without notifying listeners or CacheWriters. More...
 
void Clear (const K &key, IgniteError &err)
 Clear entry from the cache and swap storage, without notifying listeners or CacheWriters. More...
 
void ClearAll (const std::set< K > &keys)
 Clear entries from the cache and swap storage, without notifying listeners or CacheWriters. More...
 
void ClearAll (const std::set< K > &keys, IgniteError &err)
 Clear entries from the cache and swap storage, without notifying listeners or CacheWriters. More...
 
void LocalClear (const K &key)
 Clear entry from the cache and swap storage, without notifying listeners or CacheWriters. More...
 
void LocalClear (const K &key, IgniteError &err)
 Clear entry from the cache and swap storage, without notifying listeners or CacheWriters. More...
 
void LocalClearAll (const std::set< K > &keys)
 Clear entries from the cache and swap storage, without notifying listeners or CacheWriters. More...
 
void LocalClearAll (const std::set< K > &keys, IgniteError &err)
 Clear entries from the cache and swap storage, without notifying listeners or CacheWriters. More...
 
bool Remove (const K &key)
 Removes given key mapping from cache. More...
 
bool Remove (const K &key, IgniteError &err)
 Removes given key mapping from cache. More...
 
bool Remove (const K &key, const V &val)
 Removes given key mapping from cache if one exists and value is equal to the passed in value. More...
 
bool Remove (const K &key, const V &val, IgniteError &err)
 Removes given key mapping from cache if one exists and value is equal to the passed in value. More...
 
void RemoveAll (const std::set< K > &keys)
 Removes given key mappings from cache. More...
 
void RemoveAll (const std::set< K > &keys, IgniteError &err)
 Removes given key mappings from cache. More...
 
void RemoveAll ()
 Removes all mappings from cache. More...
 
void RemoveAll (IgniteError &err)
 Removes all mappings from cache. More...
 
int32_t LocalSize ()
 Gets the number of all entries cached on this node. More...
 
int32_t LocalSize (IgniteError &err)
 Gets the number of all entries cached on this node. More...
 
int32_t LocalSize (int32_t peekModes)
 Gets the number of all entries cached on this node. More...
 
int32_t LocalSize (int32_t peekModes, IgniteError &err)
 Gets the number of all entries cached on this node. More...
 
int32_t Size ()
 Gets the number of all entries cached across all nodes. More...
 
int32_t Size (IgniteError &err)
 Gets the number of all entries cached across all nodes. More...
 
int32_t Size (int32_t peekModes)
 Gets the number of all entries cached across all nodes. More...
 
int32_t Size (int32_t peekModes, IgniteError &err)
 Gets the number of all entries cached across all nodes. More...
 
query::QueryCursor< K, V > Query (const query::SqlQuery &qry)
 Perform SQL query. More...
 
query::QueryCursor< K, V > Query (const query::SqlQuery &qry, IgniteError &err)
 Perform SQL query. More...
 
query::QueryCursor< K, V > Query (const query::TextQuery &qry)
 Perform text query. More...
 
query::QueryCursor< K, V > Query (const query::TextQuery &qry, IgniteError &err)
 Perform text query. More...
 
query::QueryCursor< K, V > Query (const query::ScanQuery &qry)
 Perform scan query. More...
 
query::QueryCursor< K, V > Query (const query::ScanQuery &qry, IgniteError &err)
 Perform scan query. More...
 
query::QueryFieldsCursor Query (const query::SqlFieldsQuery &qry)
 Perform sql fields query. More...
 
query::QueryFieldsCursor Query (const query::SqlFieldsQuery &qry, IgniteError &err)
 Perform sql fields query. More...
 
bool IsValid () const
 Check if the instance is valid. More...
 

Detailed Description

template<typename K, typename V>
class ignite::cache::Cache< K, V >

Main entry point for all Data Grid APIs.

Both key and value types should be default-constructable, copy-constructable and assignable. Also BinaryType class template should be specialized for both types.

This class implemented as a reference to an implementation so copying of this class instance will only create another reference to the same underlying object. Underlying object released automatically once all the instances are destructed.

Constructor & Destructor Documentation

template<typename K, typename V>
ignite::cache::Cache< K, V >::Cache ( impl::cache::CacheImpl *  impl)
inline

Constructor.

Internal method. Should not be used by user.

Parameters
implImplementation.

Member Function Documentation

template<typename K, typename V>
void ignite::cache::Cache< K, V >::Clear ( )
inline

Clear cache.

This method should only be used on the valid instance.

template<typename K, typename V>
void ignite::cache::Cache< K, V >::Clear ( IgniteError err)
inline

Clear cache.

This method should only be used on the valid instance.

Parameters
errError.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::Clear ( const K &  key)
inline

Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.

Entry is cleared only if it is not currently locked, and is not participating in a transaction.

This method should only be used on the valid instance.

Parameters
keyKey to clear.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::Clear ( const K &  key,
IgniteError err 
)
inline

Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.

Entry is cleared only if it is not currently locked, and is not participating in a transaction.

This method should only be used on the valid instance.

Parameters
keyKey to clear.
errError.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::ClearAll ( const std::set< K > &  keys)
inline

Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.

Entry is cleared only if it is not currently locked, and is not participating in a transaction.

This method should only be used on the valid instance.

Parameters
keysKeys to clear.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::ClearAll ( const std::set< K > &  keys,
IgniteError err 
)
inline

Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.

Entry is cleared only if it is not currently locked, and is not participating in a transaction.

This method should only be used on the valid instance.

Parameters
keysKeys to clear.
errError.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::ContainsKey ( const K &  key)
inline

Check if cache contains mapping for this key.

This method should only be used on the valid instance.

Parameters
keyKey.
Returns
True if cache contains mapping for this key.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::ContainsKey ( const K &  key,
IgniteError err 
)
inline

Check if cache contains mapping for this key.

This method should only be used on the valid instance.

Parameters
keyKey.
errError.
Returns
True if cache contains mapping for this key.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::ContainsKeys ( const std::set< K > &  keys)
inline

Check if cache contains mapping for these keys.

This method should only be used on the valid instance.

Parameters
keysKeys.
Returns
True if cache contains mapping for all these keys.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::ContainsKeys ( const std::set< K > &  keys,
IgniteError err 
)
inline

Check if cache contains mapping for these keys.

This method should only be used on the valid instance.

Parameters
keysKeys.
errError.
Returns
True if cache contains mapping for all these keys.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::Get ( const K &  key)
inline

Retrieves value mapped to the specified key from cache.

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 persistent store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey.
Returns
Value.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::Get ( const K &  key,
IgniteError err 
)
inline

Retrieves value mapped to the specified key from cache.

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 persistent store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey.
errError.
Returns
Value.
template<typename K, typename V>
std::map<K, V> ignite::cache::Cache< K, V >::GetAll ( const std::set< K > &  keys)
inline

Retrieves values mapped to the specified keys from cache.

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 persistent store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keysKeys.
Returns
Map of key-value pairs.
template<typename K, typename V>
std::map<K, V> ignite::cache::Cache< K, V >::GetAll ( const std::set< K > &  keys,
IgniteError err 
)
inline

Retrieves values mapped to the specified keys from cache.

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 persistent store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keysKeys.
errError.
Returns
Map of key-value pairs.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::GetAndPut ( const K &  key,
const V &  val 
)
inline

Associates the specified value with the specified key in this cache, returning an existing value if one existed.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is to be associated.
valValue to be associated with the specified key.
Returns
The value associated with the key at the start of the operation or null if none was associated.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::GetAndPut ( const K &  key,
const V &  val,
IgniteError err 
)
inline

Associates the specified value with the specified key in this cache, returning an existing value if one existed.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is to be associated.
valValue to be associated with the specified key.
errError.
Returns
The value associated with the key at the start of the operation or null if none was associated.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::GetAndPutIfAbsent ( const K &  key,
const V &  val 
)
inline

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

If cache previously contained value for the given key, then this value is returned. In case of PARTITIONED or 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 the returned value is not needed, method putxIfAbsent() should 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 store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey to store in cache.
valValue to be associated with the given key.
Returns
Previously contained value regardless of whether put happened or not (null if there was no previous value).
template<typename K, typename V>
V ignite::cache::Cache< K, V >::GetAndPutIfAbsent ( const K &  key,
const V &  val,
IgniteError err 
)
inline

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

If cache previously contained value for the given key, then this value is returned. In case of PARTITIONED or 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 the returned value is not needed, method putxIfAbsent() should 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 store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey to store in cache.
valValue to be associated with the given key.
errError.
Returns
Previously contained value regardless of whether put happened or not (null if there was no previous value).
template<typename K, typename V>
V ignite::cache::Cache< K, V >::GetAndRemove ( const K &  key)
inline

Atomically removes the entry for a key only if currently mapped to some value.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is associated.
Returns
The value if one existed or null if no mapping existed for this key.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::GetAndRemove ( const K &  key,
IgniteError err 
)
inline

Atomically removes the entry for a key only if currently mapped to some value.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is associated.
errError.
Returns
The value if one existed or null if no mapping existed for this key.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::GetAndReplace ( const K &  key,
const V &  val 
)
inline

Atomically replaces the value for a given key if and only if there is a value currently mapped by the key.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is to be associated.
valValue to be associated with the specified key.
Returns
The previous value associated with the specified key, or null if there was no mapping for the key.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::GetAndReplace ( const K &  key,
const V &  val,
IgniteError err 
)
inline

Atomically replaces the value for a given key if and only if there is a value currently mapped by the key.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is to be associated.
valValue to be associated with the specified key.
errError.
Returns
The previous value associated with the specified key, or null if there was no mapping for the key.
template<typename K, typename V>
const char* ignite::cache::Cache< K, V >::GetName ( ) const
inline

Get name of this cache (null for default cache).

This method should only be used on the valid instance.

Returns
Name of this cache (null for default cache).
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::IsEmpty ( )
inline

Checks whether this cache contains no key-value mappings.

Semantically equals to Cache.Size(IGNITE_PEEK_MODE_PRIMARY) == 0.

This method should only be used on the valid instance.

Returns
True if cache is empty.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::IsEmpty ( IgniteError err)
inline

Checks whether this cache contains no key-value mappings.

Semantically equals to Cache.Size(IGNITE_PEEK_MODE_PRIMARY) == 0.

This method should only be used on the valid instance.

Parameters
errError.
Returns
True if cache is empty.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::IsValid ( ) const
inline

Check if the instance is valid.

Invalid instance can be returned if some of the previous operations have resulted in a failure. For example invalid instance can be returned by not-throwing version of method in case of error. Invalid instances also often can be created using default constructor.

Returns
True if the instance is valid and can be used.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::LocalClear ( const K &  key)
inline

Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.

Entry is cleared only if it is not currently locked, and is not participating in a transaction.

Note
This operation is local as it merely clears an entry from local cache, it does not remove entries from remote caches.

This method should only be used on the valid instance.

Parameters
keyKey to clear.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::LocalClear ( const K &  key,
IgniteError err 
)
inline

Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.

Entry is cleared only if it is not currently locked, and is not participating in a transaction.

Note
This operation is local as it merely clears an entry from local cache, it does not remove entries from remote caches.

This method should only be used on the valid instance.

Parameters
keyKey to clear.
errError.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::LocalClearAll ( const std::set< K > &  keys)
inline

Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.

Entry is cleared only if it is not currently locked, and is not participating in a transaction.

Note
This operation is local as it merely clears entries from local cache, it does not remove entries from remote caches.

This method should only be used on the valid instance.

Parameters
keysKeys to clear.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::LocalClearAll ( const std::set< K > &  keys,
IgniteError err 
)
inline

Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.

Entry is cleared only if it is not currently locked, and is not participating in a transaction.

Note
This operation is local as it merely clears entries from local cache, it does not remove entries from remote caches.

This method should only be used on the valid instance.

Parameters
keysKeys to clear.
errError.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::LocalEvict ( const std::set< K > &  keys)
inline

Attempts to evict all entries associated with keys.

Note
Entry will be evicted only if it's not used (not participating in any locks or transactions).

This method should only be used on the valid instance.

Parameters
keysKeys to evict from cache.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::LocalEvict ( const std::set< K > &  keys,
IgniteError err 
)
inline

Attempts to evict all entries associated with keys.

Note
Entry will be evicted only if it's not used (not participating in any locks or transactions).

This method should only be used on the valid instance.

Parameters
keysKeys to evict from cache.
errError.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::LocalPeek ( const K &  key,
int32_t  peekModes 
)
inline

Peeks at cached value using optional set of peek modes.

This method will sequentially iterate over given peek modes, and try to peek at value using each peek mode. Once a non-null value is found, it will be immediately returned. This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

This method should only be used on the valid instance.

Parameters
keyKey.
peekModesPeek modes.
Returns
Value.
template<typename K, typename V>
V ignite::cache::Cache< K, V >::LocalPeek ( const K &  key,
int32_t  peekModes,
IgniteError err 
)
inline

Peeks at cached value using optional set of peek modes.

This method will sequentially iterate over given peek modes, and try to peek at value using each peek mode. Once a non-null value is found, it will be immediately returned. This method does not participate in any transactions, however, it may peek at transactional value depending on the peek modes used.

This method should only be used on the valid instance.

Parameters
keyKey.
peekModesPeek modes.
errError.
Returns
Value.
template<typename K, typename V>
int32_t ignite::cache::Cache< K, V >::LocalSize ( )
inline

Gets the number of all entries cached on this node.

This method should only be used on the valid instance.

Returns
Cache size on this node.
template<typename K, typename V>
int32_t ignite::cache::Cache< K, V >::LocalSize ( IgniteError err)
inline

Gets the number of all entries cached on this node.

This method should only be used on the valid instance.

Parameters
errError.
Returns
Cache size on this node.
template<typename K, typename V>
int32_t ignite::cache::Cache< K, V >::LocalSize ( int32_t  peekModes)
inline

Gets the number of all entries cached on this node.

This method should only be used on the valid instance.

Parameters
Peekmodes.
Returns
Cache size on this node.
template<typename K, typename V>
int32_t ignite::cache::Cache< K, V >::LocalSize ( int32_t  peekModes,
IgniteError err 
)
inline

Gets the number of all entries cached on this node.

This method should only be used on the valid instance.

Parameters
Peekmodes.
errError.
Returns
Cache size on this node.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::Put ( const K &  key,
const V &  val 
)
inline

Associates the specified value with the specified key in the cache.

If the cache previously contained a mapping for the key, the old value is replaced by the specified value.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is to be associated.
valValue to be associated with the specified key.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::Put ( const K &  key,
const V &  val,
IgniteError err 
)
inline

Associates the specified value with the specified key in the cache.

If the cache previously contained a mapping for the key, the old value is replaced by the specified value.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is to be associated.
valValue to be associated with the specified key.
errError.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::PutAll ( const std::map< K, V > &  vals)
inline

Stores given key-value pairs in cache.

If write-through is enabled, the stored values will be persisted to store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
valsKey-value pairs to store in cache.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::PutAll ( const std::map< K, V > &  vals,
IgniteError err 
)
inline

Stores given key-value pairs in cache.

If write-through is enabled, the stored values will be persisted to store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
valsKey-value pairs to store in cache.
errError.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::PutIfAbsent ( const K &  key,
const V &  val 
)
inline

Atomically associates the specified key with the given value if it is not already associated with a value.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is to be associated.
valValue to be associated with the specified key.
Returns
True if a value was set.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::PutIfAbsent ( const K &  key,
const V &  val,
IgniteError err 
)
inline

Atomically associates the specified key with the given value if it is not already associated with a value.

This method should only be used on the valid instance.

Parameters
keyKey with which the specified value is to be associated.
valValue to be associated with the specified key.
errError.
Returns
True if a value was set.
template<typename K, typename V>
query::QueryCursor<K, V> ignite::cache::Cache< K, V >::Query ( const query::SqlQuery qry)
inline

Perform SQL query.

This method should only be used on the valid instance.

Parameters
qryQuery.
Returns
Query cursor.
template<typename K, typename V>
query::QueryCursor<K, V> ignite::cache::Cache< K, V >::Query ( const query::SqlQuery qry,
IgniteError err 
)
inline

Perform SQL query.

This method should only be used on the valid instance.

Parameters
qryQuery.
errError.
Returns
Query cursor.
template<typename K, typename V>
query::QueryCursor<K, V> ignite::cache::Cache< K, V >::Query ( const query::TextQuery qry)
inline

Perform text query.

This method should only be used on the valid instance.

Parameters
qryQuery.
Returns
Query cursor.
template<typename K, typename V>
query::QueryCursor<K, V> ignite::cache::Cache< K, V >::Query ( const query::TextQuery qry,
IgniteError err 
)
inline

Perform text query.

This method should only be used on the valid instance.

Parameters
qryQuery.
errError.
Returns
Query cursor.
template<typename K, typename V>
query::QueryCursor<K, V> ignite::cache::Cache< K, V >::Query ( const query::ScanQuery qry)
inline

Perform scan query.

This method should only be used on the valid instance.

Parameters
qryQuery.
Returns
Query cursor.
template<typename K, typename V>
query::QueryCursor<K, V> ignite::cache::Cache< K, V >::Query ( const query::ScanQuery qry,
IgniteError err 
)
inline

Perform scan query.

This method should only be used on the valid instance.

Parameters
qryQuery.
errError.
Returns
Query cursor.
template<typename K, typename V>
query::QueryFieldsCursor ignite::cache::Cache< K, V >::Query ( const query::SqlFieldsQuery qry)
inline

Perform sql fields query.

This method should only be used on the valid instance.

Parameters
qryQuery.
Returns
Query cursor.
template<typename K, typename V>
query::QueryFieldsCursor ignite::cache::Cache< K, V >::Query ( const query::SqlFieldsQuery qry,
IgniteError err 
)
inline

Perform sql fields query.

This method should only be used on the valid instance.

Parameters
qryQuery.
errError.
Returns
Query cursor.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::Remove ( const K &  key)
inline

Removes given key mapping from cache.

If cache previously contained value for the given key, then this value is returned. In case of PARTITIONED or 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 the returned value is not needed, method removex() 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 store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey whose mapping is to be removed from cache.
Returns
False if there was no matching key.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::Remove ( const K &  key,
IgniteError err 
)
inline

Removes given key mapping from cache.

If cache previously contained value for the given key, then this value is returned. In case of PARTITIONED or 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 the returned value is not needed, method removex() 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 store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey whose mapping is to be removed from cache.
errError.
Returns
False if there was no matching key.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::Remove ( const K &  key,
const V &  val 
)
inline

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

If write-through is enabled, the value will be removed from store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey whose mapping is to be removed from cache.
valValue to match against currently cached value.
Returns
True if entry was removed, false otherwise.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::Remove ( const K &  key,
const V &  val,
IgniteError err 
)
inline

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

If write-through is enabled, the value will be removed from store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey whose mapping is to be removed from cache.
valValue to match against currently cached value.
errError.
Returns
True if entry was removed, false otherwise.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::RemoveAll ( const std::set< K > &  keys)
inline

Removes given key mappings from cache.

If write-through is enabled, the value will be removed from store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keysKeys whose mappings are to be removed from cache.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::RemoveAll ( const std::set< K > &  keys,
IgniteError err 
)
inline

Removes given key mappings from cache.

If write-through is enabled, the value will be removed from store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keysKeys whose mappings are to be removed from cache.
errError.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::RemoveAll ( )
inline

Removes all mappings from cache.

If write-through is enabled, the value will be removed from store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
errError.
template<typename K, typename V>
void ignite::cache::Cache< K, V >::RemoveAll ( IgniteError err)
inline

Removes all mappings from cache.

If write-through is enabled, the value will be removed from store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
errError.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::Replace ( const K &  key,
const V &  val 
)
inline

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

If cache previously contained value for the given key, then this value is returned. In case of PARTITIONED or 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, rom the underlying persistent storage. If write-through is enabled, the stored value will be persisted to store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey to store in cache.
valValue to be associated with the given key.
Returns
True if the value was replaced.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::Replace ( const K &  key,
const V &  val,
IgniteError err 
)
inline

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

If cache previously contained value for the given key, then this value is returned. In case of PARTITIONED or 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, rom the underlying persistent storage. If write-through is enabled, the stored value will be persisted to store. This method is transactional and will enlist the entry into ongoing transaction if there is one.

This method should only be used on the valid instance.

Parameters
keyKey to store in cache.
valValue to be associated with the given key.
errError.
Returns
True if the value was replaced.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::Replace ( const K &  key,
const V &  oldVal,
const V &  newVal 
)
inline

Stores given key-value pair in cache only if only if the previous value is equal to the old value passed as argument.

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

This method should only be used on the valid instance.

Parameters
keyKey to store in cache.
oldValOld value to match.
newValValue to be associated with the given key.
Returns
True if replace happened, false otherwise.
template<typename K, typename V>
bool ignite::cache::Cache< K, V >::Replace ( const K &  key,
const V &  oldVal,
const V &  newVal,
IgniteError err 
)
inline

Stores given key-value pair in cache only if only if the previous value is equal to the old value passed as argument.

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

This method should only be used on the valid instance.

Parameters
keyKey to store in cache.
oldValOld value to match.
newValValue to be associated with the given key.
errError.
Returns
True if replace happened, false otherwise.
template<typename K, typename V>
int32_t ignite::cache::Cache< K, V >::Size ( )
inline

Gets the number of all entries cached across all nodes.

Note
this operation is distributed and will query all participating nodes for their cache sizes.

This method should only be used on the valid instance.

Returns
Cache size across all nodes.
template<typename K, typename V>
int32_t ignite::cache::Cache< K, V >::Size ( IgniteError err)
inline

Gets the number of all entries cached across all nodes.

Note
This operation is distributed and will query all participating nodes for their cache sizes.

This method should only be used on the valid instance.

Parameters
errError.
Returns
Cache size across all nodes.
template<typename K, typename V>
int32_t ignite::cache::Cache< K, V >::Size ( int32_t  peekModes)
inline

Gets the number of all entries cached across all nodes.

Note
This operation is distributed and will query all participating nodes for their cache sizes.

This method should only be used on the valid instance.

Parameters
Peekmodes.
Returns
Cache size across all nodes.
template<typename K, typename V>
int32_t ignite::cache::Cache< K, V >::Size ( int32_t  peekModes,
IgniteError err 
)
inline

Gets the number of all entries cached across all nodes.

Note
This operation is distributed and will query all participating nodes for their cache sizes.

This method should only be used on the valid instance.

Parameters
Peekmodes.
errError.
Returns
Cache size across all nodes.

The documentation for this class was generated from the following file: