#include <dbAdapterRedis.hpp>
|
| | 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 |
| |
| DbAdapterRedis & | operator= (const DbAdapterRedis &)=delete |
| | Disable copy constructor.
|
| |
| virtual | ~DbAdapter ()=default |
| |
This class can be used to access Redis Runtime DB.
◆ DbAdapterRedis() [1/3]
| rad::DbAdapterRedis::DbAdapterRedis |
( |
| ) |
|
◆ DbAdapterRedis() [2/3]
| rad::DbAdapterRedis::DbAdapterRedis |
( |
const std::string & | ipaddr, |
|
|
const int | port, |
|
|
const timeval & | timeout ) |
- Parameters
-
| ipaddr | DB IP address. |
| port | DB port. |
| timeout | Timeout for GET/SET commands. |
◆ ~DbAdapterRedis()
| rad::DbAdapterRedis::~DbAdapterRedis |
( |
| ) |
|
|
override |
Disconnect from DB, if still connected.
◆ DbAdapterRedis() [3/3]
◆ Config()
| void rad::DbAdapterRedis::Config |
( |
const std::string & | endpoint, |
|
|
const timeval & | timeout ) |
|
overridevirtual |
Reconfigure the DB connection parameters.
- Parameters
-
| endpoint | DB endpoint in the format of "address:port". |
| timeout | Timeout for GET/SET commands. |
Implements rad::DbAdapter.
◆ Connect()
| void rad::DbAdapterRedis::Connect |
( |
| ) |
|
|
overridevirtual |
◆ Delete()
| int rad::DbAdapterRedis::Delete |
( |
const std::vector< std::string > & | keys | ) |
|
|
overridevirtual |
Delete the specified keys from the DB.
- Parameters
-
| [in] | keys | The keys to delete |
- Returns
- The number of keys deleted from the database
Implements rad::DbAdapter.
◆ Disconnect()
| void rad::DbAdapterRedis::Disconnect |
( |
| ) |
|
|
overridevirtual |
◆ Exists()
| bool rad::DbAdapterRedis::Exists |
( |
const std::string & | key | ) |
|
|
overridevirtual |
Verify if the specified key exists in the DB.
- Parameters
-
- 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
-
- 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] | key | An existing key |
| [in] | field | An 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] | key | An existing key |
| [in] | fields | Vector 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
-
- 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] | key | The new or existing key. |
| [in] | fvs | Vector 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] | kvs | Vector of key-value paris. |
Implements rad::DbAdapter.
◆ operator=()
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] | key | An existing key. |
| [in] | pattern | Value 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] | key | The new or existing key |
| [in] | field | The new or existing field |
| [in] | value | The 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] | key | The new or existing key |
| [in] | value | The value associated to the key |
Implements rad::DbAdapter.
The documentation for this class was generated from the following files: