 |
Apache Ignite C++
|
Go to the documentation of this file.
23 #ifndef _IGNITE_THIN_CACHE_CACHE_CLIENT
24 #define _IGNITE_THIN_CACHE_CACHE_CLIENT
26 #include <ignite/common/concurrent.h>
31 #include <ignite/impl/thin/writable.h>
32 #include <ignite/impl/thin/writable_key.h>
34 #include <ignite/impl/thin/readable.h>
35 #include <ignite/impl/thin/cache/cache_client_proxy.h>
58 template<
typename K,
typename V>
61 friend class impl::thin::cache::CacheClientProxy;
105 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
106 impl::thin::WritableImpl<ValueType> wrValue(value);
108 proxy.Put(wrKey, wrValue);
118 template<
typename InIter>
121 impl::thin::WritableMapImpl<K, V, InIter> wrSeq(begin, end);
132 template<
typename Map>
135 PutAll(vals.begin(), vals.end());
146 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
147 impl::thin::ReadableImpl<ValueType> rdValue(value);
149 proxy.Get(wrKey, rdValue);
177 template<
typename InIter,
typename OutIter>
178 void GetAll(InIter begin, InIter end, OutIter dst)
180 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
181 impl::thin::ReadableMapImpl<K, V, OutIter> rdSeq(dst);
183 proxy.GetAll(wrSeq, rdSeq);
195 template<
typename Set,
typename Map>
198 return GetAll(keys.begin(), keys.end(), std::inserter(res, res.end()));
215 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
216 impl::thin::WritableImpl<ValueType> wrValue(value);
218 return proxy.Replace(wrKey, wrValue);
232 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
233 impl::thin::WritableImpl<ValueType> wrOldVal(oldVal);
234 impl::thin::WritableImpl<ValueType> wrNewVal(newVal);
236 return proxy.Replace(wrKey, wrOldVal, wrNewVal);
247 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
249 return proxy.ContainsKey(wrKey);
258 template<
typename Set>
271 template<
typename InIter>
274 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
276 return proxy.ContainsKeys(wrSeq);
290 return proxy.GetSize(peekModes);
307 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
309 return proxy.Remove(wrKey);
322 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
323 impl::thin::WritableImpl<ValueType> wrVal(val);
325 return proxy.Remove(wrKey, wrVal);
334 template<
typename Set>
347 template<
typename InIter>
350 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
352 proxy.RemoveAll(wrSeq);
373 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
392 template<
typename Set>
405 template<
typename InIter>
408 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
410 proxy.ClearAll(wrSeq);
424 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
425 impl::thin::WritableImpl<ValueType> wrValIn(valIn);
426 impl::thin::ReadableImpl<ValueType> rdValOut(valOut);
428 proxy.GetAndPut(wrKey, wrValIn, rdValOut);
458 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
459 impl::thin::ReadableImpl<ValueType> rdValOut(valOut);
461 proxy.GetAndRemove(wrKey, rdValOut);
491 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
492 impl::thin::WritableImpl<ValueType> wrValIn(valIn);
493 impl::thin::ReadableImpl<ValueType> rdValOut(valOut);
495 proxy.GetAndReplace(wrKey, wrValIn, rdValOut);
526 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
527 impl::thin::WritableImpl<ValueType> wrValIn(val);
529 return proxy.PutIfAbsent(wrKey, wrValIn);
553 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
554 impl::thin::WritableImpl<ValueType> wrValIn(valIn);
555 impl::thin::ReadableImpl<ValueType> rdValOut(valOut);
557 proxy.GetAndPutIfAbsent(wrKey, wrValIn, rdValOut);
596 return proxy.Query(qry);
617 impl::thin::cache::CacheClientProxy proxy;
623 #endif // _IGNITE_THIN_CACHE_CACHE_CLIENT
void PutAll(InIter begin, InIter end)
Stores given key-value pairs in cache.
Definition: cache_client.h:119
Apache Ignite API.
Definition: cache.h:48
void RemoveAll()
Removes all mappings from cache.
Definition: cache_client.h:360
ValueType GetAndRemove(const KeyType &key)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache_client.h:471
~CacheClient()
Destructor.
Definition: cache_client.h:92
bool Remove(const KeyType &key)
Removes given key mapping from cache.
Definition: cache_client.h:305
void RemoveAll(InIter begin, InIter end)
Removes given key mappings from cache.
Definition: cache_client.h:348
ValueType GetAndReplace(const KeyType &key, const ValueType &valIn)
Atomically replaces the value for a given key if and only if there is a value currently mapped by the...
Definition: cache_client.h:507
Query fields cursor.
Definition: thin-client/include/ignite/thin/cache/query/query_fields_cursor.h:48
bool ContainsKeys(const Set &keys)
Check if cache contains mapping for these keys.
Definition: cache_client.h:259
int64_t GetSize(int32_t peekModes)
Gets the number of all entries cached across all nodes.
Definition: cache_client.h:288
SQL fields query for thin client.
Definition: thin-client/include/ignite/thin/cache/query/query_sql_fields.h:52
ValueType GetAndPutIfAbsent(const KeyType &key, const ValueType &valIn)
Stores given key-value pair in cache only if cache had no previous mapping for it.
Definition: cache_client.h:579
void RemoveAll(const Set &keys)
Removes given key mappings from cache.
Definition: cache_client.h:335
bool ContainsKey(const KeyType &key)
Check if the cache contains a value for the specified key.
Definition: cache_client.h:245
ValueType GetAndPut(const KeyType &key, const ValueType &valIn)
Associates the specified value with the specified key in this cache, returning an existing value if o...
Definition: cache_client.h:440
K KeyType
Key type.
Definition: cache_client.h:65
Cache client class template.
Definition: cache_client.h:59
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry)
Perform SQL fields query.
Definition: cache_client.h:594
V ValueType
Value type.
Definition: cache_client.h:68
bool Replace(const KeyType &key, const ValueType &oldVal, const ValueType &newVal)
Stores given key-value pair in cache only if the previous value is equal to the old value passed as a...
Definition: cache_client.h:230
bool PutIfAbsent(const KeyType &key, const ValueType &val)
Atomically associates the specified key with the given value if it is not already associated with a v...
Definition: cache_client.h:524
void Get(const KeyType &key, ValueType &value)
Get value from the cache.
Definition: cache_client.h:144
CacheClient()
Default constructor.
Definition: cache_client.h:84
void GetAndPut(const KeyType &key, const ValueType &valIn, ValueType &valOut)
Associates the specified value with the specified key in this cache, returning an existing value if o...
Definition: cache_client.h:422
void ClearAll(InIter begin, InIter end)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:406
void Put(const KeyType &key, const ValueType &value)
Associate the specified value with the specified key in the cache.
Definition: cache_client.h:103
void GetAll(InIter begin, InIter end, OutIter dst)
Retrieves values mapped to the specified keys from cache.
Definition: cache_client.h:178
void GetAll(const Set &keys, Map &res)
Retrieves values mapped to the specified keys from cache.
Definition: cache_client.h:196
bool Replace(const K &key, const V &value)
Stores given key-value pair in cache only if there is a previous mapping for it.
Definition: cache_client.h:213
void Clear(const KeyType &key)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:371
void PutAll(const Map &vals)
Stores given key-value pairs in cache.
Definition: cache_client.h:133
void GetAndRemove(const KeyType &key, ValueType &valOut)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache_client.h:456
void Clear()
Clear cache.
Definition: cache_client.h:381
void GetAndReplace(const KeyType &key, const ValueType &valIn, ValueType &valOut)
Atomically replaces the value for a given key if and only if there is a value currently mapped by the...
Definition: cache_client.h:489
void GetAndPutIfAbsent(const KeyType &key, const ValueType &valIn, ValueType &valOut)
Stores given key-value pair in cache only if cache had no previous mapping for it.
Definition: cache_client.h:551
void RefreshAffinityMapping()
Refresh affinity mapping.
Definition: cache_client.h:610
bool ContainsKeys(InIter begin, InIter end)
Check if cache contains mapping for these keys.
Definition: cache_client.h:272
bool Remove(const KeyType &key, const ValueType &val)
Removes given key mapping from cache if one exists and value is equal to the passed in value.
Definition: cache_client.h:320
void ClearAll(const Set &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:393
CacheClient(common::concurrent::SharedPointer< void > impl)
Constructor.
Definition: cache_client.h:75
ValueType Get(const KeyType &key)
Get value from cache.
Definition: cache_client.h:158