Apache Ignite C++
cache.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
23 #ifndef _IGNITE_CACHE_CACHE
24 #define _IGNITE_CACHE_CACHE
25 
26 #include <map>
27 #include <set>
28 
29 #include <ignite/common/common.h>
30 #include <ignite/common/concurrent.h>
31 #include <ignite/ignite_error.h>
32 
42 #include <ignite/impl/cache/cache_impl.h>
43 #include <ignite/impl/cache/cache_entry_processor_holder.h>
44 #include <ignite/impl/operations.h>
45 #include <ignite/impl/module_manager.h>
46 #include <ignite/ignite_error.h>
47 
48 namespace ignite
49 {
50  namespace cache
51  {
67  template<typename K, typename V>
68  class IGNITE_IMPORT_EXPORT Cache
69  {
70  public:
78  Cache(impl::cache::CacheImpl* impl) :
79  impl(impl)
80  {
81  // No-op.
82  }
83 
91  const char* GetName() const
92  {
93  return impl.Get()->GetName();
94  }
95 
104  bool IsEmpty()
105  {
106  IgniteError err;
107 
108  bool res = IsEmpty(err);
109 
111 
112  return res;
113  }
114 
124  bool IsEmpty(IgniteError& err)
125  {
126  return Size(err) == 0;
127  }
128 
137  bool ContainsKey(const K& key)
138  {
139  IgniteError err;
140 
141  bool res = ContainsKey(key, err);
142 
144 
145  return res;
146  }
147 
157  bool ContainsKey(const K& key, IgniteError& err)
158  {
159  impl::In1Operation<K> op(key);
160 
161  return impl.Get()->ContainsKey(op, err);
162  }
163 
172  bool ContainsKeys(const std::set<K>& keys)
173  {
174  IgniteError err;
175 
176  bool res = ContainsKeys(keys, err);
177 
179 
180  return res;
181  }
182 
192  template<typename InputIter>
193  bool ContainsKeys(InputIter begin, InputIter end)
194  {
195  IgniteError err;
196 
197  impl::InIterOperation<K, V, InputIter> op(begin, end);
198 
199  bool res = impl.Get()->ContainsKeys(op, err);
200 
202 
203  return res;
204  }
205 
215  bool ContainsKeys(const std::set<K>& keys, IgniteError& err)
216  {
217  impl::InSetOperation<K> op(keys);
218 
219  return impl.Get()->ContainsKeys(op, err);
220  }
221 
235  V LocalPeek(const K& key, int32_t peekModes)
236  {
237  IgniteError err;
238 
239  V res = LocalPeek(key, peekModes, err);
240 
242 
243  return res;
244  }
245 
260  V LocalPeek(const K& key, int32_t peekModes, IgniteError& err)
261  {
262  impl::InCacheLocalPeekOperation<K> inOp(key, peekModes);
263  impl::Out1Operation<V> outOp;
264 
265  impl.Get()->LocalPeek(inOp, outOp, peekModes, err);
266 
267  return outOp.GetResult();
268  }
269 
282  V Get(const K& key)
283  {
284  IgniteError err;
285 
286  V res = Get(key, err);
287 
289 
290  return res;
291  }
292 
306  V Get(const K& key, IgniteError& err)
307  {
308  impl::In1Operation<K> inOp(key);
309  impl::Out1Operation<V> outOp;
310 
311  impl.Get()->Get(inOp, outOp, err);
312 
313  return outOp.GetResult();
314  }
315 
328  std::map<K, V> GetAll(const std::set<K>& keys)
329  {
330  IgniteError err;
331 
332  std::map<K, V> res = GetAll(keys, err);
333 
335 
336  return res;
337  }
338 
352  std::map<K, V> GetAll(const std::set<K>& keys, IgniteError& err)
353  {
354  impl::InSetOperation<K> inOp(keys);
355  impl::OutMapOperation<K, V> outOp;
356 
357  impl.Get()->GetAll(inOp, outOp, err);
358 
359  return outOp.GetResult();
360  }
361 
375  template<typename InIter, typename OutIter>
376  void GetAll(InIter begin, InIter end, OutIter dst)
377  {
378  IgniteError err;
379 
380  impl::InIterOperation<K, V, InIter> inOp(begin, end);
381  impl::OutMapIterOperation<K, V, OutIter> outOp(dst);
382 
383  impl.Get()->GetAll(inOp, outOp, err);
384 
386  }
387 
398  void Put(const K& key, const V& val)
399  {
400  IgniteError err;
401 
402  Put(key, val, err);
403 
405  }
406 
418  void Put(const K& key, const V& val, IgniteError& err)
419  {
420  impl::In2Operation<K, V> op(key, val);
421 
422  impl.Get()->Put(op, err);
423  }
424 
434  void PutAll(const std::map<K, V>& vals)
435  {
436  IgniteError err;
437 
438  PutAll(vals, err);
439 
441  }
442 
453  void PutAll(const std::map<K, V>& vals, IgniteError& err)
454  {
455  impl::InMapOperation<K, V> op(vals);
456 
457  impl.Get()->PutAll(op, err);
458  }
459 
470  template<typename Iter>
471  void PutAll(Iter begin, Iter end)
472  {
473  IgniteError err;
474 
475  impl::InIterOperation<K, V, Iter> op(begin, end);
476 
477  impl.Get()->PutAll(op, err);
478 
480  }
481 
493  V GetAndPut(const K& key, const V& val)
494  {
495  IgniteError err;
496 
497  V res = GetAndPut(key, val, err);
498 
500 
501  return res;
502  }
503 
516  V GetAndPut(const K& key, const V& val, IgniteError& err)
517  {
518  impl::In2Operation<K, V> inOp(key, val);
519  impl::Out1Operation<V> outOp;
520 
521  impl.Get()->GetAndPut(inOp, outOp, err);
522 
523  return outOp.GetResult();
524  }
525 
537  V GetAndReplace(const K& key, const V& val)
538  {
539  IgniteError err;
540 
541  V res = GetAndReplace(key, val, err);
542 
544 
545  return res;
546  }
547 
560  V GetAndReplace(const K& key, const V& val, IgniteError& err)
561  {
562  impl::In2Operation<K, V> inOp(key, val);
563  impl::Out1Operation<V> outOp;
564 
565  impl.Get()->GetAndReplace(inOp, outOp, err);
566 
567  return outOp.GetResult();
568  }
569 
578  V GetAndRemove(const K& key)
579  {
580  IgniteError err;
581 
582  V res = GetAndRemove(key, err);
583 
585 
586  return res;
587  }
588 
598  V GetAndRemove(const K& key, IgniteError& err)
599  {
600  impl::In1Operation<K> inOp(key);
601  impl::Out1Operation<V> outOp;
602 
603  impl.Get()->GetAndRemove(inOp, outOp, err);
604 
605  return outOp.GetResult();
606  }
607 
618  bool PutIfAbsent(const K& key, const V& val)
619  {
620  IgniteError err;
621 
622  bool res = PutIfAbsent(key, val, err);
623 
625 
626  return res;
627  }
628 
640  bool PutIfAbsent(const K& key, const V& val, IgniteError& err)
641  {
642  impl::In2Operation<K, V> op(key, val);
643 
644  return impl.Get()->PutIfAbsent(op, err);
645  }
646 
665  V GetAndPutIfAbsent(const K& key, const V& val)
666  {
667  IgniteError err;
668 
669  V res = GetAndPutIfAbsent(key, val, err);
670 
672 
673  return res;
674  }
675 
695  V GetAndPutIfAbsent(const K& key, const V& val, IgniteError& err)
696  {
697  impl::In2Operation<K, V> inOp(key, val);
698  impl::Out1Operation<V> outOp;
699 
700  impl.Get()->GetAndPutIfAbsent(inOp, outOp, err);
701 
702  return outOp.GetResult();
703  }
704 
720  bool Replace(const K& key, const V& val)
721  {
722  IgniteError err;
723 
724  bool res = Replace(key, val, err);
725 
727 
728  return res;
729  }
730 
747  bool Replace(const K& key, const V& val, IgniteError& err)
748  {
749  impl::In2Operation<K, V> op(key, val);
750 
751  return impl.Get()->Replace(op, err);
752  }
753 
766  bool Replace(const K& key, const V& oldVal, const V& newVal)
767  {
768  IgniteError err;
769 
770  bool res = Replace(key, oldVal, newVal, err);
771 
773 
774  return res;
775  }
776 
790  bool Replace(const K& key, const V& oldVal, const V& newVal, IgniteError& err)
791  {
792  impl::In3Operation<K, V, V> op(key, oldVal, newVal);
793 
794  return impl.Get()->ReplaceIfEqual(op, err);
795  }
796 
807  void LocalEvict(const std::set<K>& keys)
808  {
809  IgniteError err;
810 
811  LocalEvict(keys, err);
812 
814  }
815 
827  void LocalEvict(const std::set<K>& keys, IgniteError& err)
828  {
829  impl::InSetOperation<K> op(keys);
830 
831  impl.Get()->LocalEvict(op, err);
832  }
833 
845  template<typename Iter>
846  void LocalEvict(Iter begin, Iter end)
847  {
848  IgniteError err;
849 
850  impl::InIterOperation<K, V, Iter> op(begin, end);
851 
852  impl.Get()->LocalEvict(op, err);
853 
855  }
856 
862  void Clear()
863  {
864  IgniteError err;
865 
866  Clear(err);
867 
869  }
870 
878  void Clear(IgniteError& err)
879  {
880  impl.Get()->Clear(err);
881  }
882 
891  void Clear(const K& key)
892  {
893  IgniteError err;
894 
895  Clear(key, err);
896 
898  }
899 
909  void Clear(const K& key, IgniteError& err)
910  {
911  impl::In1Operation<K> op(key);
912 
913  impl.Get()->Clear(op, err);
914  }
915 
924  void ClearAll(const std::set<K>& keys)
925  {
926  IgniteError err;
927 
928  ClearAll(keys, err);
929 
931  }
932 
942  void ClearAll(const std::set<K>& keys, IgniteError& err)
943  {
944  impl::InSetOperation<K> op(keys);
945 
946  impl.Get()->ClearAll(op, err);
947  }
948 
958  template<typename Iter>
959  void ClearAll(Iter begin, Iter end)
960  {
961  IgniteError err;
962 
963  impl::InIterOperation<K, V, Iter> op(begin, end);
964 
965  impl.Get()->ClearAll(op, err);
966 
968  }
969 
981  void LocalClear(const K& key)
982  {
983  IgniteError err;
984 
985  LocalClear(key, err);
986 
988  }
989 
1002  void LocalClear(const K& key, IgniteError& err)
1003  {
1004  impl::In1Operation<K> op(key);
1005 
1006  impl.Get()->LocalClear(op, err);
1007  }
1008 
1020  void LocalClearAll(const std::set<K>& keys)
1021  {
1022  IgniteError err;
1023 
1024  LocalClearAll(keys, err);
1025 
1027  }
1028 
1041  void LocalClearAll(const std::set<K>& keys, IgniteError& err)
1042  {
1043  impl::InSetOperation<K> op(keys);
1044 
1045  impl.Get()->LocalClearAll(op, err);
1046  }
1047 
1060  template<typename Iter>
1061  void LocalClearAll(Iter begin, Iter end)
1062  {
1063  IgniteError err;
1064 
1065  impl::InIterOperation<K, V, Iter> op(begin, end);
1066 
1067  impl.Get()->LocalClearAll(op, err);
1068 
1070  }
1071 
1087  bool Remove(const K& key)
1088  {
1089  IgniteError err;
1090 
1091  bool res = Remove(key, err);
1092 
1094 
1095  return res;
1096  }
1097 
1114  bool Remove(const K& key, IgniteError& err)
1115  {
1116  impl::In1Operation<K> op(key);
1117 
1118  return impl.Get()->Remove(op, err);
1119  }
1120 
1132  bool Remove(const K& key, const V& val)
1133  {
1134  IgniteError err;
1135 
1136  bool res = Remove(key, val, err);
1137 
1139 
1140  return res;
1141  }
1142 
1155  bool Remove(const K& key, const V& val, IgniteError& err)
1156  {
1157  impl::In2Operation<K, V> op(key, val);
1158 
1159  return impl.Get()->RemoveIfEqual(op, err);
1160  }
1161 
1171  void RemoveAll(const std::set<K>& keys)
1172  {
1173  IgniteError err;
1174 
1175  RemoveAll(keys, err);
1176 
1178  }
1179 
1190  void RemoveAll(const std::set<K>& keys, IgniteError& err)
1191  {
1192  impl::InSetOperation<K> op(keys);
1193 
1194  impl.Get()->RemoveAll(op, err);
1195  }
1196 
1207  template<typename Iter>
1208  void RemoveAll(Iter begin, Iter end)
1209  {
1210  IgniteError err;
1211 
1212  impl::InIterOperation<K, V, Iter> op(begin, end);
1213 
1214  impl.Get()->RemoveAll(op, err);
1215 
1217  }
1218 
1227  void RemoveAll()
1228  {
1229  IgniteError err;
1230 
1231  RemoveAll(err);
1232 
1234  }
1235 
1246  {
1247  return impl.Get()->RemoveAll(err);
1248  }
1249 
1257  int32_t LocalSize()
1258  {
1259  return LocalSize(CachePeekMode::ALL);
1260  }
1261 
1270  int32_t LocalSize(IgniteError& err)
1271  {
1272  return LocalSize(CachePeekMode::ALL, err);
1273  }
1274 
1283  int32_t LocalSize(int32_t peekModes)
1284  {
1285  IgniteError err;
1286 
1287  int32_t res = LocalSize(peekModes, err);
1288 
1290 
1291  return res;
1292  }
1293 
1303  int32_t LocalSize(int32_t peekModes, IgniteError& err)
1304  {
1305  return impl.Get()->Size(peekModes, true, err);
1306  }
1307 
1316  int32_t Size()
1317  {
1318  return Size(ignite::cache::CachePeekMode::ALL);
1319  }
1320 
1330  int32_t Size(IgniteError& err)
1331  {
1332  return Size(ignite::cache::CachePeekMode::ALL, err);
1333  }
1334 
1344  int32_t Size(int32_t peekModes)
1345  {
1346  IgniteError err;
1347 
1348  int32_t res = Size(peekModes, err);
1349 
1351 
1352  return res;
1353  }
1354 
1365  int32_t Size(int32_t peekModes, IgniteError& err)
1366  {
1367  return impl.Get()->Size(peekModes, false, err);
1368  }
1369 
1379  {
1380  IgniteError err;
1381 
1382  query::QueryCursor<K, V> res = Query(qry, err);
1383 
1385 
1386  return res;
1387  }
1388 
1399  {
1400  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySql(qry, err);
1401 
1402  return query::QueryCursor<K, V>(cursorImpl);
1403  }
1404 
1414  {
1415  IgniteError err;
1416 
1417  query::QueryCursor<K, V> res = Query(qry, err);
1418 
1420 
1421  return res;
1422  }
1423 
1434  {
1435  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryText(qry, err);
1436 
1437  return query::QueryCursor<K, V>(cursorImpl);
1438  }
1439 
1449  {
1450  IgniteError err;
1451 
1452  query::QueryCursor<K, V> res = Query(qry, err);
1453 
1455 
1456  return res;
1457  }
1458 
1469  {
1470  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryScan(qry, err);
1471 
1472  return query::QueryCursor<K, V>(cursorImpl);
1473  }
1474 
1484  {
1485  IgniteError err;
1486 
1487  query::QueryFieldsCursor res = Query(qry, err);
1488 
1490 
1491  return res;
1492  }
1493 
1504  {
1505  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySqlFields(qry, err);
1506 
1507  return query::QueryFieldsCursor(cursorImpl);
1508  }
1509 
1551  template<typename R, typename P, typename A>
1552  R Invoke(const K& key, const P& processor, const A& arg)
1553  {
1554  IgniteError err;
1555 
1556  R res = Invoke<R>(key, processor, arg, err);
1557 
1559 
1560  return res;
1561  }
1562 
1605  template<typename R, typename P, typename A>
1606  R Invoke(const K& key, const P& processor, const A& arg, IgniteError& err)
1607  {
1608  typedef impl::cache::CacheEntryProcessorHolder<P, A> ProcessorHolder;
1609 
1610  ProcessorHolder procHolder(processor, arg);
1611 
1612  impl::In2Operation<K, ProcessorHolder> inOp(key, procHolder);
1613  impl::Out1Operation<R> outOp;
1614 
1615  impl.Get()->Invoke(inOp, outOp, err);
1616 
1617  return outOp.GetResult();
1618  }
1619 
1628  {
1629  IgniteError err;
1630 
1631  query::continuous::ContinuousQueryHandle<K, V> res = QueryContinuous(qry, err);
1632 
1634 
1635  return res;
1636  }
1637 
1647  {
1648  using namespace impl::cache::query::continuous;
1649  using namespace common::concurrent;
1650 
1651  const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
1652 
1653  if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
1654  {
1656  "Event listener is not set for ContinuousQuery instance");
1657 
1659  }
1660 
1661  ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, err);
1662 
1664  }
1665 
1673  template<typename Q>
1676  const Q& initialQry)
1677  {
1678  IgniteError err;
1679 
1680  query::continuous::ContinuousQueryHandle<K, V> res = QueryContinuous(qry, initialQry, err);
1681 
1683 
1684  return res;
1685  }
1686 
1695  template<typename Q>
1698  const Q& initialQry, IgniteError& err)
1699  {
1700  using namespace impl::cache::query::continuous;
1701  using namespace common::concurrent;
1702 
1703  const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
1704 
1705  if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
1706  {
1708  "Event listener is not set for ContinuousQuery instance");
1709 
1711  }
1712 
1713  ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, initialQry, err);
1714 
1716  }
1717 
1729  bool IsValid() const
1730  {
1731  return impl.IsValid();
1732  }
1733 
1737  void LoadCache()
1738  {
1739  IgniteError err;
1740 
1741  impl.Get()->LoadCache(err);
1742 
1744  }
1745 
1755  {
1756  IgniteError err;
1757 
1758  impl.Get()->LocalLoadCache(err);
1759 
1761  }
1762 
1763  private:
1765  common::concurrent::SharedPointer<impl::cache::CacheImpl> impl;
1766  };
1767  }
1768 }
1769 
1770 #endif //_IGNITE_CACHE_CACHE
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:1674
const char * GetName() const
Get name of this cache (null for default cache).
Definition: cache.h:91
query::QueryCursor< K, V > Query(const query::TextQuery &qry)
Perform text query.
Definition: cache.h:1413
void ClearAll(const std::set< K > &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:924
Text query.
Definition: query_text.h:40
void Clear()
Clear cache.
Definition: cache.h:862
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:516
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry, IgniteError &err)
Start continuous query execution.
Definition: cache.h:1645
int32_t LocalSize(int32_t peekModes)
Gets the number of all entries cached on this node.
Definition: cache.h:1283
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:1041
Declares ignite::cache::query::QueryCursor class template.
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:1606
void GetAll(InIter begin, InIter end, OutIter dst)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:376
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:1132
Declares ignite::cache::query::QueryFieldsCursor class.
Declares ignite::cache::query::SqlQuery class.
void Clear(const K &key)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:891
Main entry point for all Data Grid APIs.
Definition: cache.h:68
Declares ignite::cache::CachePeekMode enum.
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:1155
int32_t Size()
Gets the number of all entries cached across all nodes.
Definition: cache.h:1316
bool ContainsKeys(const std::set< K > &keys)
Check if cache contains mapping for these keys.
Definition: cache.h:172
void LocalClearAll(Iter begin, Iter end)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1061
query::QueryCursor< K, V > Query(const query::SqlQuery &qry)
Perform SQL query.
Definition: cache.h:1378
void Clear(const K &key, IgniteError &err)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:909
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:695
Cache(impl::cache::CacheImpl *impl)
Constructor.
Definition: cache.h:78
bool Remove(const K &key)
Removes given key mapping from cache.
Definition: cache.h:1087
bool IsEmpty(IgniteError &err)
Checks whether this cache contains no key-value mappings.
Definition: cache.h:124
Continuous query.
Definition: continuous_query.h:58
void Clear(IgniteError &err)
Clear cache.
Definition: cache.h:878
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry)
Start continuous query execution.
Definition: cache.h:1626
bool ContainsKeys(const std::set< K > &keys, IgniteError &err)
Check if cache contains mapping for these keys.
Definition: cache.h:215
void PutAll(Iter begin, Iter end)
Stores given key-value pairs in cache.
Definition: cache.h:471
V Get(const K &key, IgniteError &err)
Retrieves value mapped to the specified key from cache.
Definition: cache.h:306
void RemoveAll()
Removes all mappings from cache.
Definition: cache.h:1227
Scan query.
Definition: query_scan.h:40
Sql query.
Definition: query_sql.h:42
query::QueryCursor< K, V > Query(const query::ScanQuery &qry)
Perform scan query.
Definition: cache.h:1448
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:1552
query::QueryCursor< K, V > Query(const query::SqlQuery &qry, IgniteError &err)
Perform SQL query.
Definition: cache.h:1398
V GetAndRemove(const K &key, IgniteError &err)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache.h:598
V LocalPeek(const K &key, int32_t peekModes)
Peeks at cached value using optional set of peek modes.
Definition: cache.h:235
void RemoveAll(const std::set< K > &keys)
Removes given key mappings from cache.
Definition: cache.h:1171
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 pas...
Definition: cache.h:790
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:942
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:493
Sql fields query.
Definition: query_sql_fields.h:42
bool ContainsKey(const K &key)
Check if cache contains mapping for this key.
Definition: cache.h:137
Peeks into all available cache storages.
Definition: cache_peek_mode.h:40
void LocalClear(const K &key)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:981
int32_t Size(IgniteError &err)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1330
bool IsEmpty()
Checks whether this cache contains no key-value mappings.
Definition: cache.h:104
bool IsValid() const
Check if the instance is valid.
Definition: cache.h:1729
Continuous query handle.
Definition: continuous_query_handle.h:40
void RemoveAll(const std::set< K > &keys, IgniteError &err)
Removes given key mappings from cache.
Definition: cache.h:1190
void PutAll(const std::map< K, V > &vals)
Stores given key-value pairs in cache.
Definition: cache.h:434
void LocalEvict(const std::set< K > &keys, IgniteError &err)
Attempts to evict all entries associated with keys.
Definition: cache.h:827
V GetAndRemove(const K &key)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache.h:578
Query fields cursor.
Definition: query_fields_cursor.h:50
V Get(const K &key)
Retrieves value mapped to the specified key from cache.
Definition: cache.h:282
void Put(const K &key, const V &val)
Associates the specified value with the specified key in the cache.
Definition: cache.h:398
void LocalEvict(const std::set< K > &keys)
Attempts to evict all entries associated with keys.
Definition: cache.h:807
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:1696
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 pas...
Definition: cache.h:766
Declares ignite::cache::query::continuous::ContinuousQueryHandle class.
void LoadCache()
Executes LocalLoadCache on all cache nodes.
Definition: cache.h:1737
int32_t Size(int32_t peekModes, IgniteError &err)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1365
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:618
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:747
int32_t Size(int32_t peekModes)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1344
std::map< K, V > GetAll(const std::set< K > &keys)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:328
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:560
bool ContainsKey(const K &key, IgniteError &err)
Check if cache contains mapping for this key.
Definition: cache.h:157
void PutAll(const std::map< K, V > &vals, IgniteError &err)
Stores given key-value pairs in cache.
Definition: cache.h:453
Declares ignite::cache::query::continuous::ContinuousQuery class.
V LocalPeek(const K &key, int32_t peekModes, IgniteError &err)
Peeks at cached value using optional set of peek modes.
Definition: cache.h:260
int32_t LocalSize(IgniteError &err)
Gets the number of all entries cached on this node.
Definition: cache.h:1270
Declares ignite::cache::query::SqlFieldsQuery class.
Ignite error information.
Definition: ignite_error.h:94
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:665
void LocalClearAll(const std::set< K > &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1020
Declares ignite::cache::query::ScanQuery class.
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:640
void Put(const K &key, const V &val, IgniteError &err)
Associates the specified value with the specified key in the cache.
Definition: cache.h:418
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:537
void RemoveAll(Iter begin, Iter end)
Removes given key mappings from cache.
Definition: cache.h:1208
query::QueryCursor< K, V > Query(const query::ScanQuery &qry, IgniteError &err)
Perform scan query.
Definition: cache.h:1468
void LocalEvict(Iter begin, Iter end)
Attempts to evict all entries associated with keys.
Definition: cache.h:846
Apache Ignite API.
Definition: cache.h:48
query::QueryCursor< K, V > Query(const query::TextQuery &qry, IgniteError &err)
Perform text query.
Definition: cache.h:1433
Declares ignite::IgniteError class.
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry, IgniteError &err)
Perform sql fields query.
Definition: cache.h:1503
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:720
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry)
Perform sql fields query.
Definition: cache.h:1483
Query cursor class template.
Definition: query_cursor.h:54
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:27
void RemoveAll(IgniteError &err)
Removes all mappings from cache.
Definition: cache.h:1245
void ClearAll(Iter begin, Iter end)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:959
std::map< K, V > GetAll(const std::set< K > &keys, IgniteError &err)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:352
int32_t LocalSize()
Gets the number of all entries cached on this node.
Definition: cache.h:1257
static const int IGNITE_ERR_GENERIC
Generic Ignite error.
Definition: ignite_error.h:131
void LocalLoadCache()
Loads state from the underlying persistent storage.
Definition: cache.h:1754
bool Remove(const K &key, IgniteError &err)
Removes given key mapping from cache.
Definition: cache.h:1114
void LocalClear(const K &key, IgniteError &err)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1002
Declares ignite::cache::query::TextQuery class.
int32_t LocalSize(int32_t peekModes, IgniteError &err)
Gets the number of all entries cached on this node.
Definition: cache.h:1303
bool ContainsKeys(InputIter begin, InputIter end)
Check if cache contains mapping for these keys.
Definition: cache.h:193