| 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
33 #include <ignite/cache/cache_peek_mode.h>
34 #include <ignite/cache/query/query_cursor.h>
35 #include <ignite/cache/query/query_fields_cursor.h>
36 #include <ignite/cache/query/query_scan.h>
37 #include <ignite/cache/query/query_sql.h>
38 #include <ignite/cache/query/query_text.h>
39 #include <ignite/cache/query/query_sql_fields.h>
40 #include <ignite/cache/query/continuous/continuous_query_handle.h>
41 #include <ignite/cache/query/continuous/continuous_query.h>
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
110 IgniteError::ThrowIfNeeded(err);
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
143 IgniteError::ThrowIfNeeded(err);
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
178 IgniteError::ThrowIfNeeded(err);
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
201 IgniteError::ThrowIfNeeded(err);
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
241 IgniteError::ThrowIfNeeded(err);
242
243 return res;
244 }
245
260 V LocalPeek(const K& key, int32_t peekModes, IgniteError& err)
261 {
262 V val;
263
264 impl::InCacheLocalPeekOperation<K> inOp(key, peekModes);
265 impl::Out1Operation<V> outOp(val);
266
267 impl.Get()->LocalPeek(inOp, outOp, peekModes, err);
268
269 return val;
270 }
271
284 V Get(const K& key)
285 {
286 IgniteError err;
287
288 V res = Get(key, err);
289
290 IgniteError::ThrowIfNeeded(err);
291
292 return res;
293 }
294
308 V Get(const K& key, IgniteError& err)
309 {
310 V val;
311 impl::In1Operation<K> inOp(key);
312 impl::Out1Operation<V> outOp(val);
313
314 impl.Get()->Get(inOp, outOp, err);
315
316 return val;
317 }
318
331 std::map<K, V> GetAll(const std::set<K>& keys)
332 {
333 IgniteError err;
334
335 std::map<K, V> res = GetAll(keys, err);
336
337 IgniteError::ThrowIfNeeded(err);
338
339 return res;
340 }
341
355 std::map<K, V> GetAll(const std::set<K>& keys, IgniteError& err)
356 {
357 std::map<K, V> res;
358
359 impl::InSetOperation<K> inOp(keys);
360 impl::OutMapOperation<K, V> outOp(res);
361
362 impl.Get()->GetAll(inOp, outOp, err);
363
364 return res;
365 }
366
380 template<typename InIter, typename OutIter>
381 void GetAll(InIter begin, InIter end, OutIter dst)
382 {
383 IgniteError err;
384
385 impl::InIterOperation<K, V, InIter> inOp(begin, end);
386 impl::OutMapIterOperation<K, V, OutIter> outOp(dst);
387
388 impl.Get()->GetAll(inOp, outOp, err);
389
390 IgniteError::ThrowIfNeeded(err);
391 }
392
403 void Put(const K& key, const V& val)
404 {
405 IgniteError err;
406
407 Put(key, val, err);
408
409 IgniteError::ThrowIfNeeded(err);
410 }
411
423 void Put(const K& key, const V& val, IgniteError& err)
424 {
425 impl::In2Operation<K, V> op(key, val);
426
427 impl.Get()->Put(op, err);
428 }
429
439 void PutAll(const std::map<K, V>& vals)
440 {
441 IgniteError err;
442
443 PutAll(vals, err);
444
445 IgniteError::ThrowIfNeeded(err);
446 }
447
458 void PutAll(const std::map<K, V>& vals, IgniteError& err)
459 {
460 impl::InMapOperation<K, V> op(vals);
461
462 impl.Get()->PutAll(op, err);
463 }
464
478 template<typename Iter>
479 void PutAll(Iter begin, Iter end)
480 {
481 IgniteError err;
482
483 impl::InIterOperation<K, V, Iter> op(begin, end);
484
485 impl.Get()->PutAll(op, err);
486
487 IgniteError::ThrowIfNeeded(err);
488 }
489
501 V GetAndPut(const K& key, const V& val)
502 {
503 IgniteError err;
504
505 V res = GetAndPut(key, val, err);
506
507 IgniteError::ThrowIfNeeded(err);
508
509 return res;
510 }
511
524 V GetAndPut(const K& key, const V& val, IgniteError& err)
525 {
526 V oldVal;
527
528 impl::In2Operation<K, V> inOp(key, val);
529 impl::Out1Operation<V> outOp(oldVal);
530
531 impl.Get()->GetAndPut(inOp, outOp, err);
532
533 return oldVal;
534 }
535
547 V GetAndReplace(const K& key, const V& val)
548 {
549 IgniteError err;
550
551 V res = GetAndReplace(key, val, err);
552
553 IgniteError::ThrowIfNeeded(err);
554
555 return res;
556 }
557
570 V GetAndReplace(const K& key, const V& val, IgniteError& err)
571 {
572 V oldVal;
573
574 impl::In2Operation<K, V> inOp(key, val);
575 impl::Out1Operation<V> outOp(oldVal);
576
577 impl.Get()->GetAndReplace(inOp, outOp, err);
578
579 return oldVal;
580 }
581
590 V GetAndRemove(const K& key)
591 {
592 IgniteError err;
593
594 V res = GetAndRemove(key, err);
595
596 IgniteError::ThrowIfNeeded(err);
597
598 return res;
599 }
600
610 V GetAndRemove(const K& key, IgniteError& err)
611 {
612 V oldVal;
613
614 impl::In1Operation<K> inOp(key);
615 impl::Out1Operation<V> outOp(oldVal);
616
617 impl.Get()->GetAndRemove(inOp, outOp, err);
618
619 return oldVal;
620 }
621
632 bool PutIfAbsent(const K& key, const V& val)
633 {
634 IgniteError err;
635
636 bool res = PutIfAbsent(key, val, err);
637
638 IgniteError::ThrowIfNeeded(err);
639
640 return res;
641 }
642
654 bool PutIfAbsent(const K& key, const V& val, IgniteError& err)
655 {
656 impl::In2Operation<K, V> op(key, val);
657
658 return impl.Get()->PutIfAbsent(op, err);
659 }
660
679 V GetAndPutIfAbsent(const K& key, const V& val)
680 {
681 IgniteError err;
682
683 V res = GetAndPutIfAbsent(key, val, err);
684
685 IgniteError::ThrowIfNeeded(err);
686
687 return res;
688 }
689
709 V GetAndPutIfAbsent(const K& key, const V& val, IgniteError& err)
710 {
711 V oldVal;
712
713 impl::In2Operation<K, V> inOp(key, val);
714 impl::Out1Operation<V> outOp(oldVal);
715
716 impl.Get()->GetAndPutIfAbsent(inOp, outOp, err);
717
718 return oldVal;
719 }
720
736 bool Replace(const K& key, const V& val)
737 {
738 IgniteError err;
739
740 bool res = Replace(key, val, err);
741
742 IgniteError::ThrowIfNeeded(err);
743
744 return res;
745 }
746
763 bool Replace(const K& key, const V& val, IgniteError& err)
764 {
765 impl::In2Operation<K, V> op(key, val);
766
767 return impl.Get()->Replace(op, err);
768 }
769
782 bool Replace(const K& key, const V& oldVal, const V& newVal)
783 {
784 IgniteError err;
785
786 bool res = Replace(key, oldVal, newVal, err);
787
788 IgniteError::ThrowIfNeeded(err);
789
790 return res;
791 }
792
806 bool Replace(const K& key, const V& oldVal, const V& newVal, IgniteError& err)
807 {
808 impl::In3Operation<K, V, V> op(key, oldVal, newVal);
809
810 return impl.Get()->ReplaceIfEqual(op, err);
811 }
812
823 void LocalEvict(const std::set<K>& keys)
824 {
825 IgniteError err;
826
827 LocalEvict(keys, err);
828
829 IgniteError::ThrowIfNeeded(err);
830 }
831
843 void LocalEvict(const std::set<K>& keys, IgniteError& err)
844 {
845 impl::InSetOperation<K> op(keys);
846
847 impl.Get()->LocalEvict(op, err);
848 }
849
861 template<typename Iter>
862 void LocalEvict(Iter begin, Iter end)
863 {
864 IgniteError err;
865
866 impl::InIterOperation<K, V, Iter> op(begin, end);
867
868 impl.Get()->LocalEvict(op, err);
869
870 IgniteError::ThrowIfNeeded(err);
871 }
872
878 void Clear()
879 {
880 IgniteError err;
881
882 Clear(err);
883
884 IgniteError::ThrowIfNeeded(err);
885 }
886
894 void Clear(IgniteError& err)
895 {
896 impl.Get()->Clear(err);
897 }
898
907 void Clear(const K& key)
908 {
909 IgniteError err;
910
911 Clear(key, err);
912
913 IgniteError::ThrowIfNeeded(err);
914 }
915
925 void Clear(const K& key, IgniteError& err)
926 {
927 impl::In1Operation<K> op(key);
928
929 impl.Get()->Clear(op, err);
930 }
931
940 void ClearAll(const std::set<K>& keys)
941 {
942 IgniteError err;
943
944 ClearAll(keys, err);
945
946 IgniteError::ThrowIfNeeded(err);
947 }
948
958 void ClearAll(const std::set<K>& keys, IgniteError& err)
959 {
960 impl::InSetOperation<K> op(keys);
961
962 impl.Get()->ClearAll(op, err);
963 }
964
974 template<typename Iter>
975 void ClearAll(Iter begin, Iter end)
976 {
977 IgniteError err;
978
979 impl::InIterOperation<K, V, Iter> op(begin, end);
980
981 impl.Get()->ClearAll(op, err);
982
983 IgniteError::ThrowIfNeeded(err);
984 }
985
997 void LocalClear(const K& key)
998 {
999 IgniteError err;
1000
1001 LocalClear(key, err);
1002
1003 IgniteError::ThrowIfNeeded(err);
1004 }
1005
1018 void LocalClear(const K& key, IgniteError& err)
1019 {
1020 impl::In1Operation<K> op(key);
1021
1022 impl.Get()->LocalClear(op, err);
1023 }
1024
1036 void LocalClearAll(const std::set<K>& keys)
1037 {
1038 IgniteError err;
1039
1040 LocalClearAll(keys, err);
1041
1042 IgniteError::ThrowIfNeeded(err);
1043 }
1044
1057 void LocalClearAll(const std::set<K>& keys, IgniteError& err)
1058 {
1059 impl::InSetOperation<K> op(keys);
1060
1061 impl.Get()->LocalClearAll(op, err);
1062 }
1063
1076 template<typename Iter>
1077 void LocalClearAll(Iter begin, Iter end)
1078 {
1079 IgniteError err;
1080
1081 impl::InIterOperation<K, V, Iter> op(begin, end);
1082
1083 impl.Get()->LocalClearAll(op, err);
1084
1085 IgniteError::ThrowIfNeeded(err);
1086 }
1087
1103 bool Remove(const K& key)
1104 {
1105 IgniteError err;
1106
1107 bool res = Remove(key, err);
1108
1109 IgniteError::ThrowIfNeeded(err);
1110
1111 return res;
1112 }
1113
1130 bool Remove(const K& key, IgniteError& err)
1131 {
1132 impl::In1Operation<K> op(key);
1133
1134 return impl.Get()->Remove(op, err);
1135 }
1136
1148 bool Remove(const K& key, const V& val)
1149 {
1150 IgniteError err;
1151
1152 bool res = Remove(key, val, err);
1153
1154 IgniteError::ThrowIfNeeded(err);
1155
1156 return res;
1157 }
1158
1171 bool Remove(const K& key, const V& val, IgniteError& err)
1172 {
1173 impl::In2Operation<K, V> op(key, val);
1174
1175 return impl.Get()->RemoveIfEqual(op, err);
1176 }
1177
1187 void RemoveAll(const std::set<K>& keys)
1188 {
1189 IgniteError err;
1190
1191 RemoveAll(keys, err);
1192
1193 IgniteError::ThrowIfNeeded(err);
1194 }
1195
1206 void RemoveAll(const std::set<K>& keys, IgniteError& err)
1207 {
1208 impl::InSetOperation<K> op(keys);
1209
1210 impl.Get()->RemoveAll(op, err);
1211 }
1212
1226 template<typename Iter>
1227 void RemoveAll(Iter begin, Iter end)
1228 {
1229 IgniteError err;
1230
1231 impl::InIterOperation<K, V, Iter> op(begin, end);
1232
1233 impl.Get()->RemoveAll(op, err);
1234
1235 IgniteError::ThrowIfNeeded(err);
1236 }
1237
1246 void RemoveAll()
1247 {
1248 IgniteError err;
1249
1250 RemoveAll(err);
1251
1252 IgniteError::ThrowIfNeeded(err);
1253 }
1254
1264 void RemoveAll(IgniteError& err)
1265 {
1266 return impl.Get()->RemoveAll(err);
1267 }
1268
1276 int32_t LocalSize()
1277 {
1278 return LocalSize(CachePeekMode::ALL);
1279 }
1280
1289 int32_t LocalSize(IgniteError& err)
1290 {
1291 return LocalSize(CachePeekMode::ALL, err);
1292 }
1293
1302 int32_t LocalSize(int32_t peekModes)
1303 {
1304 IgniteError err;
1305
1306 int32_t res = LocalSize(peekModes, err);
1307
1308 IgniteError::ThrowIfNeeded(err);
1309
1310 return res;
1311 }
1312
1322 int32_t LocalSize(int32_t peekModes, IgniteError& err)
1323 {
1324 return impl.Get()->Size(peekModes, true, err);
1325 }
1326
1335 int32_t Size()
1336 {
1337 return Size(ignite::cache::CachePeekMode::ALL);
1338 }
1339
1349 int32_t Size(IgniteError& err)
1350 {
1351 return Size(ignite::cache::CachePeekMode::ALL, err);
1352 }
1353
1363 int32_t Size(int32_t peekModes)
1364 {
1365 IgniteError err;
1366
1367 int32_t res = Size(peekModes, err);
1368
1369 IgniteError::ThrowIfNeeded(err);
1370
1371 return res;
1372 }
1373
1384 int32_t Size(int32_t peekModes, IgniteError& err)
1385 {
1386 return impl.Get()->Size(peekModes, false, err);
1387 }
1388
1398 query::QueryCursor<K, V> Query(const query::SqlQuery& qry)
1399 {
1400 IgniteError err;
1401
1402 query::QueryCursor<K, V> res = Query(qry, err);
1403
1404 IgniteError::ThrowIfNeeded(err);
1405
1406 return res;
1407 }
1408
1418 query::QueryCursor<K, V> Query(const query::SqlQuery& qry, IgniteError& err)
1419 {
1420 impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySql(qry, err);
1421
1422 return query::QueryCursor<K, V>(cursorImpl);
1423 }
1424
1433 query::QueryCursor<K, V> Query(const query::TextQuery& qry)
1434 {
1435 IgniteError err;
1436
1437 query::QueryCursor<K, V> res = Query(qry, err);
1438
1439 IgniteError::ThrowIfNeeded(err);
1440
1441 return res;
1442 }
1443
1453 query::QueryCursor<K, V> Query(const query::TextQuery& qry, IgniteError& err)
1454 {
1455 impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryText(qry, err);
1456
1457 return query::QueryCursor<K, V>(cursorImpl);
1458 }
1459
1468 query::QueryCursor<K, V> Query(const query::ScanQuery& qry)
1469 {
1470 IgniteError err;
1471
1472 query::QueryCursor<K, V> res = Query(qry, err);
1473
1474 IgniteError::ThrowIfNeeded(err);
1475
1476 return res;
1477 }
1478
1488 query::QueryCursor<K, V> Query(const query::ScanQuery& qry, IgniteError& err)
1489 {
1490 impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryScan(qry, err);
1491
1492 return query::QueryCursor<K, V>(cursorImpl);
1493 }
1494
1503 query::QueryFieldsCursor Query(const query::SqlFieldsQuery& qry)
1504 {
1505 IgniteError err;
1506
1507 query::QueryFieldsCursor res = Query(qry, err);
1508
1509 IgniteError::ThrowIfNeeded(err);
1510
1511 return res;
1512 }
1513
1523 query::QueryFieldsCursor Query(const query::SqlFieldsQuery& qry, IgniteError& err)
1524 {
1525 impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySqlFields(qry, err);
1526
1527 return query::QueryFieldsCursor(cursorImpl);
1528 }
1529
1571 template<typename R, typename P, typename A>
1572 R Invoke(const K& key, const P& processor, const A& arg)
1573 {
1574 IgniteError err;
1575
1576 R res = Invoke<R>(key, processor, arg, err);
1577
1578 IgniteError::ThrowIfNeeded(err);
1579
1580 return res;
1581 }
1582
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
1647 query::continuous::ContinuousQueryHandle<K, V> QueryContinuous(
1648 const query::continuous::ContinuousQuery<K, V>& qry)
1649 {
1650 IgniteError err;
1651
1652 query::continuous::ContinuousQueryHandle<K, V> res = QueryContinuous(qry, err);
1653
1654 IgniteError::ThrowIfNeeded(err);
1655
1656 return res;
1657 }
1658
1666 query::continuous::ContinuousQueryHandle<K, V> QueryContinuous(
1667 const query::continuous::ContinuousQuery<K, V>& qry, IgniteError& err)
1668 {
1669 using namespace impl::cache::query::continuous;
1670 using namespace common::concurrent;
1671
1672 const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
1673
1674 if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
1675 {
1676 err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
1677 "Event listener is not set for ContinuousQuery instance");
1678
1679 return query::continuous::ContinuousQueryHandle<K, V>();
1680 }
1681
1682 ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, err);
1683
1684 return query::continuous::ContinuousQueryHandle<K, V>(cqImpl);
1685 }
1686
1694 template<typename Q>
1695 query::continuous::ContinuousQueryHandle<K, V> QueryContinuous(
1696 const query::continuous::ContinuousQuery<K, V>& qry,
1697 const Q& initialQry)
1698 {
1699 IgniteError err;
1700
1701 query::continuous::ContinuousQueryHandle<K, V> res = QueryContinuous(qry, initialQry, err);
1702
1703 IgniteError::ThrowIfNeeded(err);
1704
1705 return res;
1706 }
1707
1716 template<typename Q>
1717 query::continuous::ContinuousQueryHandle<K, V> QueryContinuous(
1718 const query::continuous::ContinuousQuery<K, V>& qry,
1719 const Q& initialQry, IgniteError& err)
1720 {
1721 using namespace impl::cache::query::continuous;
1722 using namespace common::concurrent;
1723
1724 const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
1725
1726 if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
1727 {
1728 err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
1729 "Event listener is not set for ContinuousQuery instance");
1730
1731 return query::continuous::ContinuousQueryHandle<K, V>();
1732 }
1733
1734 ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, initialQry, err);
1735
1736 return query::continuous::ContinuousQueryHandle<K, V>(cqImpl);
1737 }
1738
1750 bool IsValid() const
1751 {
1752 return impl.IsValid();
1753 }
1754
1758 void LoadCache()
1759 {
1760 IgniteError err;
1761
1762 impl.Get()->LoadCache(err);
1763
1764 IgniteError::ThrowIfNeeded(err);
1765 }
1766
1775 void LocalLoadCache()
1776 {
1777 IgniteError err;
1778
1779 impl.Get()->LocalLoadCache(err);
1780
1781 IgniteError::ThrowIfNeeded(err);
1782 }
1783
1784 private:
1786 common::concurrent::SharedPointer<impl::cache::CacheImpl> impl;
1787 };
1788 }
1789 }
1790
1791 #endif //_IGNITE_CACHE_CACHE
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:1695
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::TextQuery &qry)
Perform text query.
Definition: cache.h:1433
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:940
ignite::cache::query::TextQuery
Text query.
Definition: query_text.h:40
ignite::cache::Cache::Clear
void Clear()
Clear cache.
Definition: cache.h:878
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:524
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:1666
ignite::cache::Cache::LocalSize
int32_t LocalSize(int32_t peekModes)
Gets the number of all entries cached on this node.
Definition: cache.h:1302
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:1057
query_cursor.h
Declares ignite::cache::query::QueryCursor class template.
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
ignite::cache::Cache::GetAll
void GetAll(InIter begin, InIter end, OutIter dst)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:381
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:1148
query_fields_cursor.h
Declares ignite::cache::query::QueryFieldsCursor class.
query_sql.h
Declares ignite::cache::query::SqlQuery class.
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:907
ignite::cache::Cache
Main entry point for all Data Grid APIs.
Definition: cache.h:68
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:1171
ignite::cache::Cache::Size
int32_t Size()
Gets the number of all entries cached across all nodes.
Definition: cache.h:1335
ignite::cache::Cache::ContainsKeys
bool ContainsKeys(const std::set< K > &keys)
Check if cache contains mapping for these keys.
Definition: cache.h:172
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:1077
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::SqlQuery &qry)
Perform SQL query.
Definition: cache.h:1398
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:925
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:709
ignite::cache::Cache::Cache
Cache(impl::cache::CacheImpl *impl)
Constructor.
Definition: cache.h:78
ignite::cache::Cache::Remove
bool Remove(const K &key)
Removes given key mapping from cache.
Definition: cache.h:1103
ignite::cache::Cache::IsEmpty
bool IsEmpty(IgniteError &err)
Checks whether this cache contains no key-value mappings.
Definition: cache.h:124
ignite::cache::query::continuous::ContinuousQuery
Continuous query.
Definition: continuous_query.h:58
ignite::cache::Cache::Clear
void Clear(IgniteError &err)
Clear cache.
Definition: cache.h:894
ignite::cache::Cache::QueryContinuous
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry)
Start continuous query execution.
Definition: cache.h:1647
cache_peek_mode.h
Declares ignite::cache::CachePeekMode enum.
ignite::cache::Cache::ContainsKeys
bool ContainsKeys(const std::set< K > &keys, IgniteError &err)
Check if cache contains mapping for these keys.
Definition: cache.h:215
ignite::cache::Cache::PutAll
void PutAll(Iter begin, Iter end)
Stores given key-value pairs in cache.
Definition: cache.h:479
ignite::cache::Cache::Get
V Get(const K &key, IgniteError &err)
Retrieves value mapped to the specified key from cache.
Definition: cache.h:308
ignite::cache::Cache::RemoveAll
void RemoveAll()
Removes all mappings from cache.
Definition: cache.h:1246
ignite::cache::query::ScanQuery
Scan query.
Definition: query_scan.h:40
ignite::cache::query::SqlQuery
Sql query.
Definition: query_sql.h:44
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::ScanQuery &qry)
Perform scan query.
Definition: cache.h:1468
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:1572
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::SqlQuery &qry, IgniteError &err)
Perform SQL query.
Definition: cache.h:1418
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:610
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:235
ignite::cache::Cache::RemoveAll
void RemoveAll(const std::set< K > &keys)
Removes given key mappings from cache.
Definition: cache.h:1187
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:806
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:958
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:501
ignite::cache::query::SqlFieldsQuery
Sql fields query.
Definition: query_sql_fields.h:42
ignite::cache::Cache::ContainsKey
bool ContainsKey(const K &key)
Check if cache contains mapping for this key.
Definition: cache.h:137
ignite::cache::CachePeekMode::ALL
Peeks into all available cache storages.
Definition: core/include/ignite/cache/cache_peek_mode.h:40
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:997
ignite::cache::Cache::Size
int32_t Size(IgniteError &err)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1349
ignite::cache::Cache::IsEmpty
bool IsEmpty()
Checks whether this cache contains no key-value mappings.
Definition: cache.h:104
ignite::cache::query::continuous::ContinuousQueryHandle
Continuous query handle.
Definition: continuous_query_handle.h:40
ignite::cache::Cache::RemoveAll
void RemoveAll(const std::set< K > &keys, IgniteError &err)
Removes given key mappings from cache.
Definition: cache.h:1206
ignite::cache::Cache::PutAll
void PutAll(const std::map< K, V > &vals)
Stores given key-value pairs in cache.
Definition: cache.h:439
ignite::cache::Cache::LocalEvict
void LocalEvict(const std::set< K > &keys, IgniteError &err)
Attempts to evict all entries associated with keys.
Definition: cache.h:843
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:590
ignite::cache::query::QueryFieldsCursor
Query fields cursor.
Definition: query_fields_cursor.h:50
ignite::cache::Cache::Get
V Get(const K &key)
Retrieves value mapped to the specified key from cache.
Definition: cache.h:284
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:403
ignite::cache::Cache::LocalEvict
void LocalEvict(const std::set< K > &keys)
Attempts to evict all entries associated with keys.
Definition: cache.h:823
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:1717
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:782
continuous_query_handle.h
Declares ignite::cache::query::continuous::ContinuousQueryHandle class.
ignite::cache::Cache::LoadCache
void LoadCache()
Executes LocalLoadCache on all cache nodes.
Definition: cache.h:1758
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:1384
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:632
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:763
ignite::cache::Cache::Size
int32_t Size(int32_t peekModes)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1363
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:331
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:570
ignite::cache::Cache::ContainsKey
bool ContainsKey(const K &key, IgniteError &err)
Check if cache contains mapping for this key.
Definition: cache.h:157
ignite::cache::Cache::PutAll
void PutAll(const std::map< K, V > &vals, IgniteError &err)
Stores given key-value pairs in cache.
Definition: cache.h:458
continuous_query.h
Declares ignite::cache::query::continuous::ContinuousQuery class.
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:260
ignite::cache::Cache::LocalSize
int32_t LocalSize(IgniteError &err)
Gets the number of all entries cached on this node.
Definition: cache.h:1289
query_sql_fields.h
Declares ignite::cache::query::SqlFieldsQuery class.
ignite::IgniteError
Ignite error information.
Definition: ignite_error.h:94
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:679
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:1036
query_scan.h
Declares ignite::cache::query::ScanQuery class.
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:654
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:423
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:547
ignite::cache::Cache::RemoveAll
void RemoveAll(Iter begin, Iter end)
Removes given key mappings from cache.
Definition: cache.h:1227
ignite::cache::Cache::GetName
const char * GetName() const
Get name of this cache (null for default cache).
Definition: cache.h:91
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::ScanQuery &qry, IgniteError &err)
Perform scan query.
Definition: cache.h:1488
ignite::cache::Cache::LocalEvict
void LocalEvict(Iter begin, Iter end)
Attempts to evict all entries associated with keys.
Definition: cache.h:862
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::cache::Cache::Query
query::QueryCursor< K, V > Query(const query::TextQuery &qry, IgniteError &err)
Perform text query.
Definition: cache.h:1453
ignite_error.h
Declares ignite::IgniteError class.
ignite::cache::Cache::Query
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry, IgniteError &err)
Perform sql fields query.
Definition: cache.h:1523
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:736
ignite::cache::Cache::Query
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry)
Perform sql fields query.
Definition: cache.h:1503
ignite::cache::query::QueryCursor
Query cursor class template.
Definition: query_cursor.h:54
ignite::IgniteError::ThrowIfNeeded
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:27
ignite::cache::Cache::RemoveAll
void RemoveAll(IgniteError &err)
Removes all mappings from cache.
Definition: cache.h:1264
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:975
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:355
ignite::cache::Cache::LocalSize
int32_t LocalSize()
Gets the number of all entries cached on this node.
Definition: cache.h:1276
ignite::IgniteError::IGNITE_ERR_GENERIC
static const int IGNITE_ERR_GENERIC
Generic Ignite error.
Definition: ignite_error.h:131
ignite::cache::Cache::LocalLoadCache
void LocalLoadCache()
Loads state from the underlying persistent storage.
Definition: cache.h:1775
ignite::cache::Cache::Remove
bool Remove(const K &key, IgniteError &err)
Removes given key mapping from cache.
Definition: cache.h:1130
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:1018
query_text.h
Declares ignite::cache::query::TextQuery class.
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:1322
ignite::cache::Cache::IsValid
bool IsValid() const
Check if the instance is valid.
Definition: cache.h:1750
ignite::cache::Cache::ContainsKeys
bool ContainsKeys(InputIter begin, InputIter end)
Check if cache contains mapping for these keys.
Definition: cache.h:193