TreeFrogFramework  2.8
tmemcached.h
Go to the documentation of this file.
1 #pragma once
2 #include <QByteArray>
3 #include <QStringList>
4 #include <TGlobal>
5 #include <TKvsDatabase>
6 #include <TfNamespace>
7 
8 class TMemcachedDriver;
9 
10 
12 public:
13  TMemcached();
14  virtual ~TMemcached() { }
15 
16  bool isOpen() const;
17  QByteArray get(const QByteArray &key, uint *flags = nullptr);
18  int64_t getNumber(const QByteArray &key, bool *ok = nullptr, uint *flags = nullptr);
19  bool set(const QByteArray &key, const QByteArray &value, int seconds, uint flags = 0);
20  bool set(const QByteArray &key, int64_t value, int seconds, uint flags = 0);
21  bool add(const QByteArray &key, const QByteArray &value, int seconds, uint flags = 0);
22  bool add(const QByteArray &key, int64_t value, int seconds, uint flags = 0);
23  bool replace(const QByteArray &key, const QByteArray &value, int seconds, uint flags = 0);
24  bool replace(const QByteArray &key, int64_t value, int seconds, uint flags = 0);
25  bool append(const QByteArray &key, const QByteArray &value, int seconds, uint flags = 0);
26  bool prepend(const QByteArray &key, const QByteArray &value, int seconds, uint flags = 0);
27  bool remove(const QByteArray &key);
28  uint64_t incr(const QByteArray &key, uint64_t value, bool *ok = nullptr);
29  uint64_t decr(const QByteArray &key, uint64_t value, bool *ok = nullptr);
30  bool flushAll();
31  QByteArray version();
32 
33 private:
34  QByteArray request(const QByteArray &command, const QByteArray &key, const QByteArray &value, uint flags, int exptime, bool noreply);
35  QByteArray requestLine(const QByteArray &command, const QByteArray &key, const QByteArray &value, bool noreply);
36 
37  TMemcached(Tf::KvsEngine engine);
38  TMemcachedDriver *driver();
39  const TMemcachedDriver *driver() const;
40 
41  TKvsDatabase _database;
42 
43  friend class TCacheMemcachedStore;
46 };
The TMemcached class provides a means of operating a Memcached system.
Definition: tmemcached.h:11
virtual ~TMemcached()
Definition: tmemcached.h:14
KvsEngine
Definition: tfnamespace.h:239
#define T_CORE_EXPORT
Definition: tdeclexport.h:28
#define T_DISABLE_COPY(Class)
Definition: tdeclexport.h:37
#define T_DISABLE_MOVE(Class)
Definition: tdeclexport.h:41