Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

Replies

Simon Ninon edited this page Oct 15, 2016 · 6 revisions

cpp_redis::reply is the class that wraps Redis server replies.

That is, cpp_redis::reply objects are passed as parameters of commands callbacks and contain the server's response.

Methods

is_array

bool is_array(void) const

Returns whether the reply is an array or not.

is_string

bool is_string(void) const

Returns whether the reply is a string (simple string or bulk string) or not.

is_simple_string

bool is_simple_string(void) const

Returns whether the reply is a simple string or not.

is_bulk_string

bool is_bulk_string(void) const

Returns whether the reply is a bulk string or not.

is_error

bool is_error(void) const

Returns whether the reply is an error or not.

is_integer

bool is_integer(void) const

Returns whether the reply is an integer or not.

is_null

bool is_null(void) const

Returns whether the reply is null or not.

as_array

const std::vector<reply>& as_array(void) const

Returns the reply as an array.

Throws cpp_redis::redis_error if the reply is not an array.

as_string

const std::string& as_string(void) const

Returns the reply as a string.

Throws cpp_redis::redis_error if the reply is not a string.

as_integer

int as_integer(void) const

Returns the reply as an integer.

Throws cpp_redis::redis_error if the reply is not an integer.

get_type

type get_type(void) const

Return the type of the reply. The possible values are the following:

enum class type {
  array,
  bulk_string,
  error,
  integer,
  simple_string,
  null
};