cutelyst 4.8.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
memcached.h
1/*
2 * SPDX-FileCopyrightText: (C) 2017-2022 Matthias Fehring <mf@huessenbergnetz.de>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#pragma once
6
7#include <Cutelyst/Plugins/memcached_export.h>
8#include <Cutelyst/plugin.h>
9#include <chrono>
10
11#include <QDataStream>
12#include <QVersionNumber>
13
14namespace Cutelyst {
15
16class Context;
17class MemcachedPrivate;
18
166class CUTELYST_PLUGIN_MEMCACHED_EXPORT Memcached // clazy:exclude=ctor-missing-parent-argument
167 : public Plugin
168{
170 Q_DECLARE_PRIVATE(Memcached) // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
171 Q_DISABLE_COPY(Memcached)
172public:
177
186 Memcached(Application *parent, const QVariantMap &defaultConfig);
187
191 ~Memcached() override;
192
255
256
260 void setDefaultConfig(const QVariantMap &defaultConfig);
261
274 static bool set(QByteArrayView key,
275 const QByteArray &value,
276 time_t expiration,
277 ReturnType *returnType = nullptr);
278
283 inline static bool set(QByteArrayView key,
284 const QByteArray &value,
285 std::chrono::seconds expiration,
286 ReturnType *returnType = nullptr);
287
302 template <typename T>
303 static bool set(QByteArrayView key,
304 const T &value,
305 time_t expiration,
306 ReturnType *returnType = nullptr);
307
312 template <typename T>
313 static bool set(QByteArrayView key,
314 const T &value,
315 std::chrono::seconds expiration,
316 ReturnType *returnType = nullptr);
317
334 static bool setByKey(QByteArrayView groupKey,
335 QByteArrayView key,
336 const QByteArray &value,
337 time_t expiration,
338 ReturnType *returnType = nullptr);
339
344 inline static bool setByKey(QByteArrayView groupKey,
345 QByteArrayView key,
346 const QByteArray &value,
347 std::chrono::seconds expiration,
348 ReturnType *returnType = nullptr);
349
367 template <typename T>
368 static bool setByKey(QByteArrayView groupKey,
369 QByteArrayView key,
370 const T &value,
371 time_t expiration,
372 ReturnType *returnType = nullptr);
373
378 template <typename T>
379 static bool setByKey(QByteArrayView groupKey,
380 QByteArrayView key,
381 const T &value,
382 std::chrono::seconds expiration,
383 ReturnType *returnType = nullptr);
384
400 static bool add(QByteArrayView key,
401 const QByteArray &value,
402 time_t expiration,
403 ReturnType *returnType = nullptr);
404
409 inline static bool add(QByteArrayView key,
410 const QByteArray &value,
411 std::chrono::seconds expiration,
412 ReturnType *returnType = nullptr);
413
432 template <typename T>
433 static bool add(QByteArrayView key,
434 const T &value,
435 time_t expiration,
436 ReturnType *returnType = nullptr);
437
442 template <typename T>
443 static bool add(QByteArrayView key,
444 const T &value,
445 std::chrono::seconds expiration,
446 ReturnType *returnType = nullptr);
447
467 static bool addByKey(QByteArrayView groupKey,
468 QByteArrayView key,
469 const QByteArray &value,
470 time_t expiration,
471 ReturnType *returnType = nullptr);
472
477 inline static bool addByKey(QByteArrayView groupKey,
478 QByteArrayView key,
479 const QByteArray &value,
480 std::chrono::seconds expiration,
481 ReturnType *returnType = nullptr);
482
504 template <typename T>
505 static bool addByKey(QByteArrayView groupKey,
506 QByteArrayView key,
507 const T &value,
508 time_t expiration,
509 ReturnType *returnType = nullptr);
510
515 template <typename T>
516 static bool addByKey(QByteArrayView groupKey,
517 QByteArrayView key,
518 const T &value,
519 std::chrono::seconds expiration,
520 ReturnType *returnType = nullptr);
521
537 static bool replace(QByteArrayView key,
538 const QByteArray &value,
539 time_t expiration,
540 ReturnType *returnType = nullptr);
541
546 inline static bool replace(QByteArrayView key,
547 const QByteArray &value,
548 std::chrono::seconds expiration,
549 ReturnType *returnType = nullptr);
550
568 template <typename T>
569 static bool replace(QByteArrayView key,
570 const T &value,
571 time_t expiration,
572 ReturnType *returnType = nullptr);
573
578 template <typename T>
579 static bool replace(QByteArrayView key,
580 const T &value,
581 std::chrono::seconds expiration,
582 ReturnType *returnType = nullptr);
583
603 static bool replaceByKey(QByteArrayView groupKey,
604 QByteArrayView key,
605 const QByteArray &value,
606 time_t expiration,
607 ReturnType *returnType = nullptr);
608
613 inline static bool replaceByKey(QByteArrayView groupKey,
614 QByteArrayView key,
615 const QByteArray &value,
616 std::chrono::seconds expiration,
617 ReturnType *returnType = nullptr);
618
640 template <typename T>
641 static bool replaceByKey(QByteArrayView groupKey,
642 QByteArrayView key,
643 const T &value,
644 time_t expiration,
645 ReturnType *returnType = nullptr);
646
651 template <typename T>
652 static bool replaceByKey(QByteArrayView groupKey,
653 QByteArrayView key,
654 const T &value,
655 std::chrono::seconds expiration,
656 ReturnType *returnType = nullptr);
657
675 static QByteArray
676 get(QByteArrayView key, uint64_t *cas = nullptr, ReturnType *returnType = nullptr);
677
708 template <typename T>
709 static T get(QByteArrayView key, uint64_t *cas = nullptr, ReturnType *returnType = nullptr);
710
731 static QByteArray getByKey(QByteArrayView groupKey,
732 QByteArrayView key,
733 uint64_t *cas = nullptr,
734 ReturnType *returnType = nullptr);
735
771 template <typename T>
772 static T getByKey(QByteArrayView groupKey,
773 QByteArrayView key,
774 uint64_t *cas = nullptr,
775 ReturnType *returnType = nullptr);
776
785 static bool remove(QByteArrayView key, ReturnType *returnType = nullptr);
786
799 static bool
800 removeByKey(QByteArrayView groupKey, QByteArrayView key, ReturnType *returnType = nullptr);
801
809 static bool exist(QByteArrayView key, ReturnType *returnType = nullptr);
810
822 static bool
823 existByKey(QByteArrayView groupKey, QByteArrayView key, ReturnType *returnType = nullptr);
824
830 static const time_t expirationNotAdd;
831
839 static const std::chrono::seconds expirationNotAddDuration;
840
856 static bool increment(QByteArrayView key,
857 uint32_t offset,
858 uint64_t *value = nullptr,
859 ReturnType *returnType = nullptr);
860
879 static bool incrementByKey(QByteArrayView groupKey,
880 QByteArrayView key,
881 uint64_t offset,
882 uint64_t *value = nullptr,
883 ReturnType *returnType = nullptr);
884
909 static bool incrementWithInitial(QByteArrayView key,
910 uint64_t offset,
911 uint64_t initial,
912 time_t expiration,
913 uint64_t *value = nullptr,
914 ReturnType *returnType = nullptr);
915
920 inline static bool incrementWithInitial(QByteArrayView key,
921 uint64_t offset,
922 uint64_t initial,
923 std::chrono::seconds expiration,
924 uint64_t *value = nullptr,
925 ReturnType *returnType = nullptr);
926
956 static bool incrementWithInitialByKey(QByteArrayView groupKey,
957 QByteArrayView key,
958 uint64_t offset,
959 uint64_t initial,
960 time_t expiration,
961 uint64_t *value = nullptr,
962 ReturnType *returnType = nullptr);
963
968 inline static bool incrementWithInitialByKey(QByteArrayView groupKey,
969 QByteArrayView key,
970 uint64_t offset,
971 uint64_t initial,
972 std::chrono::seconds expiration,
973 uint64_t *value = nullptr,
974 ReturnType *returnType = nullptr);
975
991 static bool decrement(QByteArrayView key,
992 uint32_t offset,
993 uint64_t *value = nullptr,
994 ReturnType *returnType = nullptr);
995
1014 static bool decrementByKey(QByteArrayView groupKey,
1015 QByteArrayView key,
1016 uint64_t offset,
1017 uint64_t *value = nullptr,
1018 ReturnType *returnType = nullptr);
1019
1044 static bool decrementWithInitial(QByteArrayView key,
1045 uint64_t offset,
1046 uint64_t initial,
1047 time_t expiration,
1048 uint64_t *value = nullptr,
1049 ReturnType *returnType = nullptr);
1050
1055 inline static bool decrementWithInitial(QByteArrayView key,
1056 uint64_t offset,
1057 uint64_t initial,
1058 std::chrono::seconds expiration,
1059 uint64_t *value = nullptr,
1060 ReturnType *returnType = nullptr);
1061
1091 static bool decrementWithInitialByKey(QByteArrayView groupKey,
1092 QByteArrayView key,
1093 uint64_t offset,
1094 uint64_t initial,
1095 time_t expiration,
1096 uint64_t *value = nullptr,
1097 ReturnType *returnType = nullptr);
1098
1103 inline static bool decrementWithInitialByKey(QByteArrayView groupKey,
1104 QByteArrayView key,
1105 uint64_t offset,
1106 uint64_t initial,
1107 std::chrono::seconds expiration,
1108 uint64_t *value = nullptr,
1109 ReturnType *returnType = nullptr);
1110
1123 static bool cas(QByteArrayView key,
1124 const QByteArray &value,
1125 time_t expiration,
1126 uint64_t cas,
1127 ReturnType *returnType = nullptr);
1128
1133 inline static bool cas(QByteArrayView key,
1134 const QByteArray &value,
1135 std::chrono::seconds expiration,
1136 uint64_t cas,
1137 ReturnType *returnType = nullptr);
1138
1153 template <typename T>
1154 static bool cas(QByteArrayView key,
1155 const T &value,
1156 time_t expiration,
1157 uint64_t cas,
1158 ReturnType *returnType = nullptr);
1159
1164 template <typename T>
1165 static bool cas(QByteArrayView key,
1166 const T &value,
1167 std::chrono::seconds expiration,
1168 uint64_t cas,
1169 ReturnType *returnType = nullptr);
1170
1189 static bool casByKey(QByteArrayView groupKey,
1190 QByteArrayView key,
1191 const QByteArray &value,
1192 time_t expiration,
1193 uint64_t cas,
1194 ReturnType *returnType = nullptr);
1195
1200 inline static bool casByKey(QByteArrayView groupKey,
1201 QByteArrayView key,
1202 const QByteArray &value,
1203 std::chrono::seconds expiration,
1204 uint64_t cas,
1205 ReturnType *returnType = nullptr);
1206
1227 template <typename T>
1228 static bool casByKey(QByteArrayView groupKey,
1229 QByteArrayView key,
1230 const T &value,
1231 time_t expiration,
1232 uint64_t cas,
1233 ReturnType *returnType = nullptr);
1234
1239 template <typename T>
1240 static bool casByKey(QByteArrayView groupKey,
1241 QByteArrayView key,
1242 const T &value,
1243 std::chrono::seconds expiration,
1244 uint64_t cas,
1245 ReturnType *returnType = nullptr);
1246
1255 static bool flushBuffers(ReturnType *returnType = nullptr);
1256
1268 static bool flush(time_t expiration, ReturnType *returnType = nullptr);
1269
1274 inline static bool flush(std::chrono::seconds expiration, ReturnType *returnType = nullptr);
1275
1290 QHash<QByteArray, uint64_t> *casValues = nullptr,
1291 ReturnType *returnType = nullptr);
1292
1308 template <typename T>
1309 static QHash<QByteArray, T> mget(const QByteArrayList &keys,
1310 QHash<QByteArray, uint64_t> *casValues = nullptr,
1311 ReturnType *returnType = nullptr);
1312
1333 const QByteArrayList &keys,
1334 QHash<QByteArray, uint64_t> *casValues = nullptr,
1335 ReturnType *returnType = nullptr);
1336
1358 template <typename T>
1360 const QByteArrayList &keys,
1361 QHash<QByteArray, uint64_t> *casValues = nullptr,
1362 ReturnType *returnType = nullptr);
1363
1373 static bool touch(QByteArrayView key, time_t expiration, ReturnType *returnType = nullptr);
1374
1379 inline static bool touch(QByteArrayView key,
1380 std::chrono::seconds expiration,
1381 ReturnType *returnType = nullptr);
1382
1397 static bool touchByKey(QByteArrayView groupKey,
1398 QByteArrayView key,
1399 time_t expiration,
1400 ReturnType *returnType = nullptr);
1401
1406 inline static bool touchByKey(QByteArrayView groupKey,
1407 QByteArrayView key,
1408 std::chrono::seconds expiration,
1409 ReturnType *returnType = nullptr);
1410
1414 static QString errorString(Context *c, ReturnType rt);
1415
1420
1421protected:
1425 bool setup(Application *app) override;
1426
1427private:
1428 const std::unique_ptr<MemcachedPrivate> d_ptr;
1429};
1430
1432 const QByteArray &value,
1433 std::chrono::seconds expiration,
1434 ReturnType *returnType)
1435{
1436 return Memcached::set(key, value, expiration.count(), returnType);
1437}
1438
1439template <typename T>
1440bool Memcached::set(QByteArrayView key, const T &value, time_t expiration, ReturnType *returnType)
1441{
1442 QByteArray data;
1444 out << value;
1445 return Memcached::set(key, data, expiration, returnType);
1446}
1447
1448template <typename T>
1450 const T &value,
1451 std::chrono::seconds expiration,
1452 ReturnType *returnType)
1453{
1454 return Memcached::set<T>(key, value, expiration.count(), returnType);
1455}
1456
1458 QByteArrayView key,
1459 const QByteArray &value,
1460 std::chrono::seconds expiration,
1461 ReturnType *returnType)
1462{
1463 return Memcached::setByKey(groupKey, key, value, expiration.count(), returnType);
1464}
1465
1466template <typename T>
1468 QByteArrayView key,
1469 const T &value,
1470 time_t expiration,
1471 ReturnType *returnType)
1472{
1473 QByteArray data;
1475 out << value;
1476 return Memcached::setByKey(groupKey, key, data, expiration, returnType);
1477}
1478
1479template <typename T>
1481 QByteArrayView key,
1482 const T &value,
1483 std::chrono::seconds expiration,
1484 ReturnType *returnType)
1485{
1486 return Memcached::setByKey<T>(groupKey, key, value, expiration.count(), returnType);
1487}
1488
1490 const QByteArray &value,
1491 std::chrono::seconds expiration,
1492 ReturnType *returnType)
1493{
1494 return Memcached::add(key, value, expiration.count(), returnType);
1495}
1496
1497template <typename T>
1498bool Memcached::add(QByteArrayView key, const T &value, time_t expiration, ReturnType *returnType)
1499{
1500 QByteArray data;
1502 out << value;
1503 return Memcached::add(key, data, expiration, returnType);
1504}
1505
1506template <typename T>
1508 const T &value,
1509 std::chrono::seconds expiration,
1510 ReturnType *returnType)
1511{
1512 return Memcached::add<T>(key, value, expiration.count(), returnType);
1513}
1514
1516 QByteArrayView key,
1517 const QByteArray &value,
1518 std::chrono::seconds expiration,
1519 ReturnType *returnType)
1520{
1521 return Memcached::addByKey(groupKey, key, value, expiration.count(), returnType);
1522}
1523
1524template <typename T>
1526 QByteArrayView key,
1527 const T &value,
1528 time_t expiration,
1529 ReturnType *returnType)
1530{
1531 QByteArray data;
1533 out << value;
1534 return Memcached::addByKey(groupKey, key, data, expiration, returnType);
1535}
1536
1537template <typename T>
1539 QByteArrayView key,
1540 const T &value,
1541 std::chrono::seconds expiration,
1542 ReturnType *returnType)
1543{
1544 return Memcached::addByKey<T>(groupKey, key, value, expiration.count(), returnType);
1545}
1546
1548 const QByteArray &value,
1549 std::chrono::seconds expiration,
1550 ReturnType *returnType)
1551{
1552 return Memcached::replace(key, value, expiration.count(), returnType);
1553}
1554
1555template <typename T>
1557 const T &value,
1558 time_t expiration,
1559 ReturnType *returnType)
1560{
1561 QByteArray data;
1563 out << value;
1564 return Memcached::replace(key, data, expiration, returnType);
1565}
1566
1567template <typename T>
1569 const T &value,
1570 std::chrono::seconds expiration,
1571 ReturnType *returnType)
1572{
1573 return Memcached::replace<T>(key, value, expiration.count(), returnType);
1574}
1575
1577 QByteArrayView key,
1578 const QByteArray &value,
1579 std::chrono::seconds expiration,
1580 ReturnType *returnType)
1581{
1582 return Memcached::replaceByKey(groupKey, key, value, expiration.count(), returnType);
1583}
1584
1585template <typename T>
1587 QByteArrayView key,
1588 const T &value,
1589 time_t expiration,
1590 ReturnType *returnType)
1591{
1592 QByteArray data;
1594 out << value;
1595 return Memcached::replaceByKey(groupKey, key, data, expiration, returnType);
1596}
1597
1598template <typename T>
1600 QByteArrayView key,
1601 const T &value,
1602 std::chrono::seconds expiration,
1603 ReturnType *returnType)
1604{
1605 return Memcached::replaceByKey<T>(groupKey, key, value, expiration.count(), returnType);
1606}
1607
1609 uint64_t offset,
1610 uint64_t initial,
1611 std::chrono::seconds expiration,
1612 uint64_t *value,
1613 ReturnType *returnType)
1614{
1616 key, offset, initial, expiration.count(), value, returnType);
1617}
1618
1620 QByteArrayView key,
1621 uint64_t offset,
1622 uint64_t initial,
1623 std::chrono::seconds expiration,
1624 uint64_t *value,
1625 ReturnType *returnType)
1626{
1628 groupKey, key, offset, initial, expiration.count(), value, returnType);
1629}
1630
1632 uint64_t offset,
1633 uint64_t initial,
1634 std::chrono::seconds expiration,
1635 uint64_t *value,
1636 ReturnType *returnType)
1637{
1639 key, offset, initial, expiration.count(), value, returnType);
1640}
1641
1643 QByteArrayView key,
1644 uint64_t offset,
1645 uint64_t initial,
1646 std::chrono::seconds expiration,
1647 uint64_t *value,
1648 ReturnType *returnType)
1649{
1651 groupKey, key, offset, initial, expiration.count(), value, returnType);
1652}
1653
1654template <typename T>
1655T Memcached::get(QByteArrayView key, uint64_t *cas, ReturnType *returnType)
1656{
1657 T retVal;
1658 QByteArray ba = Memcached::get(key, cas, returnType);
1659 if (!ba.isEmpty()) {
1661 in >> retVal;
1662 }
1663 return retVal;
1664}
1665
1666template <typename T>
1668 QByteArrayView key,
1669 uint64_t *cas,
1670 ReturnType *returnType)
1671{
1672 T retVal;
1673 QByteArray ba = Memcached::getByKey(groupKey, key, cas, returnType);
1674 if (!ba.isEmpty()) {
1676 in >> retVal;
1677 }
1678 return retVal;
1679}
1680
1682 const QByteArray &value,
1683 std::chrono::seconds expiration,
1684 uint64_t cas,
1685 ReturnType *returnType)
1686{
1687 return Memcached::cas(key, value, expiration.count(), cas, returnType);
1688}
1689
1690template <typename T>
1692 const T &value,
1693 time_t expiration,
1694 uint64_t cas,
1695 ReturnType *returnType)
1696{
1697 QByteArray data;
1699 out << value;
1700 return Memcached::cas(key, data, expiration, cas, returnType);
1701}
1702
1703template <typename T>
1705 const T &value,
1706 std::chrono::seconds expiration,
1707 uint64_t cas,
1708 ReturnType *returnType)
1709{
1710 return Memcached::cas<T>(key, value, expiration.count(), cas, returnType);
1711}
1712
1714 QByteArrayView key,
1715 const QByteArray &value,
1716 std::chrono::seconds expiration,
1717 uint64_t cas,
1718 ReturnType *returnType)
1719{
1720 return Memcached::casByKey(groupKey, key, value, expiration.count(), cas, returnType);
1721}
1722
1723template <typename T>
1725 QByteArrayView key,
1726 const T &value,
1727 time_t expiration,
1728 uint64_t cas,
1729 ReturnType *returnType)
1730{
1731 QByteArray data;
1733 out << value;
1734 return Memcached::casByKey(groupKey, key, data, expiration, cas, returnType);
1735}
1736
1737template <typename T>
1739 QByteArrayView key,
1740 const T &value,
1741 std::chrono::seconds expiration,
1742 uint64_t cas,
1743 ReturnType *returnType)
1744{
1745 return Memcached::casByKey<T>(groupKey, key, value, expiration.count(), cas, returnType);
1746}
1747
1748inline bool Memcached::flush(std::chrono::seconds expiration, ReturnType *returnType)
1749{
1750 return Memcached::flush(expiration.count(), returnType);
1751}
1752
1753template <typename T>
1755 QHash<QByteArray, uint64_t> *casValues,
1756 ReturnType *returnType)
1757{
1759 QHash<QByteArray, QByteArray> _data = Memcached::mget(keys, casValues, returnType);
1760 if (!_data.empty()) {
1761 auto i = _data.constBegin();
1762 while (i != _data.constEnd()) {
1763 T retVal;
1764 QDataStream in(i.value());
1765 in >> retVal;
1766 hash.insert(i.key(), retVal);
1767 ++i;
1768 }
1769 }
1770 return hash;
1771}
1772
1773template <typename T>
1775 const QByteArrayList &keys,
1776 QHash<QByteArray, uint64_t> *casValues,
1777 ReturnType *returnType)
1778{
1781 Memcached::mgetByKey(groupKey, keys, casValues, returnType);
1782 if (!_data.empty()) {
1783 auto i = _data.constBegin();
1784 while (i != _data.constEnd()) {
1785 T retVal;
1786 QDataStream in(i.value());
1787 in >> retVal;
1788 hash.insert(i.key(), retVal);
1789 ++i;
1790 }
1791 }
1792 return hash;
1793}
1794
1795inline bool
1796 Memcached::touch(QByteArrayView key, std::chrono::seconds expiration, ReturnType *returnType)
1797{
1798 return Memcached::touch(key, expiration.count(), returnType);
1799}
1800
1802 QByteArrayView key,
1803 std::chrono::seconds expiration,
1804 ReturnType *returnType)
1805{
1806 return Memcached::touchByKey(groupKey, key, expiration.count(), returnType);
1807}
1808
1809} // namespace Cutelyst
The Cutelyst application.
Definition application.h:66
The Cutelyst Context.
Definition context.h:42
static bool touch(QByteArrayView key, time_t expiration, ReturnType *returnType=nullptr)
static bool flush(time_t expiration, ReturnType *returnType=nullptr)
static bool touchByKey(QByteArrayView groupKey, QByteArrayView key, time_t expiration, ReturnType *returnType=nullptr)
static bool incrementByKey(QByteArrayView groupKey, QByteArrayView key, uint64_t offset, uint64_t *value=nullptr, ReturnType *returnType=nullptr)
static bool flushBuffers(ReturnType *returnType=nullptr)
static const std::chrono::seconds expirationNotAddDuration
Definition memcached.h:839
bool setup(Application *app) override
Definition memcached.cpp:46
static bool decrementWithInitial(QByteArrayView key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value=nullptr, ReturnType *returnType=nullptr)
static bool incrementWithInitial(QByteArrayView key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value=nullptr, ReturnType *returnType=nullptr)
static QHash< QByteArray, QByteArray > mgetByKey(QByteArrayView groupKey, const QByteArrayList &keys, QHash< QByteArray, uint64_t > *casValues=nullptr, ReturnType *returnType=nullptr)
static bool cas(QByteArrayView key, const QByteArray &value, time_t expiration, uint64_t cas, ReturnType *returnType=nullptr)
static bool replace(QByteArrayView key, const QByteArray &value, time_t expiration, ReturnType *returnType=nullptr)
static bool set(QByteArrayView key, const QByteArray &value, time_t expiration, ReturnType *returnType=nullptr)
static bool decrement(QByteArrayView key, uint32_t offset, uint64_t *value=nullptr, ReturnType *returnType=nullptr)
static bool replaceByKey(QByteArrayView groupKey, QByteArrayView key, const QByteArray &value, time_t expiration, ReturnType *returnType=nullptr)
static bool decrementByKey(QByteArrayView groupKey, QByteArrayView key, uint64_t offset, uint64_t *value=nullptr, ReturnType *returnType=nullptr)
static bool casByKey(QByteArrayView groupKey, QByteArrayView key, const QByteArray &value, time_t expiration, uint64_t cas, ReturnType *returnType=nullptr)
static QString errorString(Context *c, ReturnType rt)
~Memcached() override
static QHash< QByteArray, QByteArray > mget(const QByteArrayList &keys, QHash< QByteArray, uint64_t > *casValues=nullptr, ReturnType *returnType=nullptr)
static bool decrementWithInitialByKey(QByteArrayView groupKey, QByteArrayView key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value=nullptr, ReturnType *returnType=nullptr)
static QByteArray getByKey(QByteArrayView groupKey, QByteArrayView key, uint64_t *cas=nullptr, ReturnType *returnType=nullptr)
static const time_t expirationNotAdd
Definition memcached.h:830
static bool addByKey(QByteArrayView groupKey, QByteArrayView key, const QByteArray &value, time_t expiration, ReturnType *returnType=nullptr)
static bool incrementWithInitialByKey(QByteArrayView groupKey, QByteArrayView key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value=nullptr, ReturnType *returnType=nullptr)
static bool increment(QByteArrayView key, uint32_t offset, uint64_t *value=nullptr, ReturnType *returnType=nullptr)
static bool setByKey(QByteArrayView groupKey, QByteArrayView key, const QByteArray &value, time_t expiration, ReturnType *returnType=nullptr)
static QByteArray get(QByteArrayView key, uint64_t *cas=nullptr, ReturnType *returnType=nullptr)
Memcached(Application *parent)
Definition memcached.cpp:26
static QVersionNumber libMemcachedVersion()
Returns the version of the currently used libmemcached.
static bool add(QByteArrayView key, const QByteArray &value, time_t expiration, ReturnType *returnType=nullptr)
Plugin(Application *parent)
Definition plugin.cpp:12
The Cutelyst namespace holds all public Cutelyst API.
bool isEmpty() const const
qsizetype count(QByteArrayView bv) const const
QHash< Key, T >::const_iterator constBegin() const const
QHash< Key, T >::const_iterator constEnd() const const
bool empty() const const
QHash< Key, T >::iterator insert(const Key &key, const T &value)
Q_OBJECTQ_OBJECT
QObject * parent() const const