SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
presage::smartspectra::redis_ipc::RedisClient Class Reference

#include <redis_client.hpp>

Public Member Functions

 RedisClient (const RedisClient &)=delete
RedisClientoperator= (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)

Detailed Description

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.

Member Function Documentation

◆ 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
hostRedis server hostname or IP
portRedis server port
timeoutConnection 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
keyKey to delete
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
keyList key
okOutput 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
channelChannel name
payloadMessage 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
keyKey name
valueValue 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_bytes0 for unlimited, otherwise maximum bulk payload size in bytes
max_array_elements0 for unlimited, otherwise maximum array element count

The documentation for this class was generated from the following files: