2015-01-20 00:10:17 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
2015-02-10 17:23:24 +08:00
|
|
|
|
#include "acl_cpp/redis/redis_result.hpp"
|
2015-01-20 00:10:17 +08:00
|
|
|
|
|
|
|
|
|
namespace acl
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class redis_client;
|
2015-02-14 01:01:29 +08:00
|
|
|
|
class redis_pool;
|
|
|
|
|
class redis_cluster;
|
2015-01-20 00:10:17 +08:00
|
|
|
|
|
2015-01-26 19:58:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* redis <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD>鸸<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-01-20 00:10:17 +08:00
|
|
|
|
class ACL_CPP_API redis_command
|
|
|
|
|
{
|
|
|
|
|
public:
|
2015-02-14 01:01:29 +08:00
|
|
|
|
redis_command();
|
|
|
|
|
redis_command(redis_client* conn);
|
|
|
|
|
redis_command(redis_cluster* cluster);
|
2015-01-20 00:10:17 +08:00
|
|
|
|
virtual ~redis_command() = 0;
|
|
|
|
|
|
2015-01-26 19:58:02 +08:00
|
|
|
|
/**
|
2015-02-10 17:23:24 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>ʹ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>̳<EFBFBD><EFBFBD><EFBFBD> redis_command <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>һ<EFBFBD>ε<EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD>ϴβ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-01-26 19:58:02 +08:00
|
|
|
|
*/
|
2015-01-20 00:10:17 +08:00
|
|
|
|
void reset();
|
2015-01-26 19:58:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2015-02-10 17:23:24 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳط<EFBFBD>ʽʱ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳػ<EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* (redis_client)<EFBFBD><EFBFBD> redis <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><EFBFBD><EFBFBD>
|
2015-01-26 19:58:02 +08:00
|
|
|
|
*/
|
2015-01-20 00:10:17 +08:00
|
|
|
|
void set_client(redis_client* conn);
|
2015-01-26 19:58:02 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ redis <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD>
|
2015-02-10 17:23:24 +08:00
|
|
|
|
* @return {redis_client*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD>ʾû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵱ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>а<EFBFBD><EFBFBD><EFBFBD>
|
2015-01-26 19:58:02 +08:00
|
|
|
|
*/
|
2015-01-20 00:10:17 +08:00
|
|
|
|
redis_client* get_client() const
|
|
|
|
|
{
|
|
|
|
|
return conn_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-14 01:01:29 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳؼ<EFBFBD>Ⱥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param cluster {redis_cluster*}
|
|
|
|
|
*/
|
|
|
|
|
void set_cluster(redis_cluster* cluster);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳؼ<EFBFBD>Ⱥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {redis_cluster*}
|
|
|
|
|
*/
|
|
|
|
|
redis_cluster* get_cluster() const
|
|
|
|
|
{
|
|
|
|
|
return cluster_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-13 22:52:43 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ؾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis_command <EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {dbuf_pool*}
|
|
|
|
|
*/
|
|
|
|
|
dbuf_pool* get_pool() const
|
|
|
|
|
{
|
|
|
|
|
return pool_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-29 00:38:29 +08:00
|
|
|
|
/**
|
2015-02-10 17:23:24 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {redis_result_t}
|
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
redis_result_t result_type() const;
|
2015-02-10 17:23:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ REDIS_RESULT_STATUS <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> "" <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
const char* result_status() const;
|
2015-02-10 17:23:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ REDIS_RESULT_ERROR <EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD>ؿմ<EFBFBD> "" <EFBFBD><EFBFBD>ʾû<EFBFBD>г<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
const char* result_error() const;
|
2015-02-10 17:23:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* (get_child/get_value) <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>صĸ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {size_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD>͵Ķ<EFBFBD>Ӧ<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
|
|
|
|
|
* REDIS_RESULT_ERROR: 1
|
|
|
|
|
* REDIS_RESULT_STATUS: 1
|
|
|
|
|
* REDIS_RESULT_INTEGER: 1
|
|
|
|
|
* REDIS_RESULT_STRING: > 0 ʱ<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD>зֳɷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* REDIS_RESULT_ARRAY: children_->size()
|
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
size_t result_size() const;
|
2015-02-10 17:23:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ REDIS_RESULT_INTEGER <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>Ӧ<EFBFBD><EFBFBD> 32 λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @param success {bool*} <EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL ʱ<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
* @return {int}
|
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
int result_number(bool* success = NULL) const;
|
2015-02-10 17:23:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵΪ REDIS_RESULT_INTEGER <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>Ӧ<EFBFBD><EFBFBD> 64 λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @param success {bool*} <EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL ʱ<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
* @return {long long int}
|
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
long long int result_number64(bool* success = NULL) const;
|
2015-02-10 17:23:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>Ӧ<EFBFBD>±<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD> REDIS_RESULT_ARRAY ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param i {size_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>
|
|
|
|
|
* @param len {size_t*} <EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD> NULL ָ<EFBFBD><EFBFBD>ʱ<EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵij<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD><EFBFBD>ʾ<EFBFBD>±<EFBFBD>Խ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
const char* get_result(size_t i, size_t* len = NULL) const;
|
2015-02-10 17:23:24 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>жϵ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(redis_client) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD>رգ<EFBFBD>
|
|
|
|
|
* ֻ<EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD> conn_ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-01-29 00:38:29 +08:00
|
|
|
|
* @return {bool}
|
|
|
|
|
*/
|
|
|
|
|
bool eof() const;
|
|
|
|
|
|
2015-01-26 19:58:02 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD> redis <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵Ľ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {redis_result*}
|
|
|
|
|
*/
|
2015-01-20 00:10:17 +08:00
|
|
|
|
const redis_result* get_result() const;
|
|
|
|
|
|
2015-01-30 22:58:13 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param i {size_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>ֵ
|
2015-02-10 17:23:24 +08:00
|
|
|
|
* @return {const redis_result*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
|
|
* <EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL
|
2015-01-30 22:58:13 +08:00
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
const redis_result* result_child(size_t i) const;
|
2015-01-30 22:58:13 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2015-02-10 17:23:24 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis-server <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ե<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>λ<EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-01-30 22:58:13 +08:00
|
|
|
|
* @param i {size_t} <EFBFBD>±꣨<EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
2015-02-10 17:23:24 +08:00
|
|
|
|
* @param len {size_t*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>ǿգ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>طǿ<EFBFBD>ָ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>
|
|
|
|
|
* @return {const char*} <EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>Ӧ<EFBFBD>±<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL ʱ<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>û
|
|
|
|
|
* <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>Ϊ<EFBFBD>˱<EFBFBD>֤ʹ<EFBFBD><EFBFBD><EFBFBD>ϵİ<EFBFBD>ȫ<EFBFBD>ԣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD>֤<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \0 <EFBFBD><EFBFBD>β<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ڼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD>β<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>˼<EFBFBD><EFBFBD>ݶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* Ӧ<EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD> len <EFBFBD><EFBFBD><EFBFBD>ŵij<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-01-30 22:58:13 +08:00
|
|
|
|
*/
|
2015-02-13 22:52:43 +08:00
|
|
|
|
const char* result_value(size_t i, size_t* len = NULL) const;
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD>з<EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ true <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
|
|
|
|
* @param on {bool} <EFBFBD>ڲ<EFBFBD>Ĭ<EFBFBD><EFBFBD>ֵΪ false
|
|
|
|
|
*/
|
|
|
|
|
void set_slice_request(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD>з<EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ true <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱȽϴ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD>з<EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD>ֳ<EFBFBD>һЩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>
|
|
|
|
|
* @param on {bool} <EFBFBD>ڲ<EFBFBD>Ĭ<EFBFBD><EFBFBD>ֵΪ false
|
|
|
|
|
*/
|
|
|
|
|
void set_slice_respond(bool on);
|
2015-01-30 22:58:13 +08:00
|
|
|
|
|
2015-01-20 00:10:17 +08:00
|
|
|
|
protected:
|
2015-02-13 22:52:43 +08:00
|
|
|
|
const redis_result* run(size_t nchildren = 0);
|
2015-02-14 01:01:29 +08:00
|
|
|
|
const redis_result* run(redis_cluster* cluster, size_t nchildren);
|
2015-01-23 17:23:04 +08:00
|
|
|
|
|
2015-02-13 22:52:43 +08:00
|
|
|
|
void build_request(size_t argc, const char* argv[], size_t lens[]);
|
|
|
|
|
void reset_request();
|
2015-01-23 17:23:04 +08:00
|
|
|
|
const redis_result** scan_keys(const char* cmd, const char* key,
|
|
|
|
|
int& cursor, size_t& size, const char* pattern,
|
|
|
|
|
const size_t* count);
|
2015-02-13 22:52:43 +08:00
|
|
|
|
/*******************************************************************/
|
|
|
|
|
|
|
|
|
|
void build(const char* cmd, const char* key,
|
|
|
|
|
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::map<int, string>& attrs);
|
|
|
|
|
void build(const char* cmd, const char* key,
|
|
|
|
|
const std::map<int, 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,
|
|
|
|
|
const std::vector<const char*>& names,
|
|
|
|
|
const std::vector<const char*>& values);
|
|
|
|
|
|
|
|
|
|
void build(const char* cmd, const char* key,
|
|
|
|
|
const std::vector<int>& names,
|
|
|
|
|
const std::vector<string>& values);
|
|
|
|
|
void build(const char* cmd, const char* key,
|
|
|
|
|
const std::vector<int>& 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,
|
|
|
|
|
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 int names[], size_t argc);
|
|
|
|
|
void build(const char* cmd, const char* key,
|
|
|
|
|
const char* names[], const size_t lens[], size_t argc);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
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::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);
|
|
|
|
|
|
|
|
|
|
/************************** common *********************************/
|
|
|
|
|
protected:
|
|
|
|
|
dbuf_pool* pool_;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
redis_client* conn_;
|
2015-02-14 01:01:29 +08:00
|
|
|
|
redis_cluster* cluster_;
|
2015-02-13 22:52:43 +08:00
|
|
|
|
unsigned long long used_;
|
|
|
|
|
|
2015-02-14 01:01:29 +08:00
|
|
|
|
redis_pool* get_conns(redis_cluster* cluster, const char* info);
|
|
|
|
|
|
2015-02-13 22:52:43 +08:00
|
|
|
|
private:
|
|
|
|
|
/************************** request ********************************/
|
|
|
|
|
bool slice_req_;
|
|
|
|
|
string* request_buf_;
|
|
|
|
|
redis_request* request_obj_;
|
|
|
|
|
size_t argv_size_;
|
|
|
|
|
const char** argv_;
|
|
|
|
|
size_t* argv_lens_;
|
|
|
|
|
size_t argc_;
|
|
|
|
|
|
|
|
|
|
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[]);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/************************** respond ********************************/
|
|
|
|
|
bool slice_res_;
|
|
|
|
|
const redis_result* result_;
|
2015-01-20 00:10:17 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|