GridGain C++
cache.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 GridGain Systems, Inc. and Contributors.
3  *
4  * Licensed under the GridGain Community Edition License (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
22 #ifndef _IGNITE_CACHE_CACHE
23 #define _IGNITE_CACHE_CACHE
24 
25 #include <map>
26 #include <set>
27 
28 #include <ignite/common/common.h>
29 #include <ignite/common/concurrent.h>
30 #include <ignite/ignite_error.h>
31 
41 #include <ignite/impl/cache/cache_impl.h>
42 #include <ignite/impl/cache/cache_entry_processor_holder.h>
43 #include <ignite/impl/operations.h>
44 #include <ignite/impl/module_manager.h>
45 #include <ignite/ignite_error.h>
46 
47 namespace ignite
48 {
49  namespace cache
50  {
66  template<typename K, typename V>
67  class IGNITE_IMPORT_EXPORT Cache
68  {
69  public:
77  Cache(impl::cache::CacheImpl* impl) :
78  impl(impl)
79  {
80  // No-op.
81  }
82 
90  const char* GetName() const
91  {
92  return impl.Get()->GetName();
93  }
94 
103  bool IsEmpty()
104  {
105  IgniteError err;
106 
107  bool res = IsEmpty(err);
108 
110 
111  return res;
112  }
113 
123  bool IsEmpty(IgniteError& err)
124  {
125  return Size(err) == 0;
126  }
127 
136  bool ContainsKey(const K& key)
137  {
138  IgniteError err;
139 
140  bool res = ContainsKey(key, err);
141 
143 
144  return res;
145  }
146 
156  bool ContainsKey(const K& key, IgniteError& err)
157  {
158  impl::In1Operation<K> op(key);
159 
160  return impl.Get()->ContainsKey(op, err);
161  }
162 
171  bool ContainsKeys(const std::set<K>& keys)
172  {
173  IgniteError err;
174 
175  bool res = ContainsKeys(keys, err);
176 
178 
179  return res;
180  }
181 
191  template<typename InputIter>
192  bool ContainsKeys(InputIter begin, InputIter end)
193  {
194  IgniteError err;
195 
196  impl::InIterOperation<K, V, InputIter> op(begin, end);
197 
198  bool res = impl.Get()->ContainsKeys(op, err);
199 
201 
202  return res;
203  }
204 
214  bool ContainsKeys(const std::set<K>& keys, IgniteError& err)
215  {
216  impl::InSetOperation<K> op(keys);
217 
218  return impl.Get()->ContainsKeys(op, err);
219  }
220 
234  V LocalPeek(const K& key, int32_t peekModes)
235  {
236  IgniteError err;
237 
238  V res = LocalPeek(key, peekModes, err);
239 
241 
242  return res;
243  }
244 
259  V LocalPeek(const K& key, int32_t peekModes, IgniteError& err)
260  {
261  V val;
262 
263  impl::InCacheLocalPeekOperation<K> inOp(key, peekModes);
264  impl::Out1Operation<V> outOp(val);
265 
266  impl.Get()->LocalPeek(inOp, outOp, err);
267 
268  return val;
269  }
270 
283  V Get(const K& key)
284  {
285  IgniteError err;
286 
287  V res = Get(key, err);
288 
290 
291  return res;
292  }
293 
307  V Get(const K& key, IgniteError& err)
308  {
309  V val;
310  impl::In1Operation<K> inOp(key);
311  impl::Out1Operation<V> outOp(val);
312 
313  impl.Get()->Get(inOp, outOp, err);
314 
315  return val;
316  }
317 
330  std::map<K, V> GetAll(const std::set<K>& keys)
331  {
332  IgniteError err;
333 
334  std::map<K, V> res = GetAll(keys, err);
335 
337 
338  return res;
339  }
340 
354  std::map<K, V> GetAll(const std::set<K>& keys, IgniteError& err)
355  {
356  std::map<K, V> res;
357 
358  impl::InSetOperation<K> inOp(keys);
359  impl::OutMapOperation<K, V> outOp(res);
360 
361  impl.Get()->GetAll(inOp, outOp, err);
362 
363  return res;
364  }
365 
379  template<typename InIter, typename OutIter>
380  void GetAll(InIter begin, InIter end, OutIter dst)
381  {
382  IgniteError err;
383 
384  impl::InIterOperation<K, V, InIter> inOp(begin, end);
385  impl::OutMapIterOperation<K, V, OutIter> outOp(dst);
386 
387  impl.Get()->GetAll(inOp, outOp, err);
388 
390  }
391 
402  void Put(const K& key, const V& val)
403  {
404  IgniteError err;
405 
406  Put(key, val, err);
407 
409  }
410 
422  void Put(const K& key, const V& val, IgniteError& err)
423  {
424  impl::In2Operation<K, V> op(key, val);
425 
426  impl.Get()->Put(op, err);
427  }
428 
438  void PutAll(const std::map<K, V>& vals)
439  {
440  IgniteError err;
441 
442  PutAll(vals, err);
443 
445  }
446 
457  void PutAll(const std::map<K, V>& vals, IgniteError& err)
458  {
459  impl::InMapOperation<K, V> op(vals);
460 
461  impl.Get()->PutAll(op, err);
462  }
463 
477  template<typename Iter>
478  void PutAll(Iter begin, Iter end)
479  {
480  IgniteError err;
481 
482  impl::InIterOperation<K, V, Iter> op(begin, end);
483 
484  impl.Get()->PutAll(op, err);
485 
487  }
488 
500  V GetAndPut(const K& key, const V& val)
501  {
502  IgniteError err;
503 
504  V res = GetAndPut(key, val, err);
505 
507 
508  return res;
509  }
510 
523  V GetAndPut(const K& key, const V& val, IgniteError& err)
524  {
525  V oldVal;
526 
527  impl::In2Operation<K, V> inOp(key, val);
528  impl::Out1Operation<V> outOp(oldVal);
529 
530  impl.Get()->GetAndPut(inOp, outOp, err);
531 
532  return oldVal;
533  }
534 
546  V GetAndReplace(const K& key, const V& val)
547  {
548  IgniteError err;
549 
550  V res = GetAndReplace(key, val, err);
551 
553 
554  return res;
555  }
556 
569  V GetAndReplace(const K& key, const V& val, IgniteError& err)
570  {
571  V oldVal;
572 
573  impl::In2Operation<K, V> inOp(key, val);
574  impl::Out1Operation<V> outOp(oldVal);
575 
576  impl.Get()->GetAndReplace(inOp, outOp, err);
577 
578  return oldVal;
579  }
580 
589  V GetAndRemove(const K& key)
590  {
591  IgniteError err;
592 
593  V res = GetAndRemove(key, err);
594 
596 
597  return res;
598  }
599 
609  V GetAndRemove(const K& key, IgniteError& err)
610  {
611  V oldVal;
612 
613  impl::In1Operation<K> inOp(key);
614  impl::Out1Operation<V> outOp(oldVal);
615 
616  impl.Get()->GetAndRemove(inOp, outOp, err);
617 
618  return oldVal;
619  }
620 
631  bool PutIfAbsent(const K& key, const V& val)
632  {
633  IgniteError err;
634 
635  bool res = PutIfAbsent(key, val, err);
636 
638 
639  return res;
640  }
641 
653  bool PutIfAbsent(const K& key, const V& val, IgniteError& err)
654  {
655  impl::In2Operation<K, V> op(key, val);
656 
657  return impl.Get()->PutIfAbsent(op, err);
658  }
659 
678  V GetAndPutIfAbsent(const K& key, const V& val)
679  {
680  IgniteError err;
681 
682  V res = GetAndPutIfAbsent(key, val, err);
683 
685 
686  return res;
687  }
688 
708  V GetAndPutIfAbsent(const K& key, const V& val, IgniteError& err)
709  {
710  V oldVal;
711 
712  impl::In2Operation<K, V> inOp(key, val);
713  impl::Out1Operation<V> outOp(oldVal);
714 
715  impl.Get()->GetAndPutIfAbsent(inOp, outOp, err);
716 
717  return oldVal;
718  }
719 
735  bool Replace(const K& key, const V& val)
736  {
737  IgniteError err;
738 
739  bool res = Replace(key, val, err);
740 
742 
743  return res;
744  }
745 
762  bool Replace(const K& key, const V& val, IgniteError& err)
763  {
764  impl::In2Operation<K, V> op(key, val);
765 
766  return impl.Get()->Replace(op, err);
767  }
768 
781  bool Replace(const K& key, const V& oldVal, const V& newVal)
782  {
783  IgniteError err;
784 
785  bool res = Replace(key, oldVal, newVal, err);
786 
788 
789  return res;
790  }
791 
805  bool Replace(const K& key, const V& oldVal, const V& newVal, IgniteError& err)
806  {
807  impl::In3Operation<K, V, V> op(key, oldVal, newVal);
808 
809  return impl.Get()->ReplaceIfEqual(op, err);
810  }
811 
822  void LocalEvict(const std::set<K>& keys)
823  {
824  IgniteError err;
825 
826  LocalEvict(keys, err);
827 
829  }
830 
842  void LocalEvict(const std::set<K>& keys, IgniteError& err)
843  {
844  impl::InSetOperation<K> op(keys);
845 
846  impl.Get()->LocalEvict(op, err);
847  }
848 
860  template<typename Iter>
861  void LocalEvict(Iter begin, Iter end)
862  {
863  IgniteError err;
864 
865  impl::InIterOperation<K, V, Iter> op(begin, end);
866 
867  impl.Get()->LocalEvict(op, err);
868 
870  }
871 
877  void Clear()
878  {
879  IgniteError err;
880 
881  Clear(err);
882 
884  }
885 
893  void Clear(IgniteError& err)
894  {
895  impl.Get()->Clear(err);
896  }
897 
906  void Clear(const K& key)
907  {
908  IgniteError err;
909 
910  Clear(key, err);
911 
913  }
914 
924  void Clear(const K& key, IgniteError& err)
925  {
926  impl::In1Operation<K> op(key);
927 
928  impl.Get()->Clear(op, err);
929  }
930 
939  void ClearAll(const std::set<K>& keys)
940  {
941  IgniteError err;
942 
943  ClearAll(keys, err);
944 
946  }
947 
957  void ClearAll(const std::set<K>& keys, IgniteError& err)
958  {
959  impl::InSetOperation<K> op(keys);
960 
961  impl.Get()->ClearAll(op, err);
962  }
963 
973  template<typename Iter>
974  void ClearAll(Iter begin, Iter end)
975  {
976  IgniteError err;
977 
978  impl::InIterOperation<K, V, Iter> op(begin, end);
979 
980  impl.Get()->ClearAll(op, err);
981 
983  }
984 
996  void LocalClear(const K& key)
997  {
998  IgniteError err;
999 
1000  LocalClear(key, err);
1001 
1003  }
1004 
1017  void LocalClear(const K& key, IgniteError& err)
1018  {
1019  impl::In1Operation<K> op(key);
1020 
1021  impl.Get()->LocalClear(op, err);
1022  }
1023 
1035  void LocalClearAll(const std::set<K>& keys)
1036  {
1037  IgniteError err;
1038 
1039  LocalClearAll(keys, err);
1040 
1042  }
1043 
1056  void LocalClearAll(const std::set<K>& keys, IgniteError& err)
1057  {
1058  impl::InSetOperation<K> op(keys);
1059 
1060  impl.Get()->LocalClearAll(op, err);
1061  }
1062 
1075  template<typename Iter>
1076  void LocalClearAll(Iter begin, Iter end)
1077  {
1078  IgniteError err;
1079 
1080  impl::InIterOperation<K, V, Iter> op(begin, end);
1081 
1082  impl.Get()->LocalClearAll(op, err);
1083 
1085  }
1086 
1102  bool Remove(const K& key)
1103  {
1104  IgniteError err;
1105 
1106  bool res = Remove(key, err);
1107 
1109 
1110  return res;
1111  }
1112 
1129  bool Remove(const K& key, IgniteError& err)
1130  {
1131  impl::In1Operation<K> op(key);
1132 
1133  return impl.Get()->Remove(op, err);
1134  }
1135 
1147  bool Remove(const K& key, const V& val)
1148  {
1149  IgniteError err;
1150 
1151  bool res = Remove(key, val, err);
1152 
1154 
1155  return res;
1156  }
1157 
1170  bool Remove(const K& key, const V& val, IgniteError& err)
1171  {
1172  impl::In2Operation<K, V> op(key, val);
1173 
1174  return impl.Get()->RemoveIfEqual(op, err);
1175  }
1176 
1186  void RemoveAll(const std::set<K>& keys)
1187  {
1188  IgniteError err;
1189 
1190  RemoveAll(keys, err);
1191 
1193  }
1194 
1205  void RemoveAll(const std::set<K>& keys, IgniteError& err)
1206  {
1207  impl::InSetOperation<K> op(keys);
1208 
1209  impl.Get()->RemoveAll(op, err);
1210  }
1211 
1225  template<typename Iter>
1226  void RemoveAll(Iter begin, Iter end)
1227  {
1228  IgniteError err;
1229 
1230  impl::InIterOperation<K, V, Iter> op(begin, end);
1231 
1232  impl.Get()->RemoveAll(op, err);
1233 
1235  }
1236 
1245  void RemoveAll()
1246  {
1247  IgniteError err;
1248 
1249  RemoveAll(err);
1250 
1252  }
1253 
1264  {
1265  return impl.Get()->RemoveAll(err);
1266  }
1267 
1275  int32_t LocalSize()
1276  {
1277  return LocalSize(CachePeekMode::ALL);
1278  }
1279 
1288  int32_t LocalSize(IgniteError& err)
1289  {
1290  return LocalSize(CachePeekMode::ALL, err);
1291  }
1292 
1301  int32_t LocalSize(int32_t peekModes)
1302  {
1303  IgniteError err;
1304 
1305  int32_t res = LocalSize(peekModes, err);
1306 
1308 
1309  return res;
1310  }
1311 
1321  int32_t LocalSize(int32_t peekModes, IgniteError& err)
1322  {
1323  return impl.Get()->Size(peekModes, true, err);
1324  }
1325 
1334  int32_t Size()
1335  {
1336  return Size(ignite::cache::CachePeekMode::ALL);
1337  }
1338 
1348  int32_t Size(IgniteError& err)
1349  {
1350  return Size(ignite::cache::CachePeekMode::ALL, err);
1351  }
1352 
1362  int32_t Size(int32_t peekModes)
1363  {
1364  IgniteError err;
1365 
1366  int32_t res = Size(peekModes, err);
1367 
1369 
1370  return res;
1371  }
1372 
1383  int32_t Size(int32_t peekModes, IgniteError& err)
1384  {
1385  return impl.Get()->Size(peekModes, false, err);
1386  }
1387 
1398  {
1399  IgniteError err;
1400 
1401  query::QueryCursor<K, V> res = Query(qry, err);
1402 
1404 
1405  return res;
1406  }
1407 
1418  {
1419  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySql(qry, err);
1420 
1421  return query::QueryCursor<K, V>(cursorImpl);
1422  }
1423 
1433  {
1434  IgniteError err;
1435 
1436  query::QueryCursor<K, V> res = Query(qry, err);
1437 
1439 
1440  return res;
1441  }
1442 
1453  {
1454  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryText(qry, err);
1455 
1456  return query::QueryCursor<K, V>(cursorImpl);
1457  }
1458 
1468  {
1469  IgniteError err;
1470 
1471  query::QueryCursor<K, V> res = Query(qry, err);
1472 
1474 
1475  return res;
1476  }
1477 
1488  {
1489  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryScan(qry, err);
1490 
1491  return query::QueryCursor<K, V>(cursorImpl);
1492  }
1493 
1503  {
1504  IgniteError err;
1505 
1506  query::QueryFieldsCursor res = Query(qry, err);
1507 
1509 
1510  return res;
1511  }
1512 
1523  {
1524  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySqlFields(qry, err);
1525 
1526  return query::QueryFieldsCursor(cursorImpl);
1527  }
1528 
1570  template<typename R, typename P, typename A>
1571  R Invoke(const K& key, const P& processor, const A& arg)
1572  {
1573  IgniteError err;
1574 
1575  R res = Invoke<R>(key, processor, arg, err);
1576 
1578 
1579  return res;
1580  }
1581 
1625  template<typename R, typename P, typename A>
1626  R Invoke(const K& key, const P& processor, const A& arg, IgniteError& err)
1627  {
1628  typedef impl::cache::CacheEntryProcessorHolder<P, A> ProcessorHolder;
1629 
1630  R res;
1631  ProcessorHolder procHolder(processor, arg);
1632 
1633  impl::InCacheInvokeOperation<K, ProcessorHolder> inOp(key, procHolder);
1634  impl::Out1Operation<R> outOp(res);
1635 
1636  impl.Get()->Invoke(inOp, outOp, err);
1637 
1638  return res;
1639  }
1640 
1667  template<typename R, typename A>
1668  R InvokeJava(const K& key, const std::string& processorName, const A& arg)
1669  {
1670  IgniteError err;
1671 
1672  R res = InvokeJava<R>(key, processorName, arg, err);
1673 
1675 
1676  return res;
1677  }
1678 
1705  template<typename R, typename A>
1706  R InvokeJava(const K& key, const std::string& processorName, const A& arg, IgniteError& err)
1707  {
1708  R res;
1709 
1710  impl::In3Operation<std::string, K, A> inOp(processorName, key, arg);
1711  impl::Out1Operation<R> outOp(res);
1712 
1713  impl.Get()->InvokeJava(inOp, outOp, err);
1714 
1715  return res;
1716  }
1717 
1726  {
1727  IgniteError err;
1728 
1729  query::continuous::ContinuousQueryHandle<K, V> res = QueryContinuous(qry, err);
1730 
1732 
1733  return res;
1734  }
1735 
1745  {
1746  using namespace impl::cache::query::continuous;
1747  using namespace common::concurrent;
1748 
1749  const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
1750 
1751  if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
1752  {
1754  "Event listener is not set for ContinuousQuery instance");
1755 
1757  }
1758 
1759  ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, err);
1760 
1762  }
1763 
1771  template<typename Q>
1774  const Q& initialQry)
1775  {
1776  IgniteError err;
1777 
1778  query::continuous::ContinuousQueryHandle<K, V> res = QueryContinuous(qry, initialQry, err);
1779 
1781 
1782  return res;
1783  }
1784 
1793  template<typename Q>
1796  const Q& initialQry, IgniteError& err)
1797  {
1798  using namespace impl::cache::query::continuous;
1799  using namespace common::concurrent;
1800 
1801  const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
1802 
1803  if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
1804  {
1806  "Event listener is not set for ContinuousQuery instance");
1807 
1809  }
1810 
1811  ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, initialQry, err);
1812 
1814  }
1815 
1827  bool IsValid() const
1828  {
1829  return impl.IsValid();
1830  }
1831 
1835  void LoadCache()
1836  {
1837  IgniteError err;
1838 
1839  impl.Get()->LoadCache(err);
1840 
1842  }
1843 
1853  {
1854  IgniteError err;
1855 
1856  impl.Get()->LocalLoadCache(err);
1857 
1859  }
1860 
1861  private:
1863  common::concurrent::SharedPointer<impl::cache::CacheImpl> impl;
1864  };
1865  }
1866 }
1867 
1868 #endif //_IGNITE_CACHE_CACHE
ignite::cache::Cache::LocalEvict
void LocalEvict(const std::set< K > &keys)
Attempts to evict all entries associated with keys.
Definition: cache.h:822
ignite::cache::Cache::GetAndRemove
V GetAndRemove(const K &key)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache.h:589
ignite
Ignite API.
Definition: cache.h:47
ignite::cache::Cache::GetAndPutIfAbsent
V 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.
Definition: cache.h:708
ignite::cache::Cache::Replace
bool Replace(const K &key, const V &oldVal, const V &newVal)
Stores given key-value pair in cache only if the previous value is equal to the old value passed as a...
Definition: cache.h:781
cache_peek_mode.h
ignite::cache::Cache::PutIfAbsent
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 v...
Definition: cache.h:631
ignite::cache::Cache::Clear
void Clear(IgniteError &err)
Clear cache.
Definition: cache.h:893
continuous_query_handle.h
ignite::cache::Cache::ContainsKeys
bool ContainsKeys(const std::set< K > &keys, IgniteError &err)
Check if cache contains mapping for these keys.
Definition: cache.h:214
ignite::cache::Cache::PutAll
void PutAll(Iter begin, Iter end)
Stores given key-value pairs in cache.
Definition: cache.h:478
ignite::cache::Cache::Remove
bool Remove(const K &key)
Removes given key mapping from cache.
Definition: cache.h:1102
ignite::cache::Cache::PutAll
void PutAll(const std::map< K, V > &vals, IgniteError &err)
Stores given key-value pairs in cache.
Definition: cache.h:457
ignite::cache::Cache::Replace
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.
Definition: cache.h:762
ignite::cache::Cache::LocalPeek
V LocalPeek(const K &key, int32_t peekModes, IgniteError &err)
Peeks at cached value using optional set of peek modes.
Definition: cache.h:259
ignite::cache::Cache::QueryContinuous
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry)
Start continuous query execution.
Definition: cache.h:1724
ignite::cache::Cache::Remove
bool Remove(const K &key, IgniteError &err)
Removes given key mapping from cache.
Definition: cache.h:1129
ignite::cache::Cache::LoadCache
void LoadCache()
Executes LocalLoadCache on all cache nodes.
Definition: cache.h:1835
ignite::cache::Cache::IsValid
bool IsValid() const
Check if the instance is valid.
Definition: cache.h:1827
ignite::cache::Cache::GetAll
std::map< K, V > GetAll(const std::set< K > &keys, IgniteError &err)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:354
ignite::cache::Cache
Main entry point for all Data Grid APIs.
Definition: cache.h:67
ignite::cache::Cache::GetAndPutIfAbsent
V GetAndPutIfAbsent(const K &key, const V &val)
Stores given key-value pair in cache only if cache had no previous mapping for it.
Definition: cache.h:678
ignite::cache::query::ScanQuery
Scan query.
Definition: core/include/ignite/cache/query/query_scan.h:39
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::TextQuery &qry)
Perform text query.
Definition: cache.h:1432
ignite::cache::Cache::ClearAll
void ClearAll(const std::set< K > &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:939
ignite::cache::Cache::LocalLoadCache
void LocalLoadCache()
Loads state from the underlying persistent storage.
Definition: cache.h:1852
ignite::cache::Cache::Size
int32_t Size(int32_t peekModes)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1362
ignite::cache::Cache::GetAndRemove
V GetAndRemove(const K &key, IgniteError &err)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache.h:609
ignite::cache::Cache::GetAndReplace
V 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...
Definition: cache.h:569
ignite::cache::Cache::GetAndPut
V 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 o...
Definition: cache.h:523
ignite::cache::Cache::Size
int32_t Size(IgniteError &err)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1348
ignite::cache::Cache::LocalSize
int32_t LocalSize(IgniteError &err)
Gets the number of all entries cached on this node.
Definition: cache.h:1288
ignite::cache::Cache::InvokeJava
R InvokeJava(const K &key, const std::string &processorName, const A &arg, IgniteError &err)
Invokes an instance of Java class CacheEntryProcessor against the entry specified by the provided key...
Definition: cache.h:1706
ignite::cache::Cache::PutAll
void PutAll(const std::map< K, V > &vals)
Stores given key-value pairs in cache.
Definition: cache.h:438
ignite::cache::query::QueryCursor
Query cursor class template.
Definition: core/include/ignite/cache/query/query_cursor.h:53
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::TextQuery &qry, IgniteError &err)
Perform text query.
Definition: cache.h:1452
query_sql.h
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::ScanQuery &qry, IgniteError &err)
Perform scan query.
Definition: cache.h:1487
ignite::cache::Cache::Query
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry, IgniteError &err)
Perform sql fields query.
Definition: cache.h:1522
ignite::cache::Cache::GetAll
void GetAll(InIter begin, InIter end, OutIter dst)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:380
ignite::cache::Cache::PutIfAbsent
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 v...
Definition: cache.h:653
ignite::cache::Cache::Get
V Get(const K &key)
Retrieves value mapped to the specified key from cache.
Definition: cache.h:283
ignite::cache::Cache::Put
void Put(const K &key, const V &val)
Associates the specified value with the specified key in the cache.
Definition: cache.h:402
ignite::cache::Cache::GetName
const char * GetName() const
Get name of this cache (null for default cache).
Definition: cache.h:90
ignite::cache::Cache::Size
int32_t Size()
Gets the number of all entries cached across all nodes.
Definition: cache.h:1334
ignite::cache::Cache::Query
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry)
Perform sql fields query.
Definition: cache.h:1502
ignite::cache::Cache::LocalEvict
void LocalEvict(const std::set< K > &keys, IgniteError &err)
Attempts to evict all entries associated with keys.
Definition: cache.h:842
ignite::cache::Cache::Put
void Put(const K &key, const V &val, IgniteError &err)
Associates the specified value with the specified key in the cache.
Definition: cache.h:422
query_scan.h
ignite::cache::Cache::LocalEvict
void LocalEvict(Iter begin, Iter end)
Attempts to evict all entries associated with keys.
Definition: cache.h:861
ignite::cache::query::QueryFieldsCursor
Query fields cursor.
Definition: core/include/ignite/cache/query/query_fields_cursor.h:49
ignite::cache::Cache::GetAndReplace
V 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...
Definition: cache.h:546
ignite::cache::Cache::LocalClearAll
void LocalClearAll(Iter begin, Iter end)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1076
ignite::cache::Cache::QueryContinuous
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry, const Q &initialQry, IgniteError &err)
Start continuous query execution with the initial query.
Definition: cache.h:1794
ignite::cache::Cache::Remove
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.
Definition: cache.h:1170
ignite::cache::Cache::GetAll
std::map< K, V > GetAll(const std::set< K > &keys)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:330
ignite::cache::Cache::ClearAll
void ClearAll(Iter begin, Iter end)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:974
ignite::cache::Cache::Cache
Cache(impl::cache::CacheImpl *impl)
Constructor.
Definition: cache.h:77
ignite::cache::Cache::RemoveAll
void RemoveAll()
Removes all mappings from cache.
Definition: cache.h:1245
ignite::cache::Cache::QueryContinuous
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry, const Q &initialQry)
Start continuous query execution with the initial query.
Definition: cache.h:1772
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::SqlQuery &qry, IgniteError &err)
Perform SQL query.
Definition: cache.h:1417
ignite::IgniteError::IGNITE_ERR_GENERIC
static const int IGNITE_ERR_GENERIC
Generic Ignite error.
Definition: ignite_error.h:130
ignite::cache::Cache::Clear
void Clear()
Clear cache.
Definition: cache.h:877
ignite::cache::query::TextQuery
Text query.
Definition: query_text.h:39
ignite::cache::Cache::LocalClear
void LocalClear(const K &key, IgniteError &err)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1017
ignite::cache::Cache::Invoke
R Invoke(const K &key, const P &processor, const A &arg)
Invokes an CacheEntryProcessor against the MutableCacheEntry specified by the provided key.
Definition: cache.h:1571
ignite::cache::Cache::LocalSize
int32_t LocalSize(int32_t peekModes)
Gets the number of all entries cached on this node.
Definition: cache.h:1301
ignite::cache::Cache::LocalClearAll
void LocalClearAll(const std::set< K > &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1035
query_cursor.h
ignite::cache::Cache::RemoveAll
void RemoveAll(const std::set< K > &keys)
Removes given key mappings from cache.
Definition: cache.h:1186
ignite::cache::query::continuous::ContinuousQuery
Continuous query.
Definition: continuous_query.h:58
ignite::cache::Cache::ContainsKey
bool ContainsKey(const K &key)
Check if cache contains mapping for this key.
Definition: cache.h:136
ignite::cache::Cache::ContainsKeys
bool ContainsKeys(const std::set< K > &keys)
Check if cache contains mapping for these keys.
Definition: cache.h:171
ignite::cache::Cache::RemoveAll
void RemoveAll(Iter begin, Iter end)
Removes given key mappings from cache.
Definition: cache.h:1226
ignite::cache::Cache::QueryContinuous
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry, IgniteError &err)
Start continuous query execution.
Definition: cache.h:1743
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::SqlQuery &qry)
Perform SQL query.
Definition: cache.h:1397
ignite::cache::Cache::IsEmpty
bool IsEmpty()
Checks whether this cache contains no key-value mappings.
Definition: cache.h:103
ignite::cache::Cache::Clear
void Clear(const K &key, IgniteError &err)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:924
ignite::cache::Cache::IsEmpty
bool IsEmpty(IgniteError &err)
Checks whether this cache contains no key-value mappings.
Definition: cache.h:123
ignite::cache::Cache::Clear
void Clear(const K &key)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:906
query_sql_fields.h
ignite::cache::Cache::Remove
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.
Definition: cache.h:1147
ignite::cache::Cache::RemoveAll
void RemoveAll(IgniteError &err)
Removes all mappings from cache.
Definition: cache.h:1263
ignite::cache::Cache::InvokeJava
R InvokeJava(const K &key, const std::string &processorName, const A &arg)
Invokes an instance of Java class CacheEntryProcessor against the entry specified by the provided key...
Definition: cache.h:1668
ignite::IgniteError::ThrowIfNeeded
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:26
ignite::cache::Cache::LocalSize
int32_t LocalSize()
Gets the number of all entries cached on this node.
Definition: cache.h:1275
ignite::cache::Cache::Replace
bool Replace(const K &key, const V &val)
Stores given key-value pair in cache only if there is a previous mapping for it.
Definition: cache.h:735
ignite::cache::Cache::LocalSize
int32_t LocalSize(int32_t peekModes, IgniteError &err)
Gets the number of all entries cached on this node.
Definition: cache.h:1321
ignite::cache::query::SqlFieldsQuery
Sql fields query.
Definition: core/include/ignite/cache/query/query_sql_fields.h:41
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::ScanQuery &qry)
Perform scan query.
Definition: cache.h:1467
ignite::cache::Cache::Size
int32_t Size(int32_t peekModes, IgniteError &err)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1383
ignite::cache::Cache::Get
V Get(const K &key, IgniteError &err)
Retrieves value mapped to the specified key from cache.
Definition: cache.h:307
ignite_error.h
ignite::cache::Cache::ContainsKeys
bool ContainsKeys(InputIter begin, InputIter end)
Check if cache contains mapping for these keys.
Definition: cache.h:192
ignite::cache::Cache::LocalPeek
V LocalPeek(const K &key, int32_t peekModes)
Peeks at cached value using optional set of peek modes.
Definition: cache.h:234
ignite::IgniteError
Ignite error information.
Definition: ignite_error.h:93
ignite::cache::query::SqlQuery
Sql query.
Definition: query_sql.h:43
ignite::cache::Cache::Replace
bool Replace(const K &key, const V &oldVal, const V &newVal, IgniteError &err)
Stores given key-value pair in cache only if the previous value is equal to the old value passed as a...
Definition: cache.h:805
ignite::cache::Cache::ContainsKey
bool ContainsKey(const K &key, IgniteError &err)
Check if cache contains mapping for this key.
Definition: cache.h:156
ignite::cache::Cache::GetAndPut
V GetAndPut(const K &key, const V &val)
Associates the specified value with the specified key in this cache, returning an existing value if o...
Definition: cache.h:500
ignite::cache::Cache::LocalClear
void LocalClear(const K &key)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:996
query_text.h
ignite::cache::Cache::LocalClearAll
void LocalClearAll(const std::set< K > &keys, IgniteError &err)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1056
continuous_query.h
ignite::cache::Cache::RemoveAll
void RemoveAll(const std::set< K > &keys, IgniteError &err)
Removes given key mappings from cache.
Definition: cache.h:1205
ignite::cache::Cache::ClearAll
void ClearAll(const std::set< K > &keys, IgniteError &err)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:957
ignite::cache::Cache::Invoke
R Invoke(const K &key, const P &processor, const A &arg, IgniteError &err)
Invokes an CacheEntryProcessor against the MutableCacheEntry specified by the provided key.
Definition: cache.h:1626
query_fields_cursor.h
ignite::cache::CachePeekMode::ALL
@ ALL
Peeks into all available cache storages.
Definition: core/include/ignite/cache/cache_peek_mode.h:39
ignite::cache::query::continuous::ContinuousQueryHandle
Continuous query handle.
Definition: core/include/ignite/cache/query/continuous/continuous_query_handle.h:39