acl  3.5.3.0
acl::redis_hash类 参考

#include <redis_hash.hpp>

+ 类 acl::redis_hash 继承关系图:
+ acl::redis_hash 的协作图:

Public 成员函数

 redis_hash (void)
 
 redis_hash (redis_client *conn)
 
 redis_hash (redis_client_cluster *cluster)
 
ACL_CPP_DEPRECATED redis_hash (redis_client_cluster *cluster, size_t max_conns)
 
 redis_hash (redis_client_pipeline *pipeline)
 
virtual ~redis_hash (void)
 
bool hmset (const char *key, const std::map< string, string > &attrs)
 
bool hmset (const char *key, size_t klen, const std::map< string, string > &attrs)
 
bool hmset (const char *key, const std::map< string, const char * > &attrs)
 
bool hmset (const char *key, const std::vector< string > &names, const std::vector< string > &values)
 
bool hmset (const char *key, size_t klen, const std::vector< string > &names, const std::vector< string > &values)
 
bool hmset (const char *key, const std::vector< const char * > &names, const std::vector< const char * > &values)
 
bool hmset (const char *key, const char *names[], const char *values[], size_t argc)
 
bool hmset (const char *key, const char *names[], const size_t names_len[], const char *values[], const size_t values_len[], size_t argc)
 
bool hmset (const char *key, size_t klen, const char *names[], const size_t names_len[], const char *values[], const size_t values_len[], size_t argc)
 
bool hmget (const char *key, const std::vector< string > &names, std::vector< string > *result=NULL)
 
bool hmget (const char *key, size_t klen, const std::vector< string > &names, std::vector< string > *result=NULL)
 
bool hmget (const char *key, const std::vector< const char * > &names, std::vector< string > *result=NULL)
 
bool hmget (const char *key, const char *names[], size_t argc, std::vector< string > *result=NULL)
 
bool hmget (const char *key, const char *names[], const size_t lens[], size_t argc, std::vector< string > *result=NULL)
 
bool hmget (const char *key, size_t klen, const char *names[], const size_t lens[], size_t argc, std::vector< string > *result=NULL)
 
int hset (const char *key, const char *name, const char *value)
 
int hset (const char *key, const char *name, const char *value, size_t value_len)
 
int hset (const char *key, const char *name, size_t name_len, const char *value, size_t value_len)
 
int hset (const char *key, size_t klen, const char *name, size_t name_len, const char *value, size_t value_len)
 
int hsetnx (const char *key, const char *name, const char *value)
 
int hsetnx (const char *key, const char *name, const char *value, size_t value_len)
 
int hsetnx (const char *key, const char *name, size_t name_len, const char *value, size_t value_len)
 
int hsetnx (const char *key, size_t klen, const char *name, size_t name_len, const char *value, size_t value_len)
 
bool hget (const char *key, const char *name, string &result)
 
bool hget (const char *key, const char *name, size_t name_len, string &result)
 
bool hget (const char *key, size_t klen, const char *name, size_t name_len, string &result)
 
bool hgetall (const char *key, std::map< string, string > &result)
 
bool hgetall (const char *key, size_t klen, std::map< string, string > &result)
 
bool hgetall (const char *key, std::vector< string > &names, std::vector< string > &values)
 
bool hgetall (const char *key, size_t klen, std::vector< string > &names, std::vector< string > &values)
 
bool hgetall (const char *key, std::vector< const char * > &names, std::vector< const char * > &values)
 
int hdel (const char *key, const char *first_name)
 
int hdel (const char *key, const char *names[], size_t argc)
 
int hdel (const char *key, const char *names[], const size_t names_len[], size_t argc)
 
int hdel (const char *key, size_t klen, const char *names[], const size_t names_len[], size_t argc)
 
int hdel (const char *key, const std::vector< string > &names)
 
int hdel (const char *key, size_t klen, const std::vector< string > &names)
 
int hdel (const char *key, const std::vector< const char * > &names)
 
int hdel_fields (const char *key, const char *names[], size_t argc)
 
int hdel_fields (const char *key, const char *names[], const size_t names_len[], size_t argc)
 
int hdel_fields (const char *key, size_t klen, const char *names[], const size_t names_len[], size_t argc)
 
int hdel_fields (const char *key, const std::vector< string > &names)
 
int hdel_fields (const char *key, size_t klen, const std::vector< string > &names)
 
int hdel_fields (const char *key, const std::vector< const char * > &names)
 
int hdel_fields (const char *key, const char *first_name,...)
 
bool hincrby (const char *key, const char *name, long long int inc, long long int *result=NULL)
 
bool hincrbyfloat (const char *key, const char *name, double inc, double *result=NULL)
 
bool hkeys (const char *key, std::vector< string > &names)
 
bool hkeys (const char *key, size_t klen, std::vector< string > &names)
 
bool hexists (const char *key, const char *name)
 
bool hexists (const char *key, const char *name, size_t name_len)
 
bool hexists (const char *key, size_t klen, const char *name, size_t name_len)
 
bool hvals (const char *key, std::vector< string > &values)
 
bool hvals (const char *key, size_t klen, std::vector< string > &values)
 
int hlen (const char *key)
 
int hlen (const char *key, size_t klen)
 
int hstrlen (const char *key, const char *name, size_t name_len)
 
int hstrlen (const char *key, size_t klen, const char *name, size_t name_len)
 
int hstrlen (const char *key, const char *name)
 
int hscan (const char *key, int cursor, std::map< string, string > &out, const char *pattern=NULL, const size_t *count=NULL)
 
int hscan (const char *key, size_t klen, int cursor, std::map< string, string > &out, const char *pattern=NULL, const size_t *count=NULL)
 
- Public 成员函数 继承自 acl::redis_command
 redis_command (void)
 
 redis_command (redis_client *conn)
 
 redis_command (redis_client_cluster *cluster)
 
ACL_CPP_DEPRECATED redis_command (redis_client_cluster *cluster, size_t max_conns)
 
 redis_command (redis_client_pipeline *pipeline)
 
virtual ~redis_command (void)
 
void set_check_addr (bool on)
 
void clear (bool save_slot=false)
 
void reset (bool save_slot=false)
 
void set_client (redis_client *conn)
 
redis_clientget_client (void) const
 
const char * get_client_addr (void) const
 
void set_cluster (redis_client_cluster *cluster)
 
ACL_CPP_DEPRECATED void set_cluster (redis_client_cluster *cluster, size_t max_conns)
 
redis_client_clusterget_cluster (void) const
 
void set_pipeline (redis_client_pipeline *pipeline, bool use_mbox=true)
 
redis_client_pipelineget_pipeline (void) const
 
dbuf_poolget_dbuf (void) const
 
redis_result_t result_type (void) const
 
const char * result_status (void) const
 
const char * result_error (void) const
 
size_t result_size (void) const
 
int result_number (bool *success=NULL) const
 
long long int result_number64 (bool *success=NULL) const
 
const char * get_result (size_t i, size_t *len=NULL) const
 
bool eof (void) const
 
const redis_resultget_result (void) const
 
const redis_resultresult_child (size_t i) const
 
const char * result_value (size_t i, size_t *len=NULL) const
 
void set_slice_request (bool on)
 
void set_slice_respond (bool on)
 
const redis_resultrequest (size_t argc, const char *argv[], size_t lens[], size_t nchild=0)
 
const redis_resultrequest (const std::vector< string > &args, size_t nchild=0)
 
const stringrequest_buf (void) const
 
void build_request (size_t argc, const char *argv[], size_t lens[])
 
void hash_slot (const char *key)
 
void hash_slot (const char *key, size_t len)
 
int get_slot (void) const
 
bool is_check_addr (void) const
 
const char * get_addr (const char *info)
 
void set_client_addr (const char *addr)
 
void set_client_addr (redis_client &conn)
 
redis_request * get_request_obj (void) const
 
stringget_request_buf (void) const
 
bool is_slice_req (void) const
 
redis_pipeline_messageget_pipeline_message (void)
 

额外继承的成员函数

- 静态 Public 成员函数 继承自 acl::redis_command
static void build_request (size_t argc, const char *argv[], size_t lens[], string &out)
 
- Protected 成员函数 继承自 acl::redis_command
const redis_resultrun (size_t nchild=0, int *timeout=NULL)
 
void clear_request (void)
 
const redis_result ** scan_keys (const char *cmd, const char *key, int &cursor, size_t &size, const char *pattern, const size_t *count)
 
const redis_result ** scan_keys (const char *cmd, const char *key, size_t klen, int &cursor, size_t &size, const char *pattern, const size_t *count)
 
void build (const char *cmd, const char *key, const std::map< string, string > &attrs)
 
void build (const char *cmd, const char *key, size_t klen, const std::map< string, string > &attrs)
 
void build (const char *cmd, const char *key, const std::map< string, const char * > &attrs)
 
void build (const char *cmd, const char *key, const std::vector< string > &names, const std::vector< string > &values)
 
void build (const char *cmd, const char *key, size_t klen, const std::vector< string > &names, const std::vector< string > &values)
 
void build (const char *cmd, const char *key, const std::vector< const char * > &names, const std::vector< const char * > &values)
 
void build (const char *cmd, const char *key, const char *names[], const char *values[], size_t argc)
 
void build (const char *cmd, const char *key, const int names[], const char *values[], size_t argc)
 
void build (const char *cmd, const char *key, const char *names[], const size_t names_len[], const char *values[], const size_t values_len[], size_t argc)
 
void build (const char *cmd, const char *key, size_t klen, const char *names[], const size_t names_len[], const char *values[], const size_t values_len[], size_t argc)
 
void build (const char *cmd, const char *key, const std::vector< string > &names)
 
void build (const char *cmd, const char *key, size_t klen, const std::vector< string > &names)
 
void build (const char *cmd, const char *key, const std::vector< const char * > &names)
 
void build (const char *cmd, const char *key, const std::vector< int > &names)
 
void build (const char *cmd, const char *key, const char *names[], size_t argc)
 
void build (const char *cmd, const char *key, const char *names[], const size_t lens[], size_t argc)
 
void build (const char *cmd, const char *key, size_t klen, const char *names[], const size_t lens[], size_t argc)
 
void build (const char *cmd, const char *key, const int names[], size_t argc)
 
int get_number (bool *success=NULL)
 
long long int get_number64 (bool *success=NULL)
 
int get_number (std::vector< int > &out)
 
int get_number64 (std::vector< long long int > &out)
 
bool check_status (const char *success="OK")
 
int get_status (std::vector< bool > &out)
 
const char * get_status (void)
 
int get_string (string &buf)
 
int get_string (string *buf)
 
int get_string (char *buf, size_t size)
 
int get_strings (std::vector< string > &result)
 
int get_strings (std::vector< string > *result)
 
int get_strings (std::list< string > &result)
 
int get_strings (std::list< string > *result)
 
int get_strings (std::map< string, string > &result)
 
int get_strings (std::vector< string > &names, std::vector< string > &values)
 
int get_strings (std::vector< const char * > &names, std::vector< const char * > &values)
 
void argv_space (size_t n)
 
void build_request1 (size_t argc, const char *argv[], size_t lens[])
 
void build_request2 (size_t argc, const char *argv[], size_t lens[])
 
void logger_result (const redis_result *result)
 
- Protected 成员函数 继承自 acl::acl::noncopyable
 noncopyable ()
 
 ~noncopyable ()
 
- Protected 属性 继承自 acl::redis_command
dbuf_pooldbuf_
 
bool check_addr_
 
char addr_ [32]
 
redis_clientconn_
 
redis_client_clustercluster_
 
redis_client_pipelinepipeline_
 
bool pipe_use_mbox_
 
int slot_
 
int redirect_max_
 
int redirect_sleep_
 
bool slice_req_
 
stringrequest_buf_
 
redis_request * request_obj_
 
size_t argv_size_
 
const char ** argv_
 
size_t * argv_lens_
 
size_t argc_
 
bool slice_res_
 
redis_pipeline_messagepipe_msg_
 
const redis_resultresult_
 

详细描述

redis Hash(哈希表) 类,本类的实现的主要命令: redis Hash class, include commands as below: HDEL/HEXISTS/HGET/HGETALL/HINCRBY/HINCRBYFLOAT/HKEYS/HLEN/HMGET/HMSET HSET/HSETNX/HVALS/HSCAN

在文件 redis_hash.hpp19 行定义.

构造及析构函数说明

◆ redis_hash() [1/5]

acl::redis_hash::redis_hash ( void  )

◆ redis_hash() [2/5]

acl::redis_hash::redis_hash ( redis_client conn)

◆ redis_hash() [3/5]

acl::redis_hash::redis_hash ( redis_client_cluster cluster)

◆ redis_hash() [4/5]

ACL_CPP_DEPRECATED acl::redis_hash::redis_hash ( redis_client_cluster cluster,
size_t  max_conns 
)

◆ redis_hash() [5/5]

acl::redis_hash::redis_hash ( redis_client_pipeline pipeline)

◆ ~redis_hash()

virtual acl::redis_hash::~redis_hash ( void  )
virtual

成员函数说明

◆ hdel() [1/7]

int acl::redis_hash::hdel ( const char *  key,
const char *  first_name 
)

从 redis 哈希表中删除某个 key 对象的某些域字段 remove one or more fields from hash stored at key

参数
key{const char*} key 键值 the hash key
first_name{const char*} 第一个域字段名,最后一个字段必须是 NULL the first field of the fields list, the last field must be NULL indicating the end of vary parameters
返回
{int} 成功删除的域字段个数,返回 -1 表示出错或该 key 对象非哈希对象 return the number of fields be removed successfully, or -1 when error happened or operating on a no hash key

◆ hdel() [2/7]

int acl::redis_hash::hdel ( const char *  key,
const char *  names[],
size_t  argc 
)

◆ hdel() [3/7]

int acl::redis_hash::hdel ( const char *  key,
const char *  names[],
const size_t  names_len[],
size_t  argc 
)

◆ hdel() [4/7]

int acl::redis_hash::hdel ( const char *  key,
size_t  klen,
const char *  names[],
const size_t  names_len[],
size_t  argc 
)

◆ hdel() [5/7]

int acl::redis_hash::hdel ( const char *  key,
const std::vector< string > &  names 
)

◆ hdel() [6/7]

int acl::redis_hash::hdel ( const char *  key,
size_t  klen,
const std::vector< string > &  names 
)

◆ hdel() [7/7]

int acl::redis_hash::hdel ( const char *  key,
const std::vector< const char * > &  names 
)

◆ hdel_fields() [1/7]

int acl::redis_hash::hdel_fields ( const char *  key,
const char *  names[],
size_t  argc 
)

◆ hdel_fields() [2/7]

int acl::redis_hash::hdel_fields ( const char *  key,
const char *  names[],
const size_t  names_len[],
size_t  argc 
)

◆ hdel_fields() [3/7]

int acl::redis_hash::hdel_fields ( const char *  key,
size_t  klen,
const char *  names[],
const size_t  names_len[],
size_t  argc 
)

◆ hdel_fields() [4/7]

int acl::redis_hash::hdel_fields ( const char *  key,
const std::vector< string > &  names 
)

◆ hdel_fields() [5/7]

int acl::redis_hash::hdel_fields ( const char *  key,
size_t  klen,
const std::vector< string > &  names 
)

◆ hdel_fields() [6/7]

int acl::redis_hash::hdel_fields ( const char *  key,
const std::vector< const char * > &  names 
)

◆ hdel_fields() [7/7]

int acl::redis_hash::hdel_fields ( const char *  key,
const char *  first_name,
  ... 
)

◆ hexists() [1/3]

bool acl::redis_hash::hexists ( const char *  key,
const char *  name 
)

检查 key 对象中某个域字段是否存在 check if the field exists in hash stored at key

参数
key{const char*} key 键值 the hash key
name{const char*} key 对象的域字段名称 the filed's name of the key
返回
{bool} 操作是否成功,返回 false 表明出错或该 key 对象非哈希对象 或该域字段不存在 return true on success, false if error happened or the key wasn't a hash key

◆ hexists() [2/3]

bool acl::redis_hash::hexists ( const char *  key,
const char *  name,
size_t  name_len 
)

◆ hexists() [3/3]

bool acl::redis_hash::hexists ( const char *  key,
size_t  klen,
const char *  name,
size_t  name_len 
)

◆ hget() [1/3]

bool acl::redis_hash::hget ( const char *  key,
const char *  name,
string result 
)

从 redis 哈希表中获取某个 key 对象的某个域的值 get the value assosiated with field in the hash stored at key

参数
key{const char*} key 键值 the hash key
name{const char*} key 对象的域字段名称 the field's name
result{acl::string&} 存储查询结果值(内部对该 string 进行内容追加) store the value result of the given field
返回
{bool} 返回值含义: true – 操作成功,当result为空时表示 KEY 或字段域不存在 get the value associated with field; if result is empty then the key or the name field doesn't exist false – 域字段不存在或操作失败或该 key 对象非哈希对象 the field not exists, or error happened, or the key isn't a hash key

◆ hget() [2/3]

bool acl::redis_hash::hget ( const char *  key,
const char *  name,
size_t  name_len,
string result 
)

◆ hget() [3/3]

bool acl::redis_hash::hget ( const char *  key,
size_t  klen,
const char *  name,
size_t  name_len,
string result 
)

◆ hgetall() [1/5]

bool acl::redis_hash::hgetall ( const char *  key,
std::map< string, string > &  result 
)

从 redis 哈希表中获取某个 key 对象的所有域字段的值 get all the fields and values in hash stored at key

参数
key{const char*} key 键值 the hash key
result{std::map<string, string>&} 存储域字段名-值查询结果集 store the result of all the fileds and values
返回
{bool} 操作是否成功,含义: if ok, show below: true – 操作成功,当该域不存在时也返回成功,需要检查 result 内容是否变化, 比如可以通过检查 result.size() 的变化来表明是否查询到结果 successful if the key is a hash key or the key not exists false – 操作失败或该 key 对象非哈希对象 error happened or the key isn't a hash key

◆ hgetall() [2/5]

bool acl::redis_hash::hgetall ( const char *  key,
size_t  klen,
std::map< string, string > &  result 
)

◆ hgetall() [3/5]

bool acl::redis_hash::hgetall ( const char *  key,
std::vector< string > &  names,
std::vector< string > &  values 
)

◆ hgetall() [4/5]

bool acl::redis_hash::hgetall ( const char *  key,
size_t  klen,
std::vector< string > &  names,
std::vector< string > &  values 
)

◆ hgetall() [5/5]

bool acl::redis_hash::hgetall ( const char *  key,
std::vector< const char * > &  names,
std::vector< const char * > &  values 
)

◆ hincrby()

bool acl::redis_hash::hincrby ( const char *  key,
const char *  name,
long long int  inc,
long long int *  result = NULL 
)

当某个 key 对象中的某个域字段为整数时,对其进行加减操作 inc(+n) or dec(-n) on a integer filed in hash stored at key

参数
key{const char*} key 键值 the hash key
name{const char*} key 对象的域字段名称 the filed name of integer type
inc{long long int} 增加的值,可以为负值 the integer value to be inc or dec on the field's value
result{long long int*} 非 NULL 时存储结果值 store the result if non-NULL
返回
{bool} 操作是否成功,当返回 false 时表明出错或该 key 对象非哈希 对象或该域字段非整数类型 if successful: false when error, not a hash, or the field isn't integer type

◆ hincrbyfloat()

bool acl::redis_hash::hincrbyfloat ( const char *  key,
const char *  name,
double  inc,
double *  result = NULL 
)

当某个 key 对象中的某个域字段为浮点数时,对其进行加减操作 inc(+n) or dec(-n) on a float filed in hash stored at key

参数
key{const char*} key 键值 the hash key
name{const char*} key 对象的域字段名称 the filed name of float type
inc{double} 增加的值,可以为负值 the float value to be inc or dec on the field's value
result{double*} 非 NULL 时存储结果值 store the result if non-NULL
返回
{bool} 操作是否成功,当返回 false 时表明出错或该 key 对象非哈希 对象或该域字段非浮点数类型 if successful: false when error, not a hash, or the field isn't float type

◆ hkeys() [1/2]

bool acl::redis_hash::hkeys ( const char *  key,
std::vector< string > &  names 
)

返回 key 对象中所有域字段名称 get all the fields in hash stored at key

参数
key{const char*} key 键值 the hash key
names{std::vector<string>&} 存储该 key 对象所有域字段名称 store all the names of all fileds
返回
{bool} 操作是否成功,返回 false 表明出错或该 key 对象非哈希对象 return true on success, false if error happened or the key wasn't a hash key

◆ hkeys() [2/2]

bool acl::redis_hash::hkeys ( const char *  key,
size_t  klen,
std::vector< string > &  names 
)

◆ hlen() [1/2]

int acl::redis_hash::hlen ( const char *  key)

获得某个 key 对象中所有域字段的数量 get the count of fields in hash stored at key

参数
key{const char*} key 键值 the hash key
返回
{int} 返回值含义: return int value as below: -1 – 出错或该 key 对象非哈希对象 error or not a hash key >0 – 域字段数量 the count of fields 0 – 该 key 不存在或域字段数量为 0 key not exists or no fields in hash stored at key

◆ hlen() [2/2]

int acl::redis_hash::hlen ( const char *  key,
size_t  klen 
)

◆ hmget() [1/6]

bool acl::redis_hash::hmget ( const char *  key,
const std::vector< string > &  names,
std::vector< string > *  result = NULL 
)

根据 KEY 值将多个"域-值"对从哈希表中取出 get the values associated with the specified fields in the hash stored at key

参数
key{const char*} 哈希表 key 值 the hash key
names对应 key 的域值对 the given hash fileds
result{std::vector<acl::string>*} 当该对象指针非空时存储查询结果; 如果该参数为 NULL 时,则可以通过基类 result_/get_ 获得数据 store the result of the given hash files if not NULL. If NULL, the base class's method like result_/get can be used to get the values
返回
{bool} 操作是否成功,操作成功后可以通过以下任一种方式获得数据: if successul, one of below ways can be used to get the result:

1、在调用方法中传入非空的存储结果对象的地址 input the no-NULL result parameter when call hmget, when success, the result will store the values of the given fileds

2、基类方法 result_value 获得指定下标的元素数据 call redis_command::result_value with the specified subscript

3、基类方法 result_child 获得指定下标的元素对象(redis_result),然后再通过 redis_result::argv_to_string 方法获得元素数据 call redis_command::result_child with specified subscript to get redis_result object, then call redis_result::argv_to_string with above result to get the values of the give fileds

4、基类方法 get_result 方法取得总结果集对象 redis_result,然后再通过 redis_result::get_child 获得一个元素对象,然后再通过方式 2 中指定 的方法获得该元素的数据 call redis_command::get_result with the specified subscript to get redis_result object, and use redis_result::get_child to get one result object, then call redis_result::argv_to_string to get the value of one filed.

5、基类方法 get_children 获得结果元素数组对象,再通过 redis_result 中 的方法 argv_to_string 从每一个元素对象中获得元素数据 use redis_command::get_children to get the redis_result array, then use redis_result::argv_to_string to get every value of the given fileds

◆ hmget() [2/6]

bool acl::redis_hash::hmget ( const char *  key,
size_t  klen,
const std::vector< string > &  names,
std::vector< string > *  result = NULL 
)

◆ hmget() [3/6]

bool acl::redis_hash::hmget ( const char *  key,
const std::vector< const char * > &  names,
std::vector< string > *  result = NULL 
)

◆ hmget() [4/6]

bool acl::redis_hash::hmget ( const char *  key,
const char *  names[],
size_t  argc,
std::vector< string > *  result = NULL 
)

◆ hmget() [5/6]

bool acl::redis_hash::hmget ( const char *  key,
const char *  names[],
const size_t  lens[],
size_t  argc,
std::vector< string > *  result = NULL 
)

◆ hmget() [6/6]

bool acl::redis_hash::hmget ( const char *  key,
size_t  klen,
const char *  names[],
const size_t  lens[],
size_t  argc,
std::vector< string > *  result = NULL 
)

◆ hmset() [1/9]

bool acl::redis_hash::hmset ( const char *  key,
const std::map< string, string > &  attrs 
)

将多个"域-值"对添加至 KEY 对应的哈希表中 HMSET: set the key's multiple fileds in redis-server

参数
key{const char*} 哈希表 key 值 the hash key for Hash class
attrs{const std::map<acl::string, ...>&} the fileds in map
返回
{bool} 添加是否成功 if successful for HMSET command

◆ hmset() [2/9]

bool acl::redis_hash::hmset ( const char *  key,
size_t  klen,
const std::map< string, string > &  attrs 
)

◆ hmset() [3/9]

bool acl::redis_hash::hmset ( const char *  key,
const std::map< string, const char * > &  attrs 
)

◆ hmset() [4/9]

bool acl::redis_hash::hmset ( const char *  key,
const std::vector< string > &  names,
const std::vector< string > &  values 
)

◆ hmset() [5/9]

bool acl::redis_hash::hmset ( const char *  key,
size_t  klen,
const std::vector< string > &  names,
const std::vector< string > &  values 
)

◆ hmset() [6/9]

bool acl::redis_hash::hmset ( const char *  key,
const std::vector< const char * > &  names,
const std::vector< const char * > &  values 
)

◆ hmset() [7/9]

bool acl::redis_hash::hmset ( const char *  key,
const char *  names[],
const char *  values[],
size_t  argc 
)

◆ hmset() [8/9]

bool acl::redis_hash::hmset ( const char *  key,
const char *  names[],
const size_t  names_len[],
const char *  values[],
const size_t  values_len[],
size_t  argc 
)

◆ hmset() [9/9]

bool acl::redis_hash::hmset ( const char *  key,
size_t  klen,
const char *  names[],
const size_t  names_len[],
const char *  values[],
const size_t  values_len[],
size_t  argc 
)

◆ hscan() [1/2]

int acl::redis_hash::hscan ( const char *  key,
int  cursor,
std::map< string, string > &  out,
const char *  pattern = NULL,
const size_t *  count = NULL 
)

命令用于迭代哈希键中的键值对 scan the name and value of all fields in hash stored at key

参数
key{const char*} 哈希键值 the hash key
cursor{int} 游标值,开始遍历时该值写 0 the cursor value, which is 0 at begin
out{std::map<acl::string>&} 存储结果集,内部以追加方式将本次 遍历结果添加进该对象中,为防止因总结果集过大导致该数组溢出,用户可在 调用本函数前后清理该对象 store scaning result in appending mode
pattern{const char*} 匹配模式,glob 风格,非空时有效 match pattern, effective only on no-NULL
count{const size_t*} 限定的结果集数量,非空指针时有效 the max count of one scan process, effective only on no-NULL
返回
{int} 下一个游标位置,含义如下: return the next cursor position, as below: 0:遍历结束 scan finish -1: 出错 some error happened >0: 游标的下一个位置,即使这样,具体有多少结果还需要检查 out,因为有可能为空 the next cursor postion to scan

◆ hscan() [2/2]

int acl::redis_hash::hscan ( const char *  key,
size_t  klen,
int  cursor,
std::map< string, string > &  out,
const char *  pattern = NULL,
const size_t *  count = NULL 
)

◆ hset() [1/4]

int acl::redis_hash::hset ( const char *  key,
const char *  name,
const char *  value 
)

设置 key 对象中某个域字段的值 set one field's value in the hash stored at key.

参数
key{const char*} key 键值 the hash key
name{const char*} key 对象的域名称 the filed name of the hash key
value{const char*} key 对象的域值 the filed value of the hash key
返回
{int} 返回值含义: 1 – 表示新添加的域字段添加成功 0 – 表示更新已经存在的域字段成功 -1 – 表示出错或该 key 对象非哈希对象或从结点禁止修改 return int value as below: 1 – this is a new filed and set ok 0 – thie is a old filed and set ok -1 – error happend or the key is not a Hash type

◆ hset() [2/4]

int acl::redis_hash::hset ( const char *  key,
const char *  name,
const char *  value,
size_t  value_len 
)

◆ hset() [3/4]

int acl::redis_hash::hset ( const char *  key,
const char *  name,
size_t  name_len,
const char *  value,
size_t  value_len 
)

◆ hset() [4/4]

int acl::redis_hash::hset ( const char *  key,
size_t  klen,
const char *  name,
size_t  name_len,
const char *  value,
size_t  value_len 
)

◆ hsetnx() [1/4]

int acl::redis_hash::hsetnx ( const char *  key,
const char *  name,
const char *  value 
)

当且仅当 key 对象中的某个域字段不存在时才更新该域字段值 set one new field of one key in hash only when the filed isn't existing.

参数
key{const char*} key 键值 the hash key
name{const char*} key 对象的域名称 the field name
value{const char*} key 对象的域值  the field value
返回
{int} 返回值含义: 1 – 表示新添加的域字段添加成功 0 – 该域字段存在且未对其进行更新 -1 – 表示出错或该 key 对象非哈希对象或从结点禁止修改

return int value as below: 1 – this is a new filed and set ok 0 – thie is a old filed and not set -1 – error happend or the key is not a Hash type

◆ hsetnx() [2/4]

int acl::redis_hash::hsetnx ( const char *  key,
const char *  name,
const char *  value,
size_t  value_len 
)

◆ hsetnx() [3/4]

int acl::redis_hash::hsetnx ( const char *  key,
const char *  name,
size_t  name_len,
const char *  value,
size_t  value_len 
)

◆ hsetnx() [4/4]

int acl::redis_hash::hsetnx ( const char *  key,
size_t  klen,
const char *  name,
size_t  name_len,
const char *  value,
size_t  value_len 
)

◆ hstrlen() [1/3]

int acl::redis_hash::hstrlen ( const char *  key,
const char *  name,
size_t  name_len 
)

获得某个 key 中的指定域的数据长度 Returns the string length of the value associated with field in the hash stored at key

参数
key{const char*} key 键值 the hash key
name{const char*} key 对象的域字段名称 the field's name
返回
{int} 如果 key 或 name 不存在,则返回 0,如果 key 非哈希 键或出错,则返回 -1 If the key or the field do not exist, 0 is returned; If the key is not the hash key or error happened, -1 is returned.

◆ hstrlen() [2/3]

int acl::redis_hash::hstrlen ( const char *  key,
size_t  klen,
const char *  name,
size_t  name_len 
)

◆ hstrlen() [3/3]

int acl::redis_hash::hstrlen ( const char *  key,
const char *  name 
)

◆ hvals() [1/2]

bool acl::redis_hash::hvals ( const char *  key,
std::vector< string > &  values 
)

获得指定 key 的所有字段值 get all fields' values with the specified key

参数
key{const char*} key 键值 the hash key
values{std::vector<string>&} 存储结果 store the results
返回
{bool} 操作是否成功 return true on success, or failed when error happened

◆ hvals() [2/2]

bool acl::redis_hash::hvals ( const char *  key,
size_t  klen,
std::vector< string > &  values 
)

该类的文档由以下文件生成: