6 #ifndef CUTELYSTMEMCACHED_H
7 #define CUTELYSTMEMCACHED_H
9 #include <Cutelyst/cutelyst_global.h>
10 #include <Cutelyst/plugin.h>
12 #include <QDataStream>
13 #include <QVersionNumber>
18 class MemcachedPrivate;
189 ServerTemporaryDisabled,
190 ServerMemoryAllocationFailure,
194 Q_ENUM(MemcachedReturnType)
200 void setDefaultConfig(
const QVariantMap &defaultConfig);
213 static bool set(
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
228 template<
typename T>
229 static bool set(
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
246 static bool setByKey(
const QString &groupKey,
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
264 template<
typename T>
265 static bool setByKey(
const QString &groupKey,
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
281 static bool add(
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
299 template<
typename T>
300 static bool add(
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
320 static bool addByKey(
const QString &groupKey,
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
342 template<
typename T>
343 static bool addByKey(
const QString &groupKey,
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
359 static bool replace(
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
377 template<
typename T>
378 static bool replace(
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
398 static bool replaceByKey(
const QString &groupKey,
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
420 template<
typename T>
421 static bool replaceByKey(
const QString &groupKey,
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
437 static QByteArray get(
const QString &key, uint64_t *cas =
nullptr, MemcachedReturnType *returnType =
nullptr);
467 template<
typename T>
468 static T get(
const QString &key, uint64_t *cas =
nullptr, MemcachedReturnType *returnType =
nullptr);
488 static QByteArray getByKey(
const QString &groupKey,
const QString &key, uint64_t *cas =
nullptr, MemcachedReturnType *returnType =
nullptr);
522 template<
typename T>
523 static T getByKey(
const QString &groupKey,
const QString &key, uint64_t *cas =
nullptr, MemcachedReturnType *returnType =
nullptr);
532 static bool remove(
const QString &key, MemcachedReturnType *returnType =
nullptr);
545 static bool removeByKey(
const QString &groupKey,
const QString &key, MemcachedReturnType *returnType =
nullptr);
553 static bool exist(
const QString &key, MemcachedReturnType *returnType =
nullptr);
565 static bool existByKey(
const QString &groupKey,
const QString &key, MemcachedReturnType *returnType =
nullptr);
587 static bool increment(
const QString &key, uint32_t offset, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
630 static bool incrementWithInitial(
const QString &key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
659 static bool incrementWithInitialByKey(
const QString &groupKey,
const QString &key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
675 static bool decrement(
const QString &key, uint32_t offset, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
718 static bool decrementWithInitial(
const QString &key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
747 static bool decrementWithInitialByKey(
const QString &groupKey,
const QString &key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
775 template<
typename T>
776 static bool cas(
const QString &key,
const T &value, time_t expiration, uint64_t cas,
MemcachedReturnType *returnType =
nullptr);
814 template<
typename T>
866 template<
typename T>
907 template<
typename T>
954 template<
typename T>
958 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
967 template<
typename T>
971 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
980 template<
typename T>
984 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
993 template<
typename T>
997 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
1006 template<
typename T>
1010 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
1019 template<
typename T>
1023 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
1032 template<
typename T>
1038 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
1048 template<
typename T>
1054 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
1064 template<
typename T>
1068 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
1077 template<
typename T>
1081 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
1090 template<
typename T>
1095 if (!_data.
empty()) {
1101 hash.
insert(i.key(), retVal);
1108 template<
typename T>
1113 if (!_data.
empty()) {
1119 hash.
insert(i.key(), retVal);
The Cutelyst Application.
Cutelyst Memcached plugin.
static bool replaceByKey(const QString &groupKey, const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
static bool add(const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
@ MemoryAllocationFailure
static QByteArray get(const QString &key, uint64_t *cas=nullptr, MemcachedReturnType *returnType=nullptr)
static bool casByKey(const QString &groupKey, const QString &key, const QByteArray &value, time_t expiration, uint64_t cas, MemcachedReturnType *returnType=nullptr)
static bool cas(const QString &key, const QByteArray &value, time_t expiration, uint64_t cas, MemcachedReturnType *returnType=nullptr)
static QHash< QString, QByteArray > mgetByKey(const QString &groupKey, const QStringList &keys, QHash< QString, uint64_t > *casValues=nullptr, MemcachedReturnType *returnType=nullptr)
static const time_t expirationNotAdd
static bool set(const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
static bool setByKey(const QString &groupKey, const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
static QHash< QString, QByteArray > mget(const QStringList &keys, QHash< QString, uint64_t > *casValues=nullptr, MemcachedReturnType *returnType=nullptr)
static bool replace(const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
static bool addByKey(const QString &groupKey, const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
static QByteArray getByKey(const QString &groupKey, const QString &key, uint64_t *cas=nullptr, MemcachedReturnType *returnType=nullptr)
The Cutelyst namespace holds all public Cutelyst API.
bool isEmpty() const const
QHash::const_iterator constBegin() const const
QHash::const_iterator constEnd() const const
QHash::iterator insert(const Key &key, const T &value)