23 #ifndef _IGNITE_THIN_CACHE_CACHE_CLIENT 24 #define _IGNITE_THIN_CACHE_CACHE_CLIENT 26 #include <ignite/common/concurrent.h> 28 #include <ignite/impl/thin/writable.h> 29 #include <ignite/impl/thin/writable_key.h> 30 #include <ignite/impl/thin/readable.h> 32 #include <ignite/impl/thin/cache/cache_client_proxy.h> 55 template<
typename K,
typename V>
58 friend class impl::thin::cache::CacheClientProxy;
100 void Put(
const KeyType& key,
const ValueType& value)
102 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
103 impl::thin::WritableImpl<ValueType> wrValue(value);
105 proxy.Put(wrKey, wrValue);
115 template<
typename InIter>
118 impl::thin::WritableMapImpl<K, V, InIter> wrSeq(begin, end);
129 template<
typename Map>
132 PutAll(vals.begin(), vals.end());
141 void Get(
const KeyType& key, ValueType& value)
143 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
144 impl::thin::ReadableImpl<ValueType> rdValue(value);
146 proxy.Get(wrKey, rdValue);
155 ValueType
Get(
const KeyType& key)
174 template<
typename InIter,
typename OutIter>
175 void GetAll(InIter begin, InIter end, OutIter dst)
177 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
178 impl::thin::ReadableMapImpl<K, V, OutIter> rdSeq(dst);
180 proxy.GetAll(wrSeq, rdSeq);
192 template<
typename Set,
typename Map>
195 return GetAll(keys.begin(), keys.end(), std::inserter(res, res.end()));
212 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
213 impl::thin::WritableImpl<ValueType> wrValue(value);
215 return proxy.Replace(wrKey, wrValue);
226 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
228 return proxy.ContainsKey(wrKey);
237 template<
typename Set>
250 template<
typename InIter>
253 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
255 return proxy.ContainsKeys(wrSeq);
269 return proxy.GetSize(peekModes);
286 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
288 return proxy.Remove(wrKey);
297 template<
typename Set>
310 template<
typename InIter>
313 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
315 proxy.RemoveAll(wrSeq);
336 impl::thin::WritableKeyImpl<KeyType> wrKey(key);
355 template<
typename Set>
368 template<
typename InIter>
371 impl::thin::WritableSetImpl<K, InIter> wrSeq(begin, end);
373 proxy.ClearAll(wrSeq);
387 proxy.RefreshAffinityMapping();
392 impl::thin::cache::CacheClientProxy proxy;
398 #endif // _IGNITE_THIN_CACHE_CACHE_CLIENT V ValueType
Value type.
Definition: cache_client.h:65
void GetAll(InIter begin, InIter end, OutIter dst)
Retrieves values mapped to the specified keys from cache.
Definition: cache_client.h:175
void RemoveAll()
Removes all mappings from cache.
Definition: cache_client.h:323
CacheClient(common::concurrent::SharedPointer< void > impl)
Constructor.
Definition: cache_client.h:72
int64_t GetSize(int32_t peekModes)
Gets the number of all entries cached across all nodes.
Definition: cache_client.h:267
void RemoveAll(InIter begin, InIter end)
Removes given key mappings from cache.
Definition: cache_client.h:311
K KeyType
Key type.
Definition: cache_client.h:62
bool ContainsKeys(InIter begin, InIter end)
Check if cache contains mapping for these keys.
Definition: cache_client.h:251
~CacheClient()
Destructor.
Definition: cache_client.h:89
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:210
ValueType Get(const KeyType &key)
Get value from cache.
Definition: cache_client.h:155
void PutAll(const Map &vals)
Stores given key-value pairs in cache.
Definition: cache_client.h:130
void PutAll(InIter begin, InIter end)
Stores given key-value pairs in cache.
Definition: cache_client.h:116
CacheClient()
Default constructor.
Definition: cache_client.h:81
bool ContainsKeys(const Set &keys)
Check if cache contains mapping for these keys.
Definition: cache_client.h:238
void Clear(const KeyType &key)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:334
void Put(const KeyType &key, const ValueType &value)
Associate the specified value with the specified key in the cache.
Definition: cache_client.h:100
void RefreshAffinityMapping()
Refresh affinity mapping.
Definition: cache_client.h:385
void GetAll(const Set &keys, Map &res)
Retrieves values mapped to the specified keys from cache.
Definition: cache_client.h:193
Cache client class template.
Definition: cache_client.h:56
bool Remove(const KeyType &key)
Removes given key mapping from cache.
Definition: cache_client.h:284
void RemoveAll(const Set &keys)
Removes given key mappings from cache.
Definition: cache_client.h:298
void ClearAll(InIter begin, InIter end)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:369
Apache Ignite API.
Definition: cache.h:48
bool ContainsKey(const KeyType &key)
Check if the cache contains a value for the specified key.
Definition: cache_client.h:224
void ClearAll(const Set &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache_client.h:356
void Clear()
Clear cache.
Definition: cache_client.h:344
void Get(const KeyType &key, ValueType &value)
Get value from the cache.
Definition: cache_client.h:141