TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
|
Simple, synchronous C++ wrapper for the Hiredis Redis client. More...
#include <redisclient.h>
Public Member Functions | |
RedisClient (std::string_view host, int port=6379, std::string_view name=std::string_view()) | |
~RedisClient () | |
std::string_view | host () const |
int | port () const |
bool | isConnected () const |
void | reconnect () const |
std::string | format (char const *fmt,...) |
std::string | format (std::initializer_list< std::string_view > args) |
std::string | format (std::vector< std::string_view > const &args) |
RedisReply | command (char const *fmt,...) |
RedisReply | command (std::initializer_list< std::string_view > args) |
RedisReply | command (std::vector< std::string_view > const &args) |
RedisReply | command (std::string_view cmd) |
Sends a formatted command. More... | |
std::vector< RedisReply > | commands (std::vector< std::string > const &cmds) |
Sends a list of formatted commands in a single request. More... | |
RedisReply | getReply () |
bool | ping () |
RedisReply | set (std::string_view key, std::string_view value) |
RedisReply | get (std::string_view key) |
redisContext * | ctx () |
Simple, synchronous C++ wrapper for the Hiredis Redis client.
Functionality is provided to:
Whenever an error is encountered, functions will throw runtime_errors. Note that this class is not thread-safe.
cpid::RedisClient::RedisClient | ( | std::string_view | host, |
int | port = 6379 , |
||
std::string_view | name = std::string_view() |
||
) |
cpid::RedisClient::~RedisClient | ( | ) |
RedisReply cpid::RedisClient::command | ( | char const * | fmt, |
... | |||
) |
RedisReply cpid::RedisClient::command | ( | std::initializer_list< std::string_view > | args | ) |
RedisReply cpid::RedisClient::command | ( | std::vector< std::string_view > const & | args | ) |
RedisReply cpid::RedisClient::command | ( | std::string_view | cmd | ) |
Sends a formatted command.
std::vector< RedisReply > cpid::RedisClient::commands | ( | std::vector< std::string > const & | cmds | ) |
Sends a list of formatted commands in a single request.
This function peforms pipelining, assuming all elements in cmds
are formatted Redis commands. The function will wait for all replies (i.e. cmds.size()
replies) and then return all of them.
redisContext * cpid::RedisClient::ctx | ( | ) |
std::string cpid::RedisClient::format | ( | char const * | fmt, |
... | |||
) |
std::string cpid::RedisClient::format | ( | std::initializer_list< std::string_view > | args | ) |
std::string cpid::RedisClient::format | ( | std::vector< std::string_view > const & | args | ) |
RedisReply cpid::RedisClient::get | ( | std::string_view | key | ) |
RedisReply cpid::RedisClient::getReply | ( | ) |
std::string_view cpid::RedisClient::host | ( | ) | const |
bool cpid::RedisClient::isConnected | ( | ) | const |
bool cpid::RedisClient::ping | ( | ) |
int cpid::RedisClient::port | ( | ) | const |
void cpid::RedisClient::reconnect | ( | ) | const |
RedisReply cpid::RedisClient::set | ( | std::string_view | key, |
std::string_view | value | ||
) |