#include <redis_client.hpp>
|
|
| RedisClient (const RedisClient &)=delete |
|
RedisClient & | operator= (const RedisClient &)=delete |
| bool | Connect (const std::string &host, int port, std::chrono::milliseconds timeout) |
| void | Close () |
| bool | Ping () |
| bool | Publish (const std::string &channel, const std::string &payload) |
| bool | Set (const std::string &key, const std::string &value) |
| bool | Del (const std::string &key) |
| std::optional< std::string > | LPop (const std::string &key, bool *ok) |
| const std::string & | last_error () const |
| void | SetResponseLimits (size_t max_bulk_string_bytes, size_t max_array_elements) |
Lightweight Redis client using RESP protocol over raw sockets.
Implements minimal Redis command support for pub/sub and basic operations. Not thread-safe - external synchronization required for concurrent access.
◆ Close()
| void presage::smartspectra::redis_ipc::RedisClient::Close |
( |
| ) |
|
Close connection and reset state.
◆ Connect()
| bool presage::smartspectra::redis_ipc::RedisClient::Connect |
( |
const std::string & | host, |
|
|
int | port, |
|
|
std::chrono::milliseconds | timeout ) |
Connect to Redis server.
- Parameters
-
| host | Redis server hostname or IP |
| port | Redis server port |
| timeout | Connection and operation timeout |
- Returns
- true if connection successful
◆ Del()
| bool presage::smartspectra::redis_ipc::RedisClient::Del |
( |
const std::string & | key | ) |
|
Delete key from Redis.
- Parameters
-
- Returns
- true if delete successful
◆ last_error()
| const std::string & presage::smartspectra::redis_ipc::RedisClient::last_error |
( |
| ) |
const |
|
inline |
Get last error message.
- Returns
- Error description
◆ LPop()
| std::optional< std::string > presage::smartspectra::redis_ipc::RedisClient::LPop |
( |
const std::string & | key, |
|
|
bool * | ok ) |
Pop element from left of list.
- Parameters
-
| key | List key |
| ok | Output parameter for operation success |
- Returns
- Value if present, nullopt if empty/error
◆ Ping()
| bool presage::smartspectra::redis_ipc::RedisClient::Ping |
( |
| ) |
|
Ping Redis server to verify connectivity.
- Returns
- true if server responds with PONG
◆ Publish()
| bool presage::smartspectra::redis_ipc::RedisClient::Publish |
( |
const std::string & | channel, |
|
|
const std::string & | payload ) |
Publish message to Redis channel.
- Parameters
-
| channel | Channel name |
| payload | Message payload |
- Returns
- true if publish successful
◆ Set()
| bool presage::smartspectra::redis_ipc::RedisClient::Set |
( |
const std::string & | key, |
|
|
const std::string & | value ) |
Set key-value pair in Redis.
- Parameters
-
| key | Key name |
| value | Value to store |
- Returns
- true if set successful
◆ SetResponseLimits()
| void presage::smartspectra::redis_ipc::RedisClient::SetResponseLimits |
( |
size_t | max_bulk_string_bytes, |
|
|
size_t | max_array_elements ) |
Configure safety limits for RESP replies.
- Parameters
-
| max_bulk_string_bytes | 0 for unlimited, otherwise maximum bulk payload size in bytes |
| max_array_elements | 0 for unlimited, otherwise maximum array element count |
The documentation for this class was generated from the following files: