acl/lib_acl_cpp/include/acl_cpp/redis/redis_key.hpp

411 lines
14 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
2015-01-14 23:35:23 +08:00
#include <vector>
2017-06-02 14:47:24 +08:00
#include "../stdlib/string.hpp"
#include "redis_command.hpp"
2014-11-19 00:25:21 +08:00
#if !defined(ACL_CLIENT_ONLY) && !defined(ACL_REDIS_DISABLE)
2014-11-19 00:25:21 +08:00
namespace acl {
class redis_client;
2015-04-12 21:37:17 +08:00
class redis_client_cluster;
2015-01-14 23:35:23 +08:00
// redis <20><><EFBFBD><EFBFBD>֧<EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>
2015-04-12 21:37:17 +08:00
// the data type supported by redis
2015-01-14 23:35:23 +08:00
typedef enum
{
2015-04-12 21:37:17 +08:00
REDIS_KEY_NONE, // none
2015-01-14 23:35:23 +08:00
REDIS_KEY_STRING, // string
REDIS_KEY_HASH, // hash
REDIS_KEY_LIST, // list
REDIS_KEY_SET, // set
REDIS_KEY_ZSET // sorted set
} redis_key_t;
class ACL_CPP_API redis_key : virtual public redis_command
2014-11-19 00:25:21 +08:00
{
public:
2015-03-29 19:27:41 +08:00
/**
* see redis_command::redis_command()
*/
redis_key(void);
2015-03-29 19:27:41 +08:00
/**
* see redis_command::redis_command(redis_client*)
*/
redis_key(redis_client* conn);
2015-03-29 19:27:41 +08:00
/**
2016-05-22 09:10:34 +08:00
* see redis_command::redis_command(redis_client_cluster*, size_t)
2015-03-29 19:27:41 +08:00
*/
redis_key(redis_client_cluster* cluster, size_t max_conns = 0);
2015-03-29 19:27:41 +08:00
virtual ~redis_key(void);
2015-01-14 23:35:23 +08:00
/**
* ɾ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> KEY<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 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* delete one or some keys from redis, for deleting a variable
* number of keys, the last key must be NULL indicating the end
* of the variable args
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
* 0: δɾ<EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD> KEY
* -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* >0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>п<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* return the number of keys been deleted, return value as below:
* 0: none key be deleted
* -1: error happened
* >0: the number of keys been deleted
*
2015-01-14 23:35:23 +08:00
*/
int del_one(const char* key);
int del_one(const char* key, size_t len);
int del(const char* key);
2015-01-14 23:35:23 +08:00
int del(const std::vector<string>& keys);
int del(const std::vector<const char*>& keys);
int del(const char* keys[], size_t argc);
int del(const char* keys[], const size_t lens[], size_t argc);
int del_keys(const char* first_key, ...);
int del_keys(const std::vector<string>& keys);
int del_keys(const std::vector<const char*>& keys);
int del_keys(const char* keys[], size_t argc);
int del_keys(const char* keys[], const size_t lens[], size_t argc);
2015-01-14 23:35:23 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> RESTORE <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>
* Ϊ Redis <EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* serialize the object associate with the given key, and get the
* value after serializing, RESTORE command can be used to
* deserialize by the value
* @param key {const char*} <EFBFBD><EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @param out {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* buffur used to store the result
* @return {int} <EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the length of the data after serializing
*/
int dump(const char* key, string& out);
/**
* <EFBFBD>ж<EFBFBD> KEY <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* check if the key exists in redis
* @param key {const char*} KEY ֵ
2015-04-12 21:37:17 +08:00
* the key
* @return {bool} <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>
2015-04-12 21:37:17 +08:00
* true returned if key existing, false if error or not existing
*/
bool exists(const char* key);
2015-01-14 23:35:23 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* set a key's time to live in seconds
* @param key {const char*} <EFBFBD><EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @param n {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* lief cycle in seconds
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
2015-04-12 21:37:17 +08:00
* return value as below:
* > 0: <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* set successfully
* 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the key doesn't exist
* < 0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* error happened
2015-01-14 23:35:23 +08:00
*/
int expire(const char* key, int n);
/**
* <EFBFBD><EFBFBD> UNIX ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* set the expiration for a key as a UNIX timestamp
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @param stamp {time_t} UNIX ʱ<EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1970 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* an absolute Unix timestamp (seconds since January 1, 1970).
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ĺ<EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* return value:
* 1: <EFBFBD><EFBFBD><EFBFBD>óɹ<EFBFBD>
2015-04-12 21:37:17 +08:00
* the timeout was set
* 0: <EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the key doesn't exist or the timeout couldn't be set
* -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* error happened
*/
int expireat(const char* key, time_t stamp);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD><EFBFBD>ģʽ pattern <EFBFBD><EFBFBD> key
2015-04-12 21:37:17 +08:00
* find all keys matching the given pattern
* @param pattern {const char*} ƥ<EFBFBD><EFBFBD>ģʽ
2015-04-12 21:37:17 +08:00
* the give matching pattern
* @param out {std::vector<string>*} <EFBFBD><EFBFBD> NULL ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* store the matched keys
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0--Ϊ<EFBFBD>գ<EFBFBD><0 -- <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* return the number of the matched keys, 0 if none, < 0 if error
* ƥ<EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* KEYS * ƥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD>
* KEYS h?llo ƥ<EFBFBD><EFBFBD> hello <EFBFBD><EFBFBD> hallo <EFBFBD><EFBFBD> hxllo <EFBFBD>ȡ<EFBFBD>
* KEYS h*llo ƥ<EFBFBD><EFBFBD> hllo <EFBFBD><EFBFBD> heeeeello <EFBFBD>ȡ<EFBFBD>
* KEYS h[ae]llo ƥ<EFBFBD><EFBFBD> hello <EFBFBD><EFBFBD> hallo <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD> hillo <EFBFBD><EFBFBD>
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>
* 1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> get_value <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* 2<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> get_child <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD>(redis_result<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>
* redis_result::argv_to_string <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* 3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> get_result <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD>ܽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis_result<EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD>
* redis_result::get_child <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>Ԫ<EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ 2 <EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
* <EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD>Ԫ<EFBFBD>ص<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* 4<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> get_children <EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD> redis_result <EFBFBD><EFBFBD>
* <EFBFBD>ķ<EFBFBD><EFBFBD><EFBFBD> argv_to_string <EFBFBD><EFBFBD>ÿһ<EFBFBD><EFBFBD>Ԫ<EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* 5<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-30 22:58:13 +08:00
int keys_pattern(const char* pattern, std::vector<string>* out);
2015-01-23 17:23:04 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>һ<EFBFBD><EFBFBD> redis-server Ǩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> redis-server
2015-04-12 21:37:17 +08:00
* atomically transfer a key from a redis instance to another one
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>Ӧ<EFBFBD>ļ<EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @param addr {const char*} Ŀ<EFBFBD><EFBFBD> redis-server <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ip:port
2015-04-12 21:37:17 +08:00
* the destination redis instance's address, format: ip:port
* @param dest_db {unsigned} Ŀ<EFBFBD><EFBFBD> redis-server <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD> ID <EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the databases ID in destination redis
* @param timeout {unsigned} Ǩ<EFBFBD>ƹ<EFBFBD><EFBFBD>̵ij<EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD>)
2015-04-12 21:37:17 +08:00
* timeout(microseconds) in transfering
* @param option {const char*} COPY <EFBFBD><EFBFBD> REPLACE
2015-04-12 21:37:17 +08:00
* transfer option: COPY or REPLACE
* @return {bool} Ǩ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2015-04-12 21:37:17 +08:00
* if transfering successfully
2015-01-23 17:23:04 +08:00
*/
bool migrate(const char* key, const char* addr, unsigned dest_db,
unsigned timeout, const char* option = NULL);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis-server <EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* move a key to another database
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @param dest_db {unsigned} Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD> ID <EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the destination database
* @return {int} Ǩ<EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>-1: <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>1<EFBFBD><EFBFBD>Ǩ<EFBFBD>Ƴɹ<EFBFBD>
2015-04-12 21:37:17 +08:00
* if moving succcessfully. -1 if error, 0 if moving failed because
* the same key already exists, 1 if successful
2015-01-23 17:23:04 +08:00
*/
int move(const char* key, unsigned dest_db);
/**
* <EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD> key <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-04-12 21:37:17 +08:00
* get the referring count of the object, which just for debugging
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>< 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* 0 if key not exists, < 0 if error
*/
int object_refcount(const char* key);
/**
* <EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD>ʾ
2015-04-12 21:37:17 +08:00
* get the internal storing of the object assosicate with the key
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @param out {string&} <EFBFBD><EFBFBD><EFBFBD>ڽ<EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* store the result
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>
2015-04-12 21:37:17 +08:00
* if successful
*/
bool object_encoding(const char* key, string& out);
/**
* <EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD> key <EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>(idle<EFBFBD><EFBFBD> û<EFBFBD>б<EFBFBD><EFBFBD><EFBFBD>ȡҲû<EFBFBD>б<EFBFBD>д<EFBFBD><EFBFBD>)<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ
2015-04-12 21:37:17 +08:00
* get the key's idle time in seconds since its first stored
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ < 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* 0 if error happened
*/
int object_idletime(const char* key);
/**
* <EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD>"<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>"(<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> key )ת<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> key )
2015-04-12 21:37:17 +08:00
* remove the expiration from a key
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
2015-04-12 21:37:17 +08:00
* the value returned as below:
* 1 -- <EFBFBD><EFBFBD><EFBFBD>óɹ<EFBFBD>
2015-04-12 21:37:17 +08:00
* set ok
* 0 -- <EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the key not exists or not be set expiration
* -1 -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* error happened
*/
int persist(const char* key);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* set a key's time to live in milliseconds
* @param key {const char*} <EFBFBD><EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @param n {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* time to live in milliseconds
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
2015-04-12 21:37:17 +08:00
* value returned as below:
* > 0: <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* set successfully
* 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the key doesn't exist
* < 0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* error happened
*/
int pexpire(const char* key, int n);
/**
* <EFBFBD>Ժ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD> unix ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* set the expiration for a key as UNIX timestamp specified
* in milliseconds
* @param key {const char*} <EFBFBD><EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @param n {long long int} UNIX ʱ<EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1970 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the UNIX timestamp in milliseconds from 1970.1.1
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
2015-04-12 21:37:17 +08:00
* value resturned as below:
* > 0: <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* set successfully
* 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the key doesn't exist
* < 0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* error happened
*/
int pexpireat(const char* key, long long int n);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* get the time to live for a key in milliseconds
* @param key {const char*} <EFBFBD><EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @return {int} <EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>Ӧ<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* value returned as below:
* >0: <EFBFBD><EFBFBD> key ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the time to live for a key in milliseconds
* -3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* error happened
* -2<EFBFBD><EFBFBD>key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the key doesn't exist
* -1<EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* th key were not be set expiration
* ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis-server 2.8 <EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD> -1
2015-04-12 21:37:17 +08:00
* notice: for redis version before 2.8, -1 will be returned if the
* key doesn't exist or the key were not be set expiration.
*/
long long int pttl(const char* key);
/**
* <EFBFBD>ӵ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>)һ<EFBFBD><EFBFBD> key
2015-04-12 21:37:17 +08:00
* return a random key from the keyspace
<EFBFBD><EFBFBD>@param buf {string&} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* store the key
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> false
2015-04-12 21:37:17 +08:00
* true on success, or false be returned
*/
bool randmkey(string& buf);
/**
* <EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ newkey
2015-04-12 21:37:17 +08:00
* rename a key
* @return {bool}
2015-04-12 21:37:17 +08:00
* true on success, or error happened
*/
bool rename_key(const char* key, const char* newkey);
/**
* <EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><EFBFBD><EFBFBD> newkey <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ newkey
2015-04-12 21:37:17 +08:00
* rename a key only if the new key does not exist
* @param key {const char*} <EFBFBD><EFBFBD> key
* @param newkey {const char*} <EFBFBD><EFBFBD> key
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0: <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><EFBFBD> Ŀ<EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>< 0<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
* return value > 0 on success, < 0 on error, == 0 when newkey exists
*/
int renamenx(const char* key, const char* newkey);
/**
* <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> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* create a key using the provided serialized value, previously
* obtained by using DUMP
* @param ttl {int} <EFBFBD>Ժ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λΪ key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ttl Ϊ 0<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the time to live for the key in milliseconds, if tll is 0,
* expiration will not be set
* @param replace {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ֱ<EFBFBD>Ӹ<EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* if the key already exists, this parameter decides if replacing
* the existing key
* @return {bool}
2015-04-12 21:37:17 +08:00
* true on success, false on error
*/
bool restore(const char* key, const char* value, size_t len,
int ttl, bool replace = false);
2015-01-14 23:35:23 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* get the time to live for a key in seconds
* @param key {const char*} <EFBFBD><EFBFBD>ֵ
2015-04-12 21:37:17 +08:00
* the key
* @return {int} <EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>Ӧ<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* return value as below:
* > 0: <EFBFBD><EFBFBD> key ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the time to live for a key in seconds
* -3<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* error happened
* -2<EFBFBD><EFBFBD>key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the key doesn't exist
* -1<EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the key were not be set expiration
* ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> redis-server 2.8 <EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD> -1
2015-04-12 21:37:17 +08:00
* notice: for the redis version before 2.8, -1 will be returned
* if the key doesn't exist or the key were not be set expiration
2015-01-14 23:35:23 +08:00
*/
2015-01-23 17:23:04 +08:00
int ttl(const char* key);
2015-01-14 23:35:23 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* get the the type stored at key
* @para key {const char*} KEY ֵ
2015-04-12 21:37:17 +08:00
* the key
* @return {redis_key_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD> KEY <EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* return redis_key_t defined above as REDIS_KEY_
2015-01-14 23:35:23 +08:00
*/
redis_key_t type(const char* key);
/**
* <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-04-12 21:37:17 +08:00
* incrementally iterate the keys space in the specified database
* @param cursor {int} <EFBFBD>α<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ֵд 0
2015-04-12 21:37:17 +08:00
* the iterating cursor beginning with 0
* @param out {std::vector<acl::string>&} <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><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>
2015-04-12 21:37:17 +08:00
* string array storing the results, the array will be cleared
* internal and the string result will be appened to the array
* @param pattern {const char*} ƥ<EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>glob <EFBFBD><EFBFBD><EFBFBD>񣬷ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD>Ч
2015-04-12 21:37:17 +08:00
& the matching pattern with glob style, only effective if not NULL
* @param count {const size_t*} <EFBFBD>޶<EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>ָ<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ч
2015-04-12 21:37:17 +08:00
* limit the max number of the results stored in array, only
* effective when not NULL
* @return {int} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>α<EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
2015-04-12 21:37:17 +08:00
* return the next cursor value as follow:
* 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> out <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>
2019-03-28 11:18:10 +08:00
* iterating is finished and the out should be checked if emtpy
* -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* some error happened
* >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> out<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>п<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
2015-04-12 21:37:17 +08:00
* the next cursor value for iterating
*/
2015-01-23 17:23:04 +08:00
int scan(int cursor, std::vector<string>& out,
const char* pattern = NULL, const size_t* count = NULL);
2014-11-19 00:25:21 +08:00
};
} // namespace acl
#endif // !defined(ACL_CLIENT_ONLY) && !defined(ACL_REDIS_DISABLE)