52 bool set(
const std::string& key,
const std::string& value,
int expire_seconds = 0);
60 std::optional<std::string>
get(
const std::string& key);
68 long long incr(
const std::string& key);
85 bool expire(
const std::string& key,
int seconds);
91 bool del(
const std::string& key);
101 std::string
send_command(
const std::vector<std::string>& args,
bool* no_value =
nullptr);
A synchronous Redis client providing core operations.
Definition RedisClient.hpp:14
void disconnect()
Disconnects from the Redis server.
bool connect()
Connects to the Redis server.
long long incr_with_expiry(const std::string &key, int seconds)
Increments a counter and, when this creates it, sets its expiry, atomically (one Lua script)....
std::string read_response(bool &ok, bool &no_value)
bool expire(const std::string &key, int seconds)
Sets a timeout on a key.
int fd_
Definition RedisClient.hpp:106
std::string send_command(const std::vector< std::string > &args, bool *no_value=nullptr)
std::optional< std::string > get(const std::string &key)
Gets the value of a key.
bool set(const std::string &key, const std::string &value, int expire_seconds=0)
Sets a key to hold a string value with an optional expiration time.
std::string ping()
Sends a PING command to the Redis server.
std::mutex mutex_
Definition RedisClient.hpp:107
std::string host_
Definition RedisClient.hpp:104
int port_
Definition RedisClient.hpp:105
long long incr(const std::string &key)
Increments the integer value of a key by one.
bool del(const std::string &key)
Deletes a key.
RedisClient(const std::string &host, int port)
Constructs a new RedisClient.
Definition ConnectionPool.hpp:14