acl
3.5.3.0
|
#include <redis_command.hpp>
Public 成员函数 | |
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_client * | get_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_cluster * | get_cluster (void) const |
void | set_pipeline (redis_client_pipeline *pipeline, bool use_mbox=true) |
redis_client_pipeline * | get_pipeline (void) const |
dbuf_pool * | get_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_result * | get_result (void) const |
const redis_result * | result_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_result * | request (size_t argc, const char *argv[], size_t lens[], size_t nchild=0) |
const redis_result * | request (const std::vector< string > &args, size_t nchild=0) |
const string * | request_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 |
string * | get_request_buf (void) const |
bool | is_slice_req (void) const |
redis_pipeline_message & | get_pipeline_message (void) |
静态 Public 成员函数 | |
static void | build_request (size_t argc, const char *argv[], size_t lens[], string &out) |
Protected 成员函数 | |
const redis_result * | run (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 属性 | |
dbuf_pool * | dbuf_ |
bool | check_addr_ |
char | addr_ [32] |
redis_client * | conn_ |
redis_client_cluster * | cluster_ |
redis_client_pipeline * | pipeline_ |
bool | pipe_use_mbox_ |
int | slot_ |
int | redirect_max_ |
int | redirect_sleep_ |
bool | slice_req_ |
string * | request_buf_ |
redis_request * | request_obj_ |
size_t | argv_size_ |
const char ** | argv_ |
size_t * | argv_lens_ |
size_t | argc_ |
bool | slice_res_ |
redis_pipeline_message * | pipe_msg_ |
const redis_result * | result_ |
redis 客户端命令类的纯虚父类; the redis command classes's base virtual class, which includes the basic functions for all sub-classes
在文件 redis_command.hpp 第 26 行定义.
acl::redis_command::redis_command | ( | void | ) |
缺省的构造函数,如果使用此构造函数初始化类对象,则必须调用 set_client 或 set_cluster 设置 redis 客户端命令类对象的通讯方式。 default constructor. You must set the communication method by set_client or set_cluster functions.
acl::redis_command::redis_command | ( | redis_client * | conn | ) |
当使用非集群模式时,可以使用此构造函数设置 redis 通信对象。 Using this constructor to set the redis communication mode, usually in no-cluster mode.
conn | {redis_client*} redis 通信类对象 the redis communication in no-cluster mode |
acl::redis_command::redis_command | ( | redis_client_cluster * | cluster | ) |
集群模式的构造函数,在构造类对象时指定了集群模式的 redis_client_cluster 对象。 Using this constructor to set the redis_client_cluster, usually in cluster mode.
cluster | {redis_client_cluster*} redis 集群连接对象 redis cluster object in cluster mode the max of every connection pool with all the redis nodes, if be set 0, then there is no connections limit in connections pool. |
ACL_CPP_DEPRECATED acl::redis_command::redis_command | ( | redis_client_cluster * | cluster, |
size_t | max_conns | ||
) |
acl::redis_command::redis_command | ( | redis_client_pipeline * | pipeline | ) |
|
virtual |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
根据请求命令字列表创建 redis 请求协议数据
argc | {size_t} 命令参数个数 |
argv | {const char* []} 命令参数数组 |
lens | {size_t []} 每个命令参数长度数组 |
out | {string&} 存放创建结果 |
void acl::redis_command::build_request | ( | size_t | argc, |
const char * | argv[], | ||
size_t | lens[] | ||
) |
根据命令字列表创建 redis 请求协议并存储于 redis_command 中,以备在请求时使用
argc | {size_t} 命令参数个数 |
argv | {const char* []} 命令参数数组 |
lens | {size_t []} 每个命令参数长度数组 |
|
protected |
|
protected |
|
protected |
void acl::redis_command::clear | ( | bool | save_slot = false | ) |
在重复使用一个继承于 redis_command 的子类操作 redis 时,需要在 下一次调用前调用本方法以释放上次操作的临时对象; when reusing a redis command sub-class, the reset method should be called first to rlease some resources in last command operation
save_slot | {bool} 当采用集群模式时,该参数决定是否需要重新 计算哈希槽值,如果反复调用 redis 命令过程中的 key 值不变,则可以保 留此哈希槽值以减少内部重新进行计算的次数; when in cluster mode, if your operations is on the same key, you can set the param save_slot to false which can reduse the times of compute the same key's hash-slot. |
|
protected |
bool acl::redis_command::eof | ( | void | ) | const |
判断当前所绑定的 redis 连接流对象(redis_client) 连接是否已经关闭; 只有内部的 conn_ 流对象非空时调用此函数才有意义; to judge if the redis connection was be closed, only redis_client object be set internal
const char* acl::redis_command::get_addr | ( | const char * | info | ) |
|
inline |
获得当前 redis 客户端命令的连接对象; get redis connection set by set_client function
在文件 redis_command.hpp 第 108 行定义.
const char* acl::redis_command::get_client_addr | ( | void | ) | const |
获得当前 redis 命令对象所绑定的服务器地址,只有当该对象与 redis_client 绑定时(即调用 set_client) 才可以调用本函数 get the redis-server's addr used by the current command. this method can only be used only if the redis_client was set by set_client method.
|
inline |
获得所设置的连接池集群管理器; get redis_cluster object set by set_cluster function
在文件 redis_command.hpp 第 143 行定义.
|
inline |
获得内存池句柄,该内存池由 redis_command 内部产生; get memory pool handle been set
在文件 redis_command.hpp 第 172 行定义.
|
protected |
|
protected |
|
protected |
|
protected |
|
inline |
get the redis pipeline communication object been set before
在文件 redis_command.hpp 第 162 行定义.
redis_pipeline_message& acl::redis_command::get_pipeline_message | ( | void | ) |
|
inline |
在文件 redis_command.hpp 第 498 行定义.
|
inline |
在文件 redis_command.hpp 第 494 行定义.
const char* acl::redis_command::get_result | ( | size_t | i, |
size_t * | len = NULL |
||
) | const |
返回对应下标的数据(当数据类型非 REDIS_RESULT_ARRAY 时); get string result when result type isn't REDIS_RESULT_ARRAY
i | {size_t} 数组下标; the array index |
len | {size_t*} 当为非 NULL 指针时存储所返回数据的长度; *len will save the result's length if len is not NULL |
const redis_result* acl::redis_command::get_result | ( | void | ) | const |
获得本次 redis 操作过程的结果; get result object of last redis operation
|
inline |
在文件 redis_command.hpp 第 469 行定义.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void acl::redis_command::hash_slot | ( | const char * | key | ) |
void acl::redis_command::hash_slot | ( | const char * | key, |
size_t | len | ||
) |
|
inline |
在文件 redis_command.hpp 第 473 行定义.
|
inline |
在文件 redis_command.hpp 第 502 行定义.
|
protected |
const redis_result* acl::redis_command::request | ( | size_t | argc, |
const char * | argv[], | ||
size_t | lens[], | ||
size_t | nchild = 0 |
||
) |
直接组合 redis 协议命令方式,从 redis 服务器获得结果
argc | {size_t} 后面数组中数组元素个数 |
argv | {const char*[]} redis 命令组成的数组 |
lens | {size_t[]} argv 中数组元素的长度 |
nchild | {size_t} 有的 redis 命令需要获取多个结果集,如:subop |
const redis_result* acl::redis_command::request | ( | const std::vector< string > & | args, |
size_t | nchild = 0 |
||
) |
直接组合 redis 协议命令方式,从 redis 服务器获得结果
args | {const std::vector<string>&} redis 命令组成的数组 |
nchild | {size_t} 有的 redis 命令需要获取多个结果集,如:subop |
|
inline |
在文件 redis_command.hpp 第 346 行定义.
void acl::redis_command::reset | ( | bool | save_slot = false | ) |
const redis_result* acl::redis_command::result_child | ( | size_t | i | ) | const |
当查询结果为数组对象时调用本方法获得一个数组元素对象; get one result ojbect of array if result type is REDIS_RESULT_ARRAY
i | {size_t} 数组对象的下标值; the result array's index |
const char* acl::redis_command::result_error | ( | void | ) | const |
当出错时返回值为 REDIS_RESULT_ERROR 类型,本方法返回出错信息; when result type is REDIS_RESULT_ERROR, the error info can be get by this function
int acl::redis_command::result_number | ( | bool * | success = NULL | ) | const |
当返回值为 REDIS_RESULT_INTEGER 类型时,本方法返回对应的 32 位整数值; get 32-bits number value if result type is REDIS_RESULT_INTERGER
success | {bool*} 本指针非 NULL 时记录操作过程是否成功; if the param pointer is not NULL, which will save status of success or not for result from redis-server |
long long int acl::redis_command::result_number64 | ( | bool * | success = NULL | ) | const |
当返回值为 REDIS_RESULT_INTEGER 类型时,本方法返回对应的 64 位整数值; get 64-bits number value if result type is REDIS_RESULT_INTERGER
success | {bool*} 本指针非 NULL 时记录操作过程是否成功; if the param pointer is not NULL, which will save status of success or not for result from redis-server |
size_t acl::redis_command::result_size | ( | void | ) | const |
获得当前结果结点存储的对象的个数, 该方法可以获得结果为下面两个方法 (result_child/result_value) 所需要的数组元素的个数; get number of result objects, just for functions result_child/result_value
const char* acl::redis_command::result_status | ( | void | ) | const |
当返回值为 REDIS_RESULT_STATUS 类型时,本方法返回状态信息; when result type is REDIS_RESULT_STATUS, the status info can be get by this function
redis_result_t acl::redis_command::result_type | ( | void | ) | const |
获得当前结果结点的数据类型; get the result type returned from redis-server
const char* acl::redis_command::result_value | ( | size_t | i, |
size_t * | len = NULL |
||
) | const |
当从 redis-server 获得的数据是一组字符串类型的结果集时,可以调用 本函数获得某个指定下标位置的数据; when the reply from redis-serveer are strings array, this function can be used to get the string specified by a subscript
i | {size_t} 下标(从 0 开始) the subscript of strings array |
len | {size_t*} 若该指针非空,则存储所返回结果的长度(仅当该 方法返回非空指针时有效) if len not a NULL pointer, it will store the length of string specified by the subscript |
|
protected |
|
protected |
|
protected |
void acl::redis_command::set_check_addr | ( | bool | on | ) |
在进行每个命令处理前,是否要求检查 socket 句柄与地址的匹配情况,当 打开该选项时,将会严格检查匹配情况,但会影响一定性能,因此该设置仅 用在 DEBUG 时的运行场景
on | {bool} |
void acl::redis_command::set_client | ( | redis_client * | conn | ) |
在使用非集群方式时,通过本函数将从连接池获得的连接对象; when not using cluster mode, the function is used to set the connection for next redis command operation.
conn | {redis_client*} 与 redis 客户端命令进行关联; the redis connection to be set in next redis operation |
void acl::redis_command::set_client_addr | ( | const char * | addr | ) |
void acl::redis_command::set_client_addr | ( | redis_client & | conn | ) |
void acl::redis_command::set_cluster | ( | redis_client_cluster * | cluster | ) |
设置连接池集群管理器; set the redis cluster object in redis cluster mode
cluster | {redis_client_cluster*} redis 集群连接对象; the redis_cluster connection object which can connect to any redis-server and support connection pool when dynamicly creating connection pool to any redis-server, use this param to limit the max number for each connection pool |
ACL_CPP_DEPRECATED void acl::redis_command::set_cluster | ( | redis_client_cluster * | cluster, |
size_t | max_conns | ||
) |
void acl::redis_command::set_pipeline | ( | redis_client_pipeline * | pipeline, |
bool | use_mbox = true |
||
) |
void acl::redis_command::set_slice_request | ( | bool | on | ) |
设置是否对请求数据进行分片处理,如果为 true 则内部在组装请求协议的 时候不会将所有数据块重新组装成一个连续的大数据块 just for request package, setting flag for sending data with multi data chunks; this is useful when the request data is large
on | {bool} 内部默认值为 false if true the request data will not be combined one package, internal default is false |
void acl::redis_command::set_slice_respond | ( | bool | on | ) |
设置是否对响应数据进行分片处理,如果为 true 则当服务器的返回数据 比较大时则将数据进行分片,分成一些不连续的数据块 just for response package, settint flag for receiving data if split the large response data into multi little chunks
on | {bool} 内部默认值为 false if true the response data will be splitted into multi little data, which is useful for large reponse data for avoiding malloc large continuously memory from system. internal default is false |
|
protected |
在文件 redis_command.hpp 第 479 行定义.
|
protected |
在文件 redis_command.hpp 第 517 行定义.
|
protected |
在文件 redis_command.hpp 第 515 行定义.
|
protected |
在文件 redis_command.hpp 第 516 行定义.
|
protected |
在文件 redis_command.hpp 第 514 行定义.
|
protected |
在文件 redis_command.hpp 第 478 行定义.
|
protected |
在文件 redis_command.hpp 第 481 行定义.
|
protected |
在文件 redis_command.hpp 第 480 行定义.
|
protected |
在文件 redis_command.hpp 第 457 行定义.
|
protected |
在文件 redis_command.hpp 第 531 行定义.
|
protected |
在文件 redis_command.hpp 第 483 行定义.
|
protected |
在文件 redis_command.hpp 第 482 行定义.
|
protected |
在文件 redis_command.hpp 第 485 行定义.
|
protected |
在文件 redis_command.hpp 第 486 行定义.
|
protected |
在文件 redis_command.hpp 第 512 行定义.
|
protected |
在文件 redis_command.hpp 第 513 行定义.
|
protected |
在文件 redis_command.hpp 第 532 行定义.
|
protected |
在文件 redis_command.hpp 第 511 行定义.
|
protected |
在文件 redis_command.hpp 第 530 行定义.
|
protected |
在文件 redis_command.hpp 第 484 行定义.