10 #include <hiredis/hiredis.h> 12 #include <string_view> 33 std::string_view
host,
35 std::string_view name = std::string_view());
38 std::string_view
host()
const;
44 std::string
format(std::initializer_list<std::string_view> args);
45 std::string
format(std::vector<std::string_view>
const& args);
50 std::vector<RedisReply>
commands(std::vector<std::string>
const& cmds);
55 RedisReply set(std::string_view key, std::string_view value);
79 using Iterator = std::vector<RedisReply>::iterator;
88 bool isString()
const;
90 bool isInteger()
const;
92 bool isStatus()
const;
95 std::string string()
const;
96 std::string_view stringv()
const;
97 std::vector<std::string_view> stringvs()
const;
98 int64_t integer()
const;
99 std::string status()
const;
100 std::string_view statusv()
const;
101 std::string error()
const;
112 void ensureType(
int type)
const;
114 redisReply* reply_ =
nullptr;
116 std::vector<RedisReply> elements_;
~RedisClient()
Definition: redisclient.cpp:69
int port() const
Definition: redisclient.cpp:79
redisContext * ctx()
Definition: redisclient.cpp:203
std::vector< RedisReply >::iterator Iterator
Definition: redisclient.h:79
std::string_view host() const
Definition: redisclient.cpp:75
RedisReply getReply()
Definition: redisclient.cpp:180
bool isConnected() const
Definition: redisclient.cpp:83
void reconnect() const
Definition: redisclient.cpp:92
Wrapper class for redisReply from Hiredis.
Definition: redisclient.h:77
RedisClient(std::string_view host, int port=6379, std::string_view name=std::string_view())
Definition: redisclient.cpp:46
Simple, synchronous C++ wrapper for the Hiredis Redis client.
Definition: redisclient.h:30
The TorchCraftAI training library.
Definition: batcher.cpp:15
std::string format(char const *fmt,...)
Definition: redisclient.cpp:99
RedisReply command(char const *fmt,...)
Definition: redisclient.cpp:127
Definition: basetypes.h:349
bool ping()
Definition: redisclient.cpp:189
std::vector< RedisReply > commands(std::vector< std::string > const &cmds)
Sends a list of formatted commands in a single request.
Definition: redisclient.cpp:164