rad 6.2.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
rad::DbAdapterRedis Class Reference

#include <dbAdapterRedis.hpp>

Inheritance diagram for rad::DbAdapterRedis:
rad::DbAdapter

Public Member Functions

 DbAdapterRedis ()
 
 DbAdapterRedis (const std::string &ipaddr, const int port, const timeval &timeout)
 
 ~DbAdapterRedis () override
 
void Config (const std::string &endpoint, const timeval &timeout) override
 
int Delete (const std::vector< std::string > &keys) override
 
bool Exists (const std::string &key) override
 
std::string Get (const std::string &key) override
 
std::vector< std::string > MultiGet (const std::vector< std::string > &keys) override
 
std::string Get (const std::string &key, const std::string &field) override
 
std::vector< std::string > MultiGet (const std::string &key, const std::vector< std::string > &fields) override
 
std::map< std::string, std::string > Scan (const std::string &key, const std::string &pattern) override
 
void Set (const std::string &key, const std::string &value) override
 
void MultiSet (const std::vector< std::string > &kvs) override
 
void Set (const std::string &key, const std::string &field, const std::string &value) override
 
void MultiSet (const std::string &key, const std::vector< std::string > &fvs) override
 
void Connect () override
 
void Disconnect () override
 
bool IsConnected () override
 
 DbAdapterRedis (const DbAdapterRedis &)=delete
 
DbAdapterRedisoperator= (const DbAdapterRedis &)=delete
 Disable copy constructor.
 
- Public Member Functions inherited from rad::DbAdapter
virtual ~DbAdapter ()=default
 

Detailed Description

This class can be used to access Redis Runtime DB.

Constructor & Destructor Documentation

◆ DbAdapterRedis() [1/3]

rad::DbAdapterRedis::DbAdapterRedis ( )

◆ DbAdapterRedis() [2/3]

rad::DbAdapterRedis::DbAdapterRedis ( const std::string & ipaddr,
const int port,
const timeval & timeout )
Parameters
ipaddrDB IP address.
portDB port.
timeoutTimeout for GET/SET commands.

◆ ~DbAdapterRedis()

rad::DbAdapterRedis::~DbAdapterRedis ( )
override

Disconnect from DB, if still connected.

◆ DbAdapterRedis() [3/3]

rad::DbAdapterRedis::DbAdapterRedis ( const DbAdapterRedis & )
delete

Member Function Documentation

◆ Config()

void rad::DbAdapterRedis::Config ( const std::string & endpoint,
const timeval & timeout )
overridevirtual

Reconfigure the DB connection parameters.

Parameters
endpointDB endpoint in the format of "address:port".
timeoutTimeout for GET/SET commands.

Implements rad::DbAdapter.

◆ Connect()

void rad::DbAdapterRedis::Connect ( )
overridevirtual

Connect to the DB.

Implements rad::DbAdapter.

◆ Delete()

int rad::DbAdapterRedis::Delete ( const std::vector< std::string > & keys)
overridevirtual

Delete the specified keys from the DB.

Parameters
[in]keysThe keys to delete
Returns
The number of keys deleted from the database

Implements rad::DbAdapter.

◆ Disconnect()

void rad::DbAdapterRedis::Disconnect ( )
overridevirtual

Disconnect from the DB.

Implements rad::DbAdapter.

◆ Exists()

bool rad::DbAdapterRedis::Exists ( const std::string & key)
overridevirtual

Verify if the specified key exists in the DB.

Parameters
[in]keyThe key to verify
Returns
true if the key exists in the database, false otherwise

Implements rad::DbAdapter.

◆ Get() [1/2]

std::string rad::DbAdapterRedis::Get ( const std::string & key)
overridevirtual

Retrieve from the DB the value associated to the key.

Parameters
[in]keyAn existing key
Returns
The value associated to the given Key.

Implements rad::DbAdapter.

◆ Get() [2/2]

std::string rad::DbAdapterRedis::Get ( const std::string & key,
const std::string & field )
overridevirtual

Retrieve from the DB the specified field of a key.

Parameters
[in]keyAn existing key
[in]fieldAn existing field of the key
Returns
The value for the field.

Implements rad::DbAdapter.

◆ IsConnected()

bool rad::DbAdapterRedis::IsConnected ( )
overridevirtual

Verify the connectivity to the DB.

Returns
true if PING command succeeds, false otherwise.

Implements rad::DbAdapter.

◆ MultiGet() [1/2]

std::vector< std::string > rad::DbAdapterRedis::MultiGet ( const std::string & key,
const std::vector< std::string > & fields )
overridevirtual

Retrieve from the DB the values associated to multiple fields of a key.

Parameters
[in]keyAn existing key
[in]fieldsVector of fields. If empty, returns all fields and values.
Returns
The values associated to the given fields of the specified key.

Implements rad::DbAdapter.

◆ MultiGet() [2/2]

std::vector< std::string > rad::DbAdapterRedis::MultiGet ( const std::vector< std::string > & keys)
overridevirtual

Retrieve from the DB the values associated to multiple keys.

Parameters
[in]keysVector of keys
Returns
The value associated to the given keys.

Implements rad::DbAdapter.

◆ MultiSet() [1/2]

void rad::DbAdapterRedis::MultiSet ( const std::string & key,
const std::vector< std::string > & fvs )
overridevirtual

Set in the DB multiple values associated to multiple fields of a key.

Parameters
[in]keyThe new or existing key.
[in]fvsVector of field-value pairs.

Implements rad::DbAdapter.

◆ MultiSet() [2/2]

void rad::DbAdapterRedis::MultiSet ( const std::vector< std::string > & kvs)
overridevirtual

Set in the DB multiple values associated to multiple keys.

Parameters
[in]kvsVector of key-value paris.

Implements rad::DbAdapter.

◆ operator=()

DbAdapterRedis & rad::DbAdapterRedis::operator= ( const DbAdapterRedis & )
delete

Disable copy constructor.

◆ Scan()

std::map< std::string, std::string > rad::DbAdapterRedis::Scan ( const std::string & key,
const std::string & pattern )
overridevirtual

Retrieve from the DB, the entry associated to value/partial value.

Parameters
[in]keyAn existing key.
[in]patternValue or partial value.
Returns
All db entries with value mathching the pattern.

Implements rad::DbAdapter.

◆ Set() [1/2]

void rad::DbAdapterRedis::Set ( const std::string & key,
const std::string & field,
const std::string & value )
overridevirtual

Set in the DB a field associated to a key.

Parameters
[in]keyThe new or existing key
[in]fieldThe new or existing field
[in]valueThe value associated to the field

Implements rad::DbAdapter.

◆ Set() [2/2]

void rad::DbAdapterRedis::Set ( const std::string & key,
const std::string & value )
overridevirtual

Set in the DB the value associated to the key.

Parameters
[in]keyThe new or existing key
[in]valueThe value associated to the key

Implements rad::DbAdapter.


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