cpp_redis  4.0.0
cpp_redis is a C++11 Asynchronous Multi-Platform Lightweight Redis Client, with support for synchronous operations and pipelining.
Public Member Functions | List of all members
cpp_redis::network::tcp_client Class Reference

#include <tcp_client.hpp>

Inheritance diagram for cpp_redis::network::tcp_client:
cpp_redis::network::tcp_client_iface

Public Member Functions

 tcp_client (void)=default
 ctor
 
 ~tcp_client (void)=default
 dtor
 
void connect (const std::string &addr, std::uint32_t port, std::uint32_t timeout_msecs)
 
void disconnect (bool wait_for_removal=false)
 
bool is_connected (void) const
 
void set_nb_workers (std::size_t nb_threads)
 
void async_read (read_request &request)
 
void async_write (write_request &request)
 
void set_on_disconnection_handler (const disconnection_handler_t &disconnection_handler)
 
- Public Member Functions inherited from cpp_redis::network::tcp_client_iface
 tcp_client_iface (void)=default
 ctor
 
virtual ~tcp_client_iface (void)=default
 dtor
 

Additional Inherited Members

- Public Types inherited from cpp_redis::network::tcp_client_iface
typedef std::function< void(read_result &)> async_read_callback_t
 
typedef std::function< void(write_result &)> async_write_callback_t
 
typedef std::function< void()> disconnection_handler_t
 

Detailed Description

implementation of the tcp_client_iface based on tacopie networking library

Member Function Documentation

◆ async_read()

void cpp_redis::network::tcp_client::async_read ( read_request request)
virtual

async read operation

Parameters
requestinformation about what should be read and what should be done after completion

Implements cpp_redis::network::tcp_client_iface.

◆ async_write()

void cpp_redis::network::tcp_client::async_write ( write_request request)
virtual

async write operation

Parameters
requestinformation about what should be written and what should be done after completion

Implements cpp_redis::network::tcp_client_iface.

◆ connect()

void cpp_redis::network::tcp_client::connect ( const std::string &  addr,
std::uint32_t  port,
std::uint32_t  timeout_msecs 
)
virtual

start the tcp client

Parameters
addrhost to be connected to
portport to be connected to
timeout_msecsmax time to connect in ms

Implements cpp_redis::network::tcp_client_iface.

◆ disconnect()

void cpp_redis::network::tcp_client::disconnect ( bool  wait_for_removal = false)
virtual

stop the tcp client

Parameters
wait_for_removalwhen sets to true, disconnect blocks until the underlying TCP client has been effectively removed from the io_service and that all the underlying callbacks have completed.

Implements cpp_redis::network::tcp_client_iface.

◆ is_connected()

bool cpp_redis::network::tcp_client::is_connected ( void  ) const
virtual
Returns
whether the client is currently connected or not

Implements cpp_redis::network::tcp_client_iface.

◆ set_nb_workers()

void cpp_redis::network::tcp_client::set_nb_workers ( std::size_t  nb_threads)

set number of io service workers for the io service monitoring this tcp connection

Parameters
nb_threadsnumber of threads to be assigned

◆ set_on_disconnection_handler()

void cpp_redis::network::tcp_client::set_on_disconnection_handler ( const disconnection_handler_t disconnection_handler)
virtual

set on disconnection handler

Parameters
disconnection_handlerhandler to be called in case of a disconnection

Implements cpp_redis::network::tcp_client_iface.


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