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;
190 ServerTemporaryDisabled,
191 ServerMemoryAllocationFailure,
195 Q_ENUM(MemcachedReturnType)
201 void setDefaultConfig(
const QVariantMap &defaultConfig);
214 static bool set(
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
229 template<
typename T>
230 static bool set(
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
247 static bool setByKey(
const QString &groupKey,
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
265 template<
typename T>
266 static bool setByKey(
const QString &groupKey,
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
282 static bool add(
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
300 template<
typename T>
301 static bool add(
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
321 static bool addByKey(
const QString &groupKey,
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
343 template<
typename T>
344 static bool addByKey(
const QString &groupKey,
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
360 static bool replace(
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
378 template<
typename T>
379 static bool replace(
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
399 static bool replaceByKey(
const QString &groupKey,
const QString &key,
const QByteArray &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
421 template<
typename T>
422 static bool replaceByKey(
const QString &groupKey,
const QString &key,
const T &value, time_t expiration, MemcachedReturnType *returnType =
nullptr);
438 static QByteArray get(
const QString &key, uint64_t *cas =
nullptr, MemcachedReturnType *returnType =
nullptr);
468 template<
typename T>
469 static T
get(
const QString &key, uint64_t *cas =
nullptr, MemcachedReturnType *returnType =
nullptr);
489 static QByteArray getByKey(
const QString &groupKey,
const QString &key, uint64_t *cas =
nullptr, MemcachedReturnType *returnType =
nullptr);
523 template<
typename T>
524 static T getByKey(
const QString &groupKey,
const QString &key, uint64_t *cas =
nullptr, MemcachedReturnType *returnType =
nullptr);
533 static bool remove(
const QString &key, MemcachedReturnType *returnType =
nullptr);
546 static bool removeByKey(
const QString &groupKey,
const QString &key, MemcachedReturnType *returnType =
nullptr);
554 static bool exist(
const QString &key, MemcachedReturnType *returnType =
nullptr);
566 static bool existByKey(
const QString &groupKey,
const QString &key, MemcachedReturnType *returnType =
nullptr);
588 static bool increment(
const QString &key, uint32_t offset, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
631 static bool incrementWithInitial(
const QString &key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
660 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);
676 static bool decrement(
const QString &key, uint32_t offset, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
719 static bool decrementWithInitial(
const QString &key, uint64_t offset, uint64_t initial, time_t expiration, uint64_t *value =
nullptr,
MemcachedReturnType *returnType =
nullptr);
748 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);
776 template<
typename T>
777 static bool cas(
const QString &key,
const T &value, time_t expiration, uint64_t cas,
MemcachedReturnType *returnType =
nullptr);
815 template<
typename T>
867 template<
typename T>
908 template<
typename T>
955 template<
typename T>
959 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 968 template<
typename T>
972 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 981 template<
typename T>
985 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 994 template<
typename T>
998 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 1007 template<
typename T>
1011 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 1020 template<
typename T>
1024 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 1033 template<
typename T>
1039 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 1049 template<
typename T>
1055 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 1065 template<
typename T>
1069 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 1078 template<
typename T>
1082 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) 1091 template<
typename T>
1096 if (!_data.
empty()) {
1102 hash.
insert(i.key(), retVal);
1109 template<
typename T>
1114 if (!_data.
empty()) {
1120 hash.
insert(i.key(), retVal);
1129 #endif // CUTELYSTMEMCACHED_H
static bool addByKey(const QString &groupKey, const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
static bool replace(const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
QHash::iterator insert(const Key &key, const T &value)
static bool replaceByKey(const QString &groupKey, const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
static bool casByKey(const QString &groupKey, const QString &key, const QByteArray &value, time_t expiration, uint64_t cas, MemcachedReturnType *returnType=nullptr)
bool isEmpty() const const
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 QByteArray get(const QString &key, uint64_t *cas=nullptr, MemcachedReturnType *returnType=nullptr)
static QHash< QString, QByteArray > mget(const QStringList &keys, QHash< QString, uint64_t > *casValues=nullptr, MemcachedReturnType *returnType=nullptr)
QHash::const_iterator constEnd() const const
The Cutelyst namespace holds all public Cutelyst API.
static bool setByKey(const QString &groupKey, const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
QHash::const_iterator constBegin() const const
static bool cas(const QString &key, const QByteArray &value, time_t expiration, uint64_t cas, MemcachedReturnType *returnType=nullptr)
The Cutelyst Application.
static QByteArray getByKey(const QString &groupKey, const QString &key, uint64_t *cas=nullptr, MemcachedReturnType *returnType=nullptr)
Cutelyst Memcached plugin.
static bool add(const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)
static bool set(const QString &key, const QByteArray &value, time_t expiration, MemcachedReturnType *returnType=nullptr)