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  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 
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 
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 
391  }
392 
403  void Put(const K& key, const V& val)
404  {
405  IgniteError err;
406 
407  Put(key, val, err);
408 
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 
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 
475  template<typename Iter>
476  void PutAll(Iter begin, Iter end)
477  {
478  IgniteError err;
479 
480  impl::InIterOperation<K, V, Iter> op(begin, end);
481 
482  impl.Get()->PutAll(op, err);
483 
485  }
486 
498  V GetAndPut(const K& key, const V& val)
499  {
500  IgniteError err;
501 
502  V res = GetAndPut(key, val, err);
503 
505 
506  return res;
507  }
508 
521  V GetAndPut(const K& key, const V& val, IgniteError& err)
522  {
523  V oldVal;
524 
525  impl::In2Operation<K, V> inOp(key, val);
526  impl::Out1Operation<V> outOp(oldVal);
527 
528  impl.Get()->GetAndPut(inOp, outOp, err);
529 
530  return oldVal;
531  }
532 
544  V GetAndReplace(const K& key, const V& val)
545  {
546  IgniteError err;
547 
548  V res = GetAndReplace(key, val, err);
549 
551 
552  return res;
553  }
554 
567  V GetAndReplace(const K& key, const V& val, IgniteError& err)
568  {
569  V oldVal;
570 
571  impl::In2Operation<K, V> inOp(key, val);
572  impl::Out1Operation<V> outOp(oldVal);
573 
574  impl.Get()->GetAndReplace(inOp, outOp, err);
575 
576  return oldVal;
577  }
578 
587  V GetAndRemove(const K& key)
588  {
589  IgniteError err;
590 
591  V res = GetAndRemove(key, err);
592 
594 
595  return res;
596  }
597 
607  V GetAndRemove(const K& key, IgniteError& err)
608  {
609  V oldVal;
610 
611  impl::In1Operation<K> inOp(key);
612  impl::Out1Operation<V> outOp(oldVal);
613 
614  impl.Get()->GetAndRemove(inOp, outOp, err);
615 
616  return oldVal;
617  }
618 
629  bool PutIfAbsent(const K& key, const V& val)
630  {
631  IgniteError err;
632 
633  bool res = PutIfAbsent(key, val, err);
634 
636 
637  return res;
638  }
639 
651  bool PutIfAbsent(const K& key, const V& val, IgniteError& err)
652  {
653  impl::In2Operation<K, V> op(key, val);
654 
655  return impl.Get()->PutIfAbsent(op, err);
656  }
657 
676  V GetAndPutIfAbsent(const K& key, const V& val)
677  {
678  IgniteError err;
679 
680  V res = GetAndPutIfAbsent(key, val, err);
681 
683 
684  return res;
685  }
686 
706  V GetAndPutIfAbsent(const K& key, const V& val, IgniteError& err)
707  {
708  V oldVal;
709 
710  impl::In2Operation<K, V> inOp(key, val);
711  impl::Out1Operation<V> outOp(oldVal);
712 
713  impl.Get()->GetAndPutIfAbsent(inOp, outOp, err);
714 
715  return oldVal;
716  }
717 
733  bool Replace(const K& key, const V& val)
734  {
735  IgniteError err;
736 
737  bool res = Replace(key, val, err);
738 
740 
741  return res;
742  }
743 
760  bool Replace(const K& key, const V& val, IgniteError& err)
761  {
762  impl::In2Operation<K, V> op(key, val);
763 
764  return impl.Get()->Replace(op, err);
765  }
766 
779  bool Replace(const K& key, const V& oldVal, const V& newVal)
780  {
781  IgniteError err;
782 
783  bool res = Replace(key, oldVal, newVal, err);
784 
786 
787  return res;
788  }
789 
803  bool Replace(const K& key, const V& oldVal, const V& newVal, IgniteError& err)
804  {
805  impl::In3Operation<K, V, V> op(key, oldVal, newVal);
806 
807  return impl.Get()->ReplaceIfEqual(op, err);
808  }
809 
820  void LocalEvict(const std::set<K>& keys)
821  {
822  IgniteError err;
823 
824  LocalEvict(keys, err);
825 
827  }
828 
840  void LocalEvict(const std::set<K>& keys, IgniteError& err)
841  {
842  impl::InSetOperation<K> op(keys);
843 
844  impl.Get()->LocalEvict(op, err);
845  }
846 
858  template<typename Iter>
859  void LocalEvict(Iter begin, Iter end)
860  {
861  IgniteError err;
862 
863  impl::InIterOperation<K, V, Iter> op(begin, end);
864 
865  impl.Get()->LocalEvict(op, err);
866 
868  }
869 
875  void Clear()
876  {
877  IgniteError err;
878 
879  Clear(err);
880 
882  }
883 
891  void Clear(IgniteError& err)
892  {
893  impl.Get()->Clear(err);
894  }
895 
904  void Clear(const K& key)
905  {
906  IgniteError err;
907 
908  Clear(key, err);
909 
911  }
912 
922  void Clear(const K& key, IgniteError& err)
923  {
924  impl::In1Operation<K> op(key);
925 
926  impl.Get()->Clear(op, err);
927  }
928 
937  void ClearAll(const std::set<K>& keys)
938  {
939  IgniteError err;
940 
941  ClearAll(keys, err);
942 
944  }
945 
955  void ClearAll(const std::set<K>& keys, IgniteError& err)
956  {
957  impl::InSetOperation<K> op(keys);
958 
959  impl.Get()->ClearAll(op, err);
960  }
961 
971  template<typename Iter>
972  void ClearAll(Iter begin, Iter end)
973  {
974  IgniteError err;
975 
976  impl::InIterOperation<K, V, Iter> op(begin, end);
977 
978  impl.Get()->ClearAll(op, err);
979 
981  }
982 
994  void LocalClear(const K& key)
995  {
996  IgniteError err;
997 
998  LocalClear(key, err);
999 
1001  }
1002 
1015  void LocalClear(const K& key, IgniteError& err)
1016  {
1017  impl::In1Operation<K> op(key);
1018 
1019  impl.Get()->LocalClear(op, err);
1020  }
1021 
1033  void LocalClearAll(const std::set<K>& keys)
1034  {
1035  IgniteError err;
1036 
1037  LocalClearAll(keys, err);
1038 
1040  }
1041 
1054  void LocalClearAll(const std::set<K>& keys, IgniteError& err)
1055  {
1056  impl::InSetOperation<K> op(keys);
1057 
1058  impl.Get()->LocalClearAll(op, err);
1059  }
1060 
1073  template<typename Iter>
1074  void LocalClearAll(Iter begin, Iter end)
1075  {
1076  IgniteError err;
1077 
1078  impl::InIterOperation<K, V, Iter> op(begin, end);
1079 
1080  impl.Get()->LocalClearAll(op, err);
1081 
1083  }
1084 
1100  bool Remove(const K& key)
1101  {
1102  IgniteError err;
1103 
1104  bool res = Remove(key, err);
1105 
1107 
1108  return res;
1109  }
1110 
1127  bool Remove(const K& key, IgniteError& err)
1128  {
1129  impl::In1Operation<K> op(key);
1130 
1131  return impl.Get()->Remove(op, err);
1132  }
1133 
1145  bool Remove(const K& key, const V& val)
1146  {
1147  IgniteError err;
1148 
1149  bool res = Remove(key, val, err);
1150 
1152 
1153  return res;
1154  }
1155 
1168  bool Remove(const K& key, const V& val, IgniteError& err)
1169  {
1170  impl::In2Operation<K, V> op(key, val);
1171 
1172  return impl.Get()->RemoveIfEqual(op, err);
1173  }
1174 
1184  void RemoveAll(const std::set<K>& keys)
1185  {
1186  IgniteError err;
1187 
1188  RemoveAll(keys, err);
1189 
1191  }
1192 
1203  void RemoveAll(const std::set<K>& keys, IgniteError& err)
1204  {
1205  impl::InSetOperation<K> op(keys);
1206 
1207  impl.Get()->RemoveAll(op, err);
1208  }
1209 
1220  template<typename Iter>
1221  void RemoveAll(Iter begin, Iter end)
1222  {
1223  IgniteError err;
1224 
1225  impl::InIterOperation<K, V, Iter> op(begin, end);
1226 
1227  impl.Get()->RemoveAll(op, err);
1228 
1230  }
1231 
1240  void RemoveAll()
1241  {
1242  IgniteError err;
1243 
1244  RemoveAll(err);
1245 
1247  }
1248 
1259  {
1260  return impl.Get()->RemoveAll(err);
1261  }
1262 
1270  int32_t LocalSize()
1271  {
1272  return LocalSize(CachePeekMode::ALL);
1273  }
1274 
1283  int32_t LocalSize(IgniteError& err)
1284  {
1285  return LocalSize(CachePeekMode::ALL, err);
1286  }
1287 
1296  int32_t LocalSize(int32_t peekModes)
1297  {
1298  IgniteError err;
1299 
1300  int32_t res = LocalSize(peekModes, err);
1301 
1303 
1304  return res;
1305  }
1306 
1316  int32_t LocalSize(int32_t peekModes, IgniteError& err)
1317  {
1318  return impl.Get()->Size(peekModes, true, err);
1319  }
1320 
1329  int32_t Size()
1330  {
1331  return Size(ignite::cache::CachePeekMode::ALL);
1332  }
1333 
1343  int32_t Size(IgniteError& err)
1344  {
1345  return Size(ignite::cache::CachePeekMode::ALL, err);
1346  }
1347 
1357  int32_t Size(int32_t peekModes)
1358  {
1359  IgniteError err;
1360 
1361  int32_t res = Size(peekModes, err);
1362 
1364 
1365  return res;
1366  }
1367 
1378  int32_t Size(int32_t peekModes, IgniteError& err)
1379  {
1380  return impl.Get()->Size(peekModes, false, err);
1381  }
1382 
1392  {
1393  IgniteError err;
1394 
1395  query::QueryCursor<K, V> res = Query(qry, err);
1396 
1398 
1399  return res;
1400  }
1401 
1412  {
1413  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySql(qry, err);
1414 
1415  return query::QueryCursor<K, V>(cursorImpl);
1416  }
1417 
1427  {
1428  IgniteError err;
1429 
1430  query::QueryCursor<K, V> res = Query(qry, err);
1431 
1433 
1434  return res;
1435  }
1436 
1447  {
1448  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryText(qry, err);
1449 
1450  return query::QueryCursor<K, V>(cursorImpl);
1451  }
1452 
1462  {
1463  IgniteError err;
1464 
1465  query::QueryCursor<K, V> res = Query(qry, err);
1466 
1468 
1469  return res;
1470  }
1471 
1482  {
1483  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryScan(qry, err);
1484 
1485  return query::QueryCursor<K, V>(cursorImpl);
1486  }
1487 
1497  {
1498  IgniteError err;
1499 
1500  query::QueryFieldsCursor res = Query(qry, err);
1501 
1503 
1504  return res;
1505  }
1506 
1517  {
1518  impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySqlFields(qry, err);
1519 
1520  return query::QueryFieldsCursor(cursorImpl);
1521  }
1522 
1564  template<typename R, typename P, typename A>
1565  R Invoke(const K& key, const P& processor, const A& arg)
1566  {
1567  IgniteError err;
1568 
1569  R res = Invoke<R>(key, processor, arg, err);
1570 
1572 
1573  return res;
1574  }
1575 
1618  template<typename R, typename P, typename A>
1619  R Invoke(const K& key, const P& processor, const A& arg, IgniteError& err)
1620  {
1621  typedef impl::cache::CacheEntryProcessorHolder<P, A> ProcessorHolder;
1622 
1623  R res;
1624  ProcessorHolder procHolder(processor, arg);
1625 
1626  impl::In2Operation<K, ProcessorHolder> inOp(key, procHolder);
1627  impl::Out1Operation<R> outOp(res);
1628 
1629  impl.Get()->Invoke(inOp, outOp, err);
1630 
1631  return res;
1632  }
1633 
1642  {
1643  IgniteError err;
1644 
1645  query::continuous::ContinuousQueryHandle<K, V> res = QueryContinuous(qry, err);
1646 
1648 
1649  return res;
1650  }
1651 
1661  {
1662  using namespace impl::cache::query::continuous;
1663  using namespace common::concurrent;
1664 
1665  const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
1666 
1667  if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
1668  {
1670  "Event listener is not set for ContinuousQuery instance");
1671 
1673  }
1674 
1675  ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, err);
1676 
1678  }
1679 
1687  template<typename Q>
1690  const Q& initialQry)
1691  {
1692  IgniteError err;
1693 
1694  query::continuous::ContinuousQueryHandle<K, V> res = QueryContinuous(qry, initialQry, err);
1695 
1697 
1698  return res;
1699  }
1700 
1709  template<typename Q>
1712  const Q& initialQry, IgniteError& err)
1713  {
1714  using namespace impl::cache::query::continuous;
1715  using namespace common::concurrent;
1716 
1717  const SharedPointer<ContinuousQueryImpl<K, V> >& qryImpl = qry.impl;
1718 
1719  if (!qryImpl.IsValid() || !qryImpl.Get()->HasListener())
1720  {
1722  "Event listener is not set for ContinuousQuery instance");
1723 
1725  }
1726 
1727  ContinuousQueryHandleImpl* cqImpl = impl.Get()->QueryContinuous(qryImpl, initialQry, err);
1728 
1730  }
1731 
1743  bool IsValid() const
1744  {
1745  return impl.IsValid();
1746  }
1747 
1751  void LoadCache()
1752  {
1753  IgniteError err;
1754 
1755  impl.Get()->LoadCache(err);
1756 
1758  }
1759 
1769  {
1770  IgniteError err;
1771 
1772  impl.Get()->LocalLoadCache(err);
1773 
1775  }
1776 
1777  private:
1779  common::concurrent::SharedPointer<impl::cache::CacheImpl> impl;
1780  };
1781  }
1782 }
1783 
1784 #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:1688
query::QueryCursor< K, V > Query(const query::TextQuery &qry)
Perform text query.
Definition: cache.h:1426
void ClearAll(const std::set< K > &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:937
Text query.
Definition: query_text.h:40
void Clear()
Clear cache.
Definition: cache.h:875
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:521
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry, IgniteError &err)
Start continuous query execution.
Definition: cache.h:1659
int32_t LocalSize(int32_t peekModes)
Gets the number of all entries cached on this node.
Definition: cache.h:1296
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:1054
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:1619
void GetAll(InIter begin, InIter end, OutIter dst)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:381
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:1145
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:904
Main entry point for all Data Grid APIs.
Definition: cache.h:68
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:1168
int32_t Size()
Gets the number of all entries cached across all nodes.
Definition: cache.h:1329
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:1074
query::QueryCursor< K, V > Query(const query::SqlQuery &qry)
Perform SQL query.
Definition: cache.h:1391
void Clear(const K &key, IgniteError &err)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:922
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:706
Cache(impl::cache::CacheImpl *impl)
Constructor.
Definition: cache.h:78
bool Remove(const K &key)
Removes given key mapping from cache.
Definition: cache.h:1100
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:891
query::continuous::ContinuousQueryHandle< K, V > QueryContinuous(const query::continuous::ContinuousQuery< K, V > &qry)
Start continuous query execution.
Definition: cache.h:1640
Declares ignite::cache::CachePeekMode enum.
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:476
V Get(const K &key, IgniteError &err)
Retrieves value mapped to the specified key from cache.
Definition: cache.h:308
void RemoveAll()
Removes all mappings from cache.
Definition: cache.h:1240
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:1461
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:1565
query::QueryCursor< K, V > Query(const query::SqlQuery &qry, IgniteError &err)
Perform SQL query.
Definition: cache.h:1411
V GetAndRemove(const K &key, IgniteError &err)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache.h:607
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:1184
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:803
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:955
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:498
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: core/include/ignite/cache/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:994
int32_t Size(IgniteError &err)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1343
bool IsEmpty()
Checks whether this cache contains no key-value mappings.
Definition: cache.h:104
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:1203
void PutAll(const std::map< K, V > &vals)
Stores given key-value pairs in cache.
Definition: cache.h:439
void LocalEvict(const std::set< K > &keys, IgniteError &err)
Attempts to evict all entries associated with keys.
Definition: cache.h:840
V GetAndRemove(const K &key)
Atomically removes the entry for a key only if currently mapped to some value.
Definition: cache.h:587
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:284
void Put(const K &key, const V &val)
Associates the specified value with the specified key in the cache.
Definition: cache.h:403
void LocalEvict(const std::set< K > &keys)
Attempts to evict all entries associated with keys.
Definition: cache.h:820
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:1710
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:779
Declares ignite::cache::query::continuous::ContinuousQueryHandle class.
void LoadCache()
Executes LocalLoadCache on all cache nodes.
Definition: cache.h:1751
int32_t Size(int32_t peekModes, IgniteError &err)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1378
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:629
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:760
int32_t Size(int32_t peekModes)
Gets the number of all entries cached across all nodes.
Definition: cache.h:1357
std::map< K, V > GetAll(const std::set< K > &keys)
Retrieves values mapped to the specified keys from cache.
Definition: cache.h:331
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:567
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:458
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:1283
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:676
void LocalClearAll(const std::set< K > &keys)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1033
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:651
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
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:544
void RemoveAll(Iter begin, Iter end)
Removes given key mappings from cache.
Definition: cache.h:1221
const char * GetName() const
Get name of this cache (null for default cache).
Definition: cache.h:91
query::QueryCursor< K, V > Query(const query::ScanQuery &qry, IgniteError &err)
Perform scan query.
Definition: cache.h:1481
void LocalEvict(Iter begin, Iter end)
Attempts to evict all entries associated with keys.
Definition: cache.h:859
Apache Ignite API.
Definition: cache.h:48
query::QueryCursor< K, V > Query(const query::TextQuery &qry, IgniteError &err)
Perform text query.
Definition: cache.h:1446
Declares ignite::IgniteError class.
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry, IgniteError &err)
Perform sql fields query.
Definition: cache.h:1516
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:733
query::QueryFieldsCursor Query(const query::SqlFieldsQuery &qry)
Perform sql fields query.
Definition: cache.h:1496
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:1258
void ClearAll(Iter begin, Iter end)
Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:972
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
int32_t LocalSize()
Gets the number of all entries cached on this node.
Definition: cache.h:1270
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:1768
bool Remove(const K &key, IgniteError &err)
Removes given key mapping from cache.
Definition: cache.h:1127
void LocalClear(const K &key, IgniteError &err)
Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
Definition: cache.h:1015
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:1316
bool IsValid() const
Check if the instance is valid.
Definition: cache.h:1743
bool ContainsKeys(InputIter begin, InputIter end)
Check if cache contains mapping for these keys.
Definition: cache.h:193