redis3m  1.0.0
 All Classes Functions Variables Enumerations Pages
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
redis3m::connection Class Reference

The connection class, represent a connection to a Redis server. More...

#include <connection.h>

Inheritance diagram for redis3m::connection:

Public Types

enum  role_t { ANY = 0, MASTER = 1, SLAVE = 2 }
 
typedef boost::shared_ptr
< connection
ptr_t
 

Public Member Functions

bool is_valid ()
 
void append (const std::vector< std::string > &args)
 Append a command to Redis server. More...
 
reply get_reply ()
 Get a reply from server, blocking call if no reply is ready. More...
 
std::vector< replyget_replies (unsigned int count)
 Get specific count of replies requested, blocking if they are not ready yet. More...
 
reply run (const std::vector< std::string > &args)
 Utility to call append and then get_reply together. More...
 
redisContext * c_ptr ()
 Returns raw ptr to hiredis library connection. Use it with caution and pay attention on memory management. More...
 

Static Public Member Functions

static ptr_t create (const std::string &host="localhost", const unsigned int port=6379)
 Create and open a new connection. More...
 

Friends

class connection_pool
 

Detailed Description

The connection class, represent a connection to a Redis server.

Member Function Documentation

void connection::append ( const std::vector< std::string > &  args)

Append a command to Redis server.

Parameters
argsvector with args, example [ "SET", "foo", "bar" ]
redisContext* redis3m::connection::c_ptr ( )
inline

Returns raw ptr to hiredis library connection. Use it with caution and pay attention on memory management.

Returns
static ptr_t redis3m::connection::create ( const std::string &  host = "localhost",
const unsigned int  port = 6379 
)
inlinestatic

Create and open a new connection.

Parameters
hosthostname or ip of redis server, default localhost
portport of redis server, default: 6379
Returns
std::vector< reply > connection::get_replies ( unsigned int  count)

Get specific count of replies requested, blocking if they are not ready yet.

Parameters
count
Returns
reply connection::get_reply ( )

Get a reply from server, blocking call if no reply is ready.

Returns
reply object
reply redis3m::connection::run ( const std::vector< std::string > &  args)
inline

Utility to call append and then get_reply together.

Parameters
argssame as append()
Returns
reply object

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