mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 10:57:34 +08:00
the new redis client can be compiled by vc2003
This commit is contained in:
parent
d4e5726585
commit
68ce4a101b
@ -8,6 +8,7 @@ namespace acl
|
||||
{
|
||||
|
||||
class redis_client;
|
||||
class redis_result;
|
||||
|
||||
class ACL_CPP_API redis_server : public redis_command
|
||||
{
|
||||
@ -17,27 +18,175 @@ public:
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
* 执行一个 AOF文件 重写操作。重写会创建一个当前 AOF 文件的体积优化版本;
|
||||
* 即使 BGREWRITEAOF 执行失败,也不会有任何数据丢失,因为旧的 AOF 文件在
|
||||
* BGREWRITEAOF 成功之前不会被修改
|
||||
* @return {bool}
|
||||
*/
|
||||
bool bgrewriteaof();
|
||||
|
||||
/**
|
||||
* 在后台异步(Asynchronously)保存当前数据库的数据到磁盘,BGSAVE 命令执行之后
|
||||
* 立即返回 OK ,然后 Redis fork 出一个新子进程,原来的 Redis 进程(父进程)
|
||||
* 继续处理客户端请求,而子进程则负责将数据保存到磁盘,然后退出;客户端可以通过
|
||||
* LASTSAVE 命令查看相关信息,判断 BGSAVE 命令是否执行成功
|
||||
* @return {bool}
|
||||
*/
|
||||
bool bgsave();
|
||||
|
||||
/**
|
||||
* 返回 CLIENT SETNAME 命令为连接设置的名字
|
||||
* @param buf {string&} 存储结果,如果没有设置则为空
|
||||
* @return {bool} 返回 false 则表明没有设置连接名字或出错
|
||||
*/
|
||||
bool client_getname(string& buf);
|
||||
|
||||
/**
|
||||
* 关闭地址为 ip:port 的客户端
|
||||
* @param addr {const char*} 客户端连接地址,格式:ip:port
|
||||
* @return {bool} 是否成功,返回 false 表明连接不存在或出错
|
||||
*/
|
||||
bool client_kill(const char* addr);
|
||||
|
||||
/**
|
||||
* 返回所有连接到服务器的客户端信息和统计数据
|
||||
* @param buf {string&} 存储结果
|
||||
* @return {int} 返回结果数据长度,-1 表示出错
|
||||
*/
|
||||
int client_list(string& buf);
|
||||
|
||||
/**
|
||||
* 为当前连接分配一个名字,该名字会出现在 CLIENT LIST 命令的结果中;
|
||||
* 在 Redis 应用程序发生连接泄漏时,为连接设置名字是一种很好的 debug 手段
|
||||
* @param name {const char*} 连接名字,该名字不需要唯一性
|
||||
* @return {bool} 操作是否成功
|
||||
*/
|
||||
bool client_setname(const char* name);
|
||||
|
||||
/**
|
||||
* 命令用于取得运行中的 Redis 服务器的配置参数
|
||||
* @param parameter {const char*} 配置参数名
|
||||
* @param out {std::map<string, string>&} 存储结果,由 name-value 组成,
|
||||
* 因为 parameter 支持模糊匹配,所以有可能返回的结果集中会有多个参数项
|
||||
* @return {int} 结果 "参数-值" 的个数,-1 表示出错
|
||||
*/
|
||||
int config_get(const char* parameter, std::map<string, string>& out);
|
||||
|
||||
/**
|
||||
* 重置 INFO 命令中的某些统计数据
|
||||
* @return {bool} 重置是否成功
|
||||
*/
|
||||
bool config_resetstat();
|
||||
|
||||
/**
|
||||
* 对启动 Redis 服务器时所指定的 redis.conf 文件进行改写
|
||||
* @return {bool} 重写配置是否成功
|
||||
*/
|
||||
bool config_rewrite();
|
||||
|
||||
/**
|
||||
* 动态地调整 Redis 服务器的配置而无需重启服务
|
||||
* @param name {const char*} 配置参数名
|
||||
* @param value {const char*} 配置参数值
|
||||
* @return {bool} 是否成功
|
||||
*/
|
||||
bool config_set(const char* name, const char* value);
|
||||
|
||||
/**
|
||||
* 返回当前数据库的 key 的数量
|
||||
* @return {int} 返回 -1 表示出错
|
||||
*/
|
||||
int dbsize();
|
||||
|
||||
/**
|
||||
* 清空整个 Redis 服务器的数据(删除所有数据库的所有 key )
|
||||
* @return {bool}
|
||||
* 注:此命令要慎用,以免造成误操作
|
||||
*/
|
||||
bool flushall();
|
||||
|
||||
/**
|
||||
* 清空当前数据库中的所有 key
|
||||
* @return {bool}
|
||||
* 注:此命令要慎用,以免造成误操作
|
||||
*/
|
||||
bool flushdb();
|
||||
|
||||
/**
|
||||
* 返回关于 Redis 服务器的各种信息和统计数值
|
||||
* @param buf {string&} 存储结果
|
||||
* @return {int} 返回所存储的数据长度
|
||||
*/
|
||||
int info(string& buf);
|
||||
|
||||
/**
|
||||
* 返回最近一次 Redis 成功将数据保存到磁盘上的时间,以 UNIX 时间戳格式表示
|
||||
* @return {time_t}
|
||||
*/
|
||||
time_t lastsave();
|
||||
|
||||
/**
|
||||
* 实时打印出 Redis 服务器接收到的命令,调试用; 调用本命令后可以循环调用下面的
|
||||
* get_command 方法获得服务器收到的命令
|
||||
* @return {bool}
|
||||
*/
|
||||
bool monitor();
|
||||
|
||||
/**
|
||||
* 调用 monitor 方法后需要调用本方法获得服务器收到的命令,可以循环调用本方法
|
||||
* 以便于不断地获得服务器收到的命令
|
||||
* @param buf {string&} 存储结果
|
||||
* @return {bool}
|
||||
*/
|
||||
bool get_command(string& buf);
|
||||
|
||||
/**
|
||||
* 命令执行一个同步保存操作,将当前 Redis 实例的所有数据快照(snapshot)
|
||||
* 以 RDB 文件的形式保存到硬盘
|
||||
* @return {bool}
|
||||
*/
|
||||
bool save();
|
||||
|
||||
/**
|
||||
* 停止所有客户端连接将数据保存至磁盘后服务器程序退出
|
||||
* @param save_data {bool} 是否在退出前保存数据至磁盘
|
||||
*/
|
||||
void shutdown(bool save_data = true);
|
||||
|
||||
/**
|
||||
* 将当前服务器转变为指定服务器的从属服务器
|
||||
* @param ip {const char*} 指定服务器的 IP
|
||||
* @param port {int} 指定服务器的端口
|
||||
* @return {bool} 是否成功
|
||||
*/
|
||||
bool slaveof(const char* ip, int port);
|
||||
|
||||
/**
|
||||
* 查询较慢的操作日志
|
||||
* @param number {int} 大于 0 时则限定日志条数,否则列出所有日志
|
||||
* @return {const redis_result*}
|
||||
*/
|
||||
const redis_result* slowlog_get(int number = 0);
|
||||
|
||||
/**
|
||||
* 可以查看当前日志的数量
|
||||
* @return {int}
|
||||
*/
|
||||
int slowlog_len();
|
||||
|
||||
/**
|
||||
* 可以清空 slow log
|
||||
* @return {bool}
|
||||
*/
|
||||
bool slowlog_reset();
|
||||
|
||||
/**
|
||||
* 返回当前服务器时间
|
||||
* @param stamp {time_t&} 存储时间截(以 UNIX 时间戳格式表示)
|
||||
* @param escape {int*} 存储当前这一秒钟已经逝去的微秒数
|
||||
*/
|
||||
bool get_time(time_t& stamp, int& escape);
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@ class redis_client;
|
||||
class redis_result;
|
||||
|
||||
/**
|
||||
* 除 PSETEX 外所有的字符串对象的命令都已实现
|
||||
* 所有的字符串对象的命令都已实现
|
||||
*/
|
||||
class ACL_CPP_API redis_string : public redis_command
|
||||
{
|
||||
@ -33,7 +33,7 @@ public:
|
||||
const char* value, size_t value_len);
|
||||
|
||||
/**
|
||||
* 将值 value 关联到 key ,并将 key 的生存时间设为 seconds (以秒为单位),
|
||||
* 将值 value 关联到 key ,并将 key 的生存时间设为 timeout (以秒为单位),
|
||||
* 如果 key 已经存在, SETEX 命令将覆写旧值
|
||||
* @param key {const char*} 字符串对象的 key
|
||||
* @param value {const char*} 字符串对象的 value
|
||||
@ -44,6 +44,18 @@ public:
|
||||
bool setex(const char* key, size_t key_len, const char* value,
|
||||
size_t value_len, int timeout);
|
||||
|
||||
/**
|
||||
* 将值 value 关联到 key ,并将 key 的生存时间设为 timeout (以毫秒为单位),
|
||||
* 如果 key 已经存在, SETEX 命令将覆写旧值
|
||||
* @param key {const char*} 字符串对象的 key
|
||||
* @param value {const char*} 字符串对象的 value
|
||||
* @param timeout {int} 过期值,单位为毫秒
|
||||
* @return {bool} 操作是否成功,返回 false 表示出错或该 key 对象非字符串对象
|
||||
*/
|
||||
bool psetex(const char* key, const char* value, int timeout);
|
||||
bool psetex(const char* key, size_t key_len, const char* value,
|
||||
size_t value_len, int timeout);
|
||||
|
||||
/**
|
||||
* 将 key 的值设为 value ,当且仅当 key 不存在,若给定的 key 已经存在,
|
||||
* 则 SETNX 不做任何动作
|
||||
|
@ -345,6 +345,9 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<File
|
||||
RelativePath=".\src\stdlib\charset_conv.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\stdlib\dbuf_pool.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\stdlib\dns_service.cpp">
|
||||
</File>
|
||||
@ -721,9 +724,63 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<Filter
|
||||
Name="redis"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\src\redis\redic_connection.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_client.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_command.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_hash.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_hyperloglog.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_key.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_list.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_manager.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_pool.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_pubsub.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_request.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_request.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_result.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_script.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_server.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_set.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_string.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_transaction.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\redis\redis_zset.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="session"
|
||||
@ -862,6 +919,9 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\stdlib\charset_conv.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\stdlib\dbuf_pool.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\stdlib\dns_service.hpp">
|
||||
</File>
|
||||
@ -1149,11 +1209,53 @@ copy $(TargetName).pdb ..\dist\lib\win32\$(TargetName).pdb /Y
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_client.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_command.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_connection.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_hash.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_hyperloglog.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_key.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_response.hpp">
|
||||
RelativePath=".\include\acl_cpp\redis\redis_list.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_manager.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_pool.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_pubsub.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_result.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_script.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_server.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_set.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_string.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_transaction.hpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\include\acl_cpp\redis\redis_zset.hpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
@ -301,7 +301,7 @@ static void init(const char* cmd, bool check)
|
||||
__big_data = (char*) malloc(__big_data_length);
|
||||
for (size_t i = 0; i < __big_data_length; i++)
|
||||
{
|
||||
ch = i % 255;
|
||||
ch = (char) i % 255;
|
||||
__big_data[i] = ch;
|
||||
md5.update(&ch, 1);
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ void rfc822::mkdate_cst(time_t t, char *buf, size_t size)
|
||||
p->tm_sec,
|
||||
offset);
|
||||
#else
|
||||
snprintf(buf, size, "%s, %02d %s %04d %02d:%02d:%02d %+05d (CST)",
|
||||
safe_snprintf(buf, size, "%s, %02d %s %04d %02d:%02d:%02d %+05d (CST)",
|
||||
wdays[p->tm_wday],
|
||||
p->tm_mday,
|
||||
months[p->tm_mon],
|
||||
|
@ -20,6 +20,18 @@ redis_server::~redis_server()
|
||||
|
||||
}
|
||||
|
||||
bool redis_server::bgrewriteaof()
|
||||
{
|
||||
const char* argv[1];
|
||||
size_t lens[1];
|
||||
|
||||
argv[0] = "BGREWRITEAOF";
|
||||
lens[0] = sizeof("BGREWRITEAOF") - 1;
|
||||
|
||||
conn_->build_request(1, argv, lens);
|
||||
return conn_->get_status("Background");
|
||||
}
|
||||
|
||||
bool redis_server::bgsave()
|
||||
{
|
||||
const char* argv[1];
|
||||
@ -225,7 +237,7 @@ time_t redis_server::lastsave()
|
||||
lens[0] = sizeof("LASTSAVE") - 1;
|
||||
|
||||
conn_->build_request(1, argv, lens);
|
||||
return conn_->get_number64();
|
||||
return (time_t) conn_->get_number64();
|
||||
}
|
||||
|
||||
bool redis_server::monitor()
|
||||
@ -308,6 +320,62 @@ bool redis_server::slaveof(const char* ip, int port)
|
||||
return conn_->get_status();
|
||||
}
|
||||
|
||||
const redis_result* redis_server::slowlog_get(int number /* = 0 */)
|
||||
{
|
||||
const char* argv[3];
|
||||
size_t lens[3];
|
||||
|
||||
argv[0] = "SLOWLOG";
|
||||
lens[0] = sizeof("SLOWLOG") - 1;
|
||||
|
||||
argv[1] = "GET";
|
||||
lens[1] = sizeof("GET") - 1;
|
||||
|
||||
size_t argc = 2;
|
||||
|
||||
char buf[INT_LEN];
|
||||
if (number > 0)
|
||||
{
|
||||
safe_snprintf(buf, sizeof(buf), "%d", number);
|
||||
argv[2] = buf;
|
||||
lens[2] = strlen(buf);
|
||||
argc++;
|
||||
}
|
||||
|
||||
conn_->build_request(argc, argv, lens);
|
||||
return conn_->run();
|
||||
}
|
||||
|
||||
int redis_server::slowlog_len()
|
||||
{
|
||||
const char* argv[2];
|
||||
size_t lens[2];
|
||||
|
||||
argv[0] = "SLOWLOG";
|
||||
lens[0] = sizeof("SLOWLOG") - 1;
|
||||
|
||||
argv[1] = "LEN";
|
||||
lens[1] = sizeof("LEN") - 1;
|
||||
|
||||
conn_->build_request(2, argv, lens);
|
||||
return conn_->get_number();
|
||||
}
|
||||
|
||||
bool redis_server::slowlog_reset()
|
||||
{
|
||||
const char* argv[2];
|
||||
size_t lens[2];
|
||||
|
||||
argv[0] = "SLOWLOG";
|
||||
lens[0] = sizeof("SLOWLOG") - 1;
|
||||
|
||||
argv[1] = "RESET";
|
||||
lens[1] = sizeof("RESET") - 1;
|
||||
|
||||
conn_->build_request(2, argv, lens);
|
||||
return conn_->get_status();
|
||||
}
|
||||
|
||||
bool redis_server::get_time(time_t& stamp, int& escape)
|
||||
{
|
||||
const char* argv[1];
|
||||
|
@ -37,8 +37,10 @@ bool redis_string::set(const char* key, size_t key_len,
|
||||
|
||||
argv[0] = "SET";
|
||||
lens[0] = sizeof("SET") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = key_len;
|
||||
|
||||
argv[2] = value;
|
||||
lens[2] = value_len;
|
||||
|
||||
@ -59,6 +61,36 @@ bool redis_string::setex(const char* key, size_t key_len, const char* value,
|
||||
|
||||
argv[0] = "SETEX";
|
||||
lens[0] = sizeof("SETEX") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = key_len;
|
||||
|
||||
char buf[INT_LEN];
|
||||
(void) safe_snprintf(buf, sizeof(buf), "%d", timeout);
|
||||
argv[2] = buf;
|
||||
lens[2] = strlen(buf);
|
||||
|
||||
argv[3] = value;
|
||||
lens[3] = value_len;
|
||||
|
||||
conn_->build_request(4, argv, lens);
|
||||
return conn_->get_status();
|
||||
}
|
||||
|
||||
bool redis_string::psetex(const char* key, const char* value, int timeout)
|
||||
{
|
||||
return psetex(key, strlen(key), value, strlen(value), timeout);
|
||||
}
|
||||
|
||||
bool redis_string::psetex(const char* key, size_t key_len, const char* value,
|
||||
size_t value_len, int timeout)
|
||||
{
|
||||
const char* argv[4];
|
||||
size_t lens[4];
|
||||
|
||||
argv[0] = "PSETEX";
|
||||
lens[0] = sizeof("PSETEX") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = key_len;
|
||||
|
||||
@ -87,8 +119,10 @@ int redis_string::setnx(const char* key, size_t key_len,
|
||||
|
||||
argv[0] = "SETNX";
|
||||
lens[0] = sizeof("SETNX") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = key_len;
|
||||
|
||||
argv[2] = value;
|
||||
lens[2] = value_len;
|
||||
|
||||
@ -108,8 +142,10 @@ int redis_string::append(const char* key, const char* value, size_t size)
|
||||
|
||||
argv[0] = "APPEND";
|
||||
lens[0] = sizeof("APPEND") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = strlen(key);
|
||||
|
||||
argv[2] = value;
|
||||
lens[2] = size;
|
||||
|
||||
@ -129,6 +165,7 @@ bool redis_string::get(const char* key, size_t len, string& buf)
|
||||
|
||||
argv[0] = "GET";
|
||||
lens[0] = sizeof("GET") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = len;
|
||||
|
||||
@ -148,6 +185,7 @@ const redis_result* redis_string::get(const char* key, size_t len)
|
||||
|
||||
argv[0] = "GET";
|
||||
lens[0] = sizeof("GET") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = len;
|
||||
|
||||
@ -173,8 +211,10 @@ bool redis_string::getset(const char* key, size_t key_len,
|
||||
|
||||
argv[0] = "GETSET";
|
||||
lens[0] = sizeof("GETSET") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = key_len;
|
||||
|
||||
argv[2] = value;
|
||||
lens[2] = value_len;
|
||||
|
||||
@ -196,6 +236,7 @@ int redis_string::get_strlen(const char* key, size_t len)
|
||||
|
||||
argv[0] = "STRLEN";
|
||||
lens[0] = sizeof("STRLEN") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = len;
|
||||
|
||||
@ -216,6 +257,7 @@ int redis_string::setrange(const char* key, size_t key_len, unsigned offset,
|
||||
|
||||
argv[0] = "SETRANGE";
|
||||
lens[0] = sizeof("SETRANGE") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = key_len;
|
||||
|
||||
@ -244,6 +286,7 @@ bool redis_string::getrange(const char* key, size_t key_len,
|
||||
|
||||
argv[0] = "GETRANGE";
|
||||
lens[0] = sizeof("GETRANGE") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = key_len;
|
||||
|
||||
@ -275,6 +318,7 @@ bool redis_string::setbit(const char* key, size_t len,
|
||||
|
||||
argv[0] = "SETBIT";
|
||||
lens[0] = sizeof("SETBIT") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = len;
|
||||
|
||||
@ -303,6 +347,7 @@ bool redis_string::getbit(const char* key, size_t len,
|
||||
|
||||
argv[0] = "GETBIT";
|
||||
lens[0] = sizeof("GETBIT") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = len;
|
||||
|
||||
@ -331,6 +376,7 @@ int redis_string::bitcount(const char* key, size_t len)
|
||||
|
||||
argv[0] = "BITCOUNT";
|
||||
lens[0] = sizeof("BITCOUNT") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = len;
|
||||
|
||||
@ -350,6 +396,7 @@ int redis_string::bitcount(const char* key, size_t len, int start, int end)
|
||||
|
||||
argv[0] = "BITCOUNT";
|
||||
lens[0] = sizeof("BITCOUNT") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = len;
|
||||
|
||||
@ -458,8 +505,10 @@ int redis_string::bitop(const char* op, const char* destkey,
|
||||
|
||||
argv[0] = "BITOP";
|
||||
lens[0] = sizeof("BITOP") - 1;
|
||||
|
||||
argv[1] = op;
|
||||
lens[1] = strlen(op);
|
||||
|
||||
argv[2] = destkey;
|
||||
lens[2] = strlen(destkey);
|
||||
|
||||
@ -484,8 +533,10 @@ int redis_string::bitop(const char* op, const char* destkey,
|
||||
|
||||
argv[0] = "BITOP";
|
||||
lens[0] = sizeof("BITOP") - 1;
|
||||
|
||||
argv[1] = op;
|
||||
lens[1] = strlen(op);
|
||||
|
||||
argv[2] = destkey;
|
||||
lens[2] = strlen(destkey);
|
||||
|
||||
@ -510,8 +561,10 @@ int redis_string::bitop(const char* op, const char* destkey,
|
||||
|
||||
argv[0] = "BITOP";
|
||||
lens[0] = sizeof("BITOP") - 1;
|
||||
|
||||
argv[1] = op;
|
||||
lens[1] = strlen(op);
|
||||
|
||||
argv[2] = destkey;
|
||||
lens[2] = strlen(destkey);
|
||||
|
||||
@ -687,6 +740,7 @@ bool redis_string::incrbyfloat(const char* key, double inc,
|
||||
|
||||
argv[0] = "INCRBYFLOAT";
|
||||
lens[0] = sizeof("INCRBYFLOAT") - 1;
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = strlen(key);
|
||||
|
||||
@ -724,6 +778,7 @@ bool redis_string::incoper(const char* cmd, const char* key, long long int n,
|
||||
|
||||
argv[0] = cmd;
|
||||
lens[0] = strlen(cmd);
|
||||
|
||||
argv[1] = key;
|
||||
lens[1] = strlen(key);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user