 |
GridGain C++
|
Go to the documentation of this file.
22 #ifndef _IGNITE_THIN_CACHE_CACHE_CLIENT
23 #define _IGNITE_THIN_CACHE_CACHE_CLIENT
25 #include <ignite/common/concurrent.h>
34 #include <ignite/impl/thin/writable.h>
35 #include <ignite/impl/thin/writable_key.h>
37 #include <ignite/impl/thin/readable.h>
38 #include <ignite/impl/thin/cache/cache_client_proxy.h>
39 #include <ignite/impl/thin/cache/continuous/continuous_query_client_holder.h>
62 template<
typename K,
typename V>
65 friend class impl::thin::cache::CacheClientProxy;
79 explicit CacheClient(
const common::concurrent::SharedPointer<void>& impl) :
109 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
110 impl::thin::WritableImpl<ValueType> wrValue(value);
112 proxy.Put(wrKey, wrValue);
122 template<
typename InIter>
125 impl::thin::WritableMapImpl<K, V, InIter> wrSeq(begin, end);
136 template<
typename Map>
139 PutAll(vals.begin(), vals.end());
150 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
153 proxy.Get(wrKey, rdValue);
181 template<
typename InIter,
typename OutIter>
182 void GetAll(InIter begin, InIter end, OutIter dst)
184 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
185 impl::thin::ReadableContainerImpl< std::pair<K, V>, OutIter> rdSeq(dst);
187 proxy.GetAll(wrSeq, rdSeq);
199 template<
typename Set,
typename Map>
202 return GetAll(keys.begin(), keys.end(), std::inserter(res, res.end()));
219 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
220 impl::thin::WritableImpl<ValueType> wrValue(value);
222 return proxy.Replace(wrKey, wrValue);
236 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
237 impl::thin::WritableImpl<ValueType> wrOldVal(oldVal);
238 impl::thin::WritableImpl<ValueType> wrNewVal(newVal);
240 return proxy.Replace(wrKey, wrOldVal, wrNewVal);
251 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
253 return proxy.ContainsKey(wrKey);
262 template<
typename Set>
275 template<
typename InIter>
278 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
280 return proxy.ContainsKeys(wrSeq);
294 return proxy.GetSize(peekModes);
311 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
313 return proxy.Remove(wrKey);
326 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
327 impl::thin::WritableImpl<ValueType> wrVal(val);
329 return proxy.Remove(wrKey, wrVal);
338 template<
typename Set>
351 template<
typename InIter>
354 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
356 proxy.RemoveAll(wrSeq);
377 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
396 template<
typename Set>
409 template<
typename InIter>
412 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
414 proxy.ClearAll(wrSeq);
428 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
429 impl::thin::WritableImpl<ValueType> wrValIn(valIn);
432 proxy.GetAndPut(wrKey, wrValIn, rdValOut);
462 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
465 proxy.GetAndRemove(wrKey, rdValOut);
495 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
496 impl::thin::WritableImpl<ValueType> wrValIn(valIn);
499 proxy.GetAndReplace(wrKey, wrValIn, rdValOut);
530 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
531 impl::thin::WritableImpl<ValueType> wrValIn(val);
533 return proxy.PutIfAbsent(wrKey, wrValIn);
557 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
558 impl::thin::WritableImpl<ValueType> wrValIn(valIn);
561 proxy.GetAndPutIfAbsent(wrKey, wrValIn, rdValOut);
600 return proxy.Query(qry);
623 using namespace impl::thin::cache::query::continuous;
625 SP_ContinuousQueryClientHolderBase holder(
new ContinuousQueryClientHolder<K, V>(continuousQuery));
627 return proxy.QueryContinuous(holder, continuousQuery.
GetJavaFilter());
648 impl::thin::cache::CacheClientProxy proxy;
654 #endif // _IGNITE_THIN_CACHE_CACHE_CLIENT
void PutAll(InIter begin, InIter end)
Stores given key-value pairs in cache.
Definition: cache_client.h:123
Ignite API.
Definition: cache.h:47
void RemoveAll()
Removes all mappings from cache.
Definition: cache_client.h:364
ValueType GetAndRemove(const KeyType &key)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache_client.h:475
~CacheClient()
Destructor.
Definition: cache_client.h:96
bool Remove(const KeyType &key)
Removes given key mapping from cache.
Definition: cache_client.h:309
Continuous query client.
Definition: continuous_query_client.h:53
void RemoveAll(InIter begin, InIter end)
Removes given key mappings from cache.
Definition: cache_client.h:352
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:511
Query fields cursor.
Definition: thin-client/include/ignite/thin/cache/query/query_fields_cursor.h:47
bool ContainsKeys(const Set &keys)
Check if cache contains mapping for these keys.
Definition: cache_client.h:263
int64_t GetSize(int32_t peekModes)
Gets the number of all entries cached across all nodes.
Definition: cache_client.h:292
Continuous query handle client.
Definition: thin-client/include/ignite/thin/cache/query/continuous/continuous_query_handle.h:42
SQL fields query for thin client.
Definition: thin-client/include/ignite/thin/cache/query/query_sql_fields.h:51
CacheClient(const common::concurrent::SharedPointer< void > &impl)
Constructor.
Definition: cache_client.h:79
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:583
void RemoveAll(const Set &keys)
Removes given key mappings from cache.
Definition: cache_client.h:339
bool ContainsKey(const KeyType &key)
Check if the cache contains a value for the specified key.
Definition: cache_client.h:249
query::continuous::ContinuousQueryHandleClient QueryContinuous(query::continuous::ContinuousQueryClient< K, V > continuousQuery)
Starts the continuous query execution.
Definition: cache_client.h:620
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:444
K KeyType
Key type.
Definition: cache_client.h:69
Cache client class template.
Definition: cache_client.h:63
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry)
Perform SQL fields query.
Definition: cache_client.h:598
V ValueType
Value type.
Definition: cache_client.h:72
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:234
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:528
void Get(const KeyType &key, ValueType &value)
Get value from the cache.
Definition: cache_client.h:148
CacheClient()
Default constructor.
Definition: cache_client.h:88
query::QueryCursor< KeyType, ValueType > Query(const query::ScanQuery &qry)
Perform scan query.
Definition: cache_client.h:609
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:426
void ClearAll(InIter begin, InIter end)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:410
void Put(const KeyType &key, const ValueType &value)
Associate the specified value with the specified key in the cache.
Definition: cache_client.h:107
Scan query.
Definition: thin-client/include/ignite/thin/cache/query/query_scan.h:51
Query cursor class template.
Definition: thin-client/include/ignite/thin/cache/query/query_cursor.h:56
void GetAll(InIter begin, InIter end, OutIter dst)
Retrieves values mapped to the specified keys from cache.
Definition: cache_client.h:182
void GetAll(const Set &keys, Map &res)
Retrieves values mapped to the specified keys from cache.
Definition: cache_client.h:200
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:217
void Clear(const KeyType &key)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:375
void PutAll(const Map &vals)
Stores given key-value pairs in cache.
Definition: cache_client.h:137
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:460
event::JavaCacheEntryEventFilter & GetJavaFilter()
Get remote Java filter reference.
Definition: continuous_query_client.h:230
void Clear()
Clear cache.
Definition: cache_client.h:385
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:493
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:555
Definition: thin-client/include/ignite/thin/cache/cache_entry.h:35
void RefreshAffinityMapping()
Refresh affinity mapping.
Definition: cache_client.h:641
bool ContainsKeys(InIter begin, InIter end)
Check if cache contains mapping for these keys.
Definition: cache_client.h:276
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:324
void ClearAll(const Set &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:397
ValueType Get(const KeyType &key)
Get value from cache.
Definition: cache_client.h:162