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

357 lines
15 KiB
C++
Raw Normal View History

#pragma once
2017-06-02 14:47:24 +08:00
#include "../acl_cpp_define.hpp"
#include <vector>
2017-06-02 14:47:24 +08:00
#include "../stdlib/string.hpp"
#include "redis_command.hpp"
namespace acl
{
class redis_client;
class ACL_CPP_API redis_set : virtual public redis_command
{
public:
2015-03-29 19:27:41 +08:00
/**
* see redis_command::redis_command()
*/
redis_set(void);
2015-03-29 19:27:41 +08:00
/**
* see redis_command::redis_command(redis_client*)
*/
redis_set(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_set(redis_client_cluster* cluster, size_t max_conns = 0);
2015-03-29 19:27:41 +08:00
virtual ~redis_set(void);
/////////////////////////////////////////////////////////////////////
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> member Ԫ<EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><EFBFBD>ϵ<EFBFBD> member Ԫ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
* 1) <EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD><EFBFBD>򴴽<EFBFBD>һ<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> member Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
* 2) <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>
2015-04-15 22:56:48 +08:00
* add one or more members to a set stored at a key
* 1) if the key doesn't exist, a new set by the key will be created,
* and add the members to the set
* 2) if the key exists and not a set's key, then error happened
2015-01-29 00:38:29 +08:00
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
2015-04-15 22:56:48 +08:00
* the key of a set
2015-01-29 00:38:29 +08:00
* @param first_member {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL <EFBFBD>ij<EFBFBD>Ա
2015-04-15 22:56:48 +08:00
* the first member of a variable args which isn't NULL, the last
* arg of the args must be NULL indicating the end of args
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><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-15 22:56:48 +08:00
* the number of elements that were added to the set, not including
* all the elements already present into the set. -1 if error
* happened or it isn't a set stored by the key.
2015-01-29 00:38:29 +08:00
*/
int sadd(const char* key, const char* first_member, ...);
int sadd(const char* key, const std::vector<const char*>& memsbers);
int sadd(const char* key, const std::vector<string>& members);
int sadd(const char* key, const char* argv[], size_t argc);
int sadd(const char* key, const char* argv[], const size_t lens[],
size_t argc);
2015-01-29 00:38:29 +08:00
/**
* <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>Ա
2015-04-15 22:56:48 +08:00
* remove and get one member from the set
2015-01-29 00:38:29 +08:00
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
2015-04-15 22:56:48 +08:00
* the key of the set
2015-01-29 00:38:29 +08:00
* @param buf {string&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD>ij<EFBFBD>Ա
2015-04-15 22:56:48 +08:00
* store the member removed from the set
2015-01-29 00:38:29 +08:00
* @return {bool} <EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD> key <EFBFBD>ǿռ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> false
2015-04-15 22:56:48 +08:00
* true if one member has been removed and got, false if the key
* doesn't exist or it isn't a set stored at the key.
2015-01-29 00:38:29 +08:00
*/
bool spop(const char* key, string& buf);
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* get the number of members in a set stored at the key
2015-01-29 00:38:29 +08:00
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
2015-04-15 22:56:48 +08:00
* the key of the set
2015-01-29 00:38:29 +08:00
* @return {int} <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-15 22:56:48 +08:00
* return int value as below:
2015-01-29 00:38:29 +08:00
* -1<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* error or it's not a set by the key
2015-01-29 00:38:29 +08:00
* 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ջ<EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* the set is empty or the key doesn't exist
2015-01-29 00:38:29 +08:00
* >0<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>
2015-04-15 22:56:48 +08:00
* the number of members in the set
2015-01-29 00:38:29 +08:00
*/
int scard(const char* key);
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD> key <EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD>Ա
2015-04-15 22:56:48 +08:00
* get all the members in a set stored at a key
2015-01-29 00:38:29 +08:00
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of the set
2015-01-30 22:58:13 +08:00
* @param members {std::vector<string>*} <EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* if not NULL, it will store the members.
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> key <EFBFBD>Ǽ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* the number of elements got, -1 if error happened or it't not
* a set by the key.
*
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>
2015-04-15 22:56:48 +08:00
* if successul, one of below ways can be used to get the result:
* 1<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿյĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ
* the most easily way is to set a non-NULL result parameter
* for this function
2015-04-15 22:56:48 +08:00
* 2<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>
* call redis_command::result_value with the specified subscript
* 3<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>
2015-01-30 22:58:13 +08:00
* redis_result::argv_to_string <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* get redis_result object with the given subscript, and get the
* element by redis_result::argv_to_string
2015-04-15 22:56:48 +08:00
* 4<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>
2015-01-30 22:58:13 +08:00
* 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>
* get redis_result object by redis_command::get_result, and get
* the first element by redis_result::get_child, then get the
* element by the way same as the way 2 above
2015-04-15 22:56:48 +08:00
* 5<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>
2015-01-30 22:58:13 +08:00
* <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>
* get child array by redis_command::get_children, and get the
* element from one of redis_result array by argv_to_string
2015-01-29 00:38:29 +08:00
*/
2015-01-30 22:58:13 +08:00
int smembers(const char* key, std::vector<string>* members);
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD><EFBFBD> member Ԫ<EFBFBD>ش<EFBFBD> src <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD><EFBFBD><EFBFBD> dst <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* move a member from one set to another
2015-01-29 00:38:29 +08:00
* @param src {const char*} Դ<EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the source key of a set
2015-01-29 00:38:29 +08:00
* @param dst {const char*} Ŀ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the destination key of a set
2015-01-29 00:38:29 +08:00
* @param member {const char*} Դ<EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>Ա
2015-04-15 22:56:48 +08:00
* the member in the source set
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
2015-04-15 22:56:48 +08:00
* return int value as below:
2015-01-29 00:38:29 +08:00
* -1<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-15 22:56:48 +08:00
* error happened, or one of source and destination isn't a set
2015-01-29 00:38:29 +08:00
* 0<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>󲻴<EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* the source set or the member doesn't exist
2015-01-29 00:38:29 +08:00
* 1<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><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-15 22:56:48 +08:00
* move successfully the member from source set to
* the destination set
2015-01-29 00:38:29 +08:00
*/
int smove(const char* src, const char* dst, const char* member);
int smove(const char* src, const char* dst, const string& member);
int smove(const char* src, const char* dst,
const char* member, size_t len);
2015-01-29 00:38:29 +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>IJ
2015-04-15 22:56:48 +08:00
* return the members of the set resulting from the difference
* between the first set and all the successive sets.
2015-01-30 22:58:13 +08:00
* @param members {std::vector<string>*} <EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* if not NULL, it will store the members.
2015-01-29 00:38:29 +08:00
* @param first_key {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ǿյļ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD> key
2015-04-15 22:56:48 +08:00
* the key of the first set in a variable sets list, the last one
* must be NULL indicating the end of the sets list.
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> key <EFBFBD>Ǽ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* the number of elements got, -1 if error happened or it't not
* a set by the key.
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>
2015-04-15 22:56:48 +08:00
* if successul, one of below ways can be used to get the result:
* 1<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǿյĴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>ַ
* the most easily way is to set a non-NULL result parameter
* for this function
2015-04-15 22:56:48 +08:00
* 2<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>
* get the specified subscript's element by redis_command::get_value
2015-04-15 22:56:48 +08:00
* 3<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>
2015-01-30 22:58:13 +08:00
* redis_result::argv_to_string <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* get redis_result object with the given subscript, and get the
* element by redis_result::argv_to_string
2015-04-15 22:56:48 +08:00
* 4<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>
2015-01-30 22:58:13 +08:00
* 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>
* get redis_result object by redis_command::get_result, and get
* the first element by redis_result::get_child, then get the
* element by the way same as the way 2 above.
2015-04-15 22:56:48 +08:00
* 5<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>
2015-01-30 22:58:13 +08:00
* <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>
* get child array by redis_command::get_children, and get the
* element from one of redis_result array by argv_to_string
2015-01-29 00:38:29 +08:00
*/
2015-01-30 22:58:13 +08:00
int sdiff(std::vector<string>* members, const char* first_key, ...);
int sdiff(const std::vector<const char*>& keys,
2015-01-30 22:58:13 +08:00
std::vector<string>* members);
int sdiff(const std::vector<string>& keys,
2015-01-30 22:58:13 +08:00
std::vector<string>* members);
2015-01-29 00:38:29 +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>
2015-04-15 22:56:48 +08:00
* return the members of a set resulting from the intersection of
* all the give sets.
2015-01-30 22:58:13 +08:00
* @param members {std::vector<string>*} <EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* if not NULL, it will store the result
2015-01-29 00:38:29 +08:00
* @param first_key {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD> key<EFBFBD><EFBFBD><EFBFBD><EFBFBD>NULL<EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* the key of the first set in a variable set list, which isn't NULL,
* the last one must be NULL in the set list.
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> key <EFBFBD>Ǽ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* return the number of the members, -1 if error happened or
* it't not a set by the key.
2015-01-29 00:38:29 +08:00
*/
2015-01-30 22:58:13 +08:00
int sinter(std::vector<string>* members, const char* first_key, ...);
int sinter(const std::vector<const char*>& keys,
2015-01-30 22:58:13 +08:00
std::vector<string>* members);
int sinter(const std::vector<string>& keys,
2015-01-30 22:58:13 +08:00
std::vector<string>* members);
2015-01-29 00:38:29 +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>ϵIJ<EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* return the members of a set resulting from the union of all the
* given sets.
2015-01-30 22:58:13 +08:00
* @param members {std::vector<string>*} <EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* if not NULL, it will store the result
2015-01-29 00:38:29 +08:00
* @param first_key {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD> key<EFBFBD><EFBFBD><EFBFBD><EFBFBD>NULL<EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* the key of the first set in a variable set list, which isn't NULL,
* and the last arg must be NULL indicating the end of the set list.
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> key <EFBFBD>Ǽ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* return the number of members, -1 if error happened or it's not
* a set by the key.
2015-01-29 00:38:29 +08:00
*/
2015-01-30 22:58:13 +08:00
int sunion(std::vector<string>* members, const char* first_key, ...);
int sunion(const std::vector<const char*>& keys,
2015-01-30 22:58:13 +08:00
std::vector<string>* members);
int sunion(const std::vector<string>& keys,
2015-01-30 22:58:13 +08:00
std::vector<string>* members);
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD> SDIFF <EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> dst <EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ򵥵ط<EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* This command is equal to SDIFF, but instead of returning
* the resulting set, it is stored in destination.
2015-01-29 00:38:29 +08:00
* @param dst {const char*} Ŀ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of the destination set
2015-01-29 00:38:29 +08:00
* @param first_key {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ǿյļ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of the first set in a variable set list, which isn't NULL,
* and the last arg must be NULL indicating the end of the set list.
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еij<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* return the number of members, -1 if error happened or it's not
* a set by the key.
2015-01-29 00:38:29 +08:00
*/
int sdiffstore(const char* dst, const char* first_key, ...);
int sdiffstore(const char* dst, const std::vector<const char*>& keys);
int sdiffstore(const char* dst, const std::vector<string>& keys);
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SINTER <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> dst <EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ򵥵ط<EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* This command is equal to SINTER, but instead of returning
* the resulting set, it is stored in destination.
2015-01-29 00:38:29 +08:00
* @param dst {const char*} Ŀ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of the destination set
2015-01-29 00:38:29 +08:00
* @param first_key {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ǿյļ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of the first set in a variable set list, which isn't NULL,
* and the last arg must be NULL indicating the end of the set list.
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еij<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* return the number of members, -1 if error happened or it's not
* a set by the key.
2015-01-29 00:38:29 +08:00
*/
int sinterstore(const char* dst, const char* first_key, ...);
int sinterstore(const char* dst, const std::vector<const char*>& keys);
int sinterstore(const char* dst, const std::vector<string>& keys);
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SUNION <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> dst <EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ򵥵ط<EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* This command is equal to SUNION, but instead of returning
* the resulting set, it is stored in destination.
2015-01-29 00:38:29 +08:00
* @param dst {const char*} Ŀ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of the destination set
2015-01-29 00:38:29 +08:00
* @param first_key {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ǿյļ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of the first set in a variable set list, which isn't NULL,
* and the last arg must be NULL indicating the end of the set list.
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еij<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* return the number of members, -1 if error happened or it's not
* a set by the key.
2015-01-29 00:38:29 +08:00
*/
int sunionstore(const char* dst, const char* first_key, ...);
int sunionstore(const char* dst, const std::vector<const char*>& keys);
int sunionstore(const char* dst, const std::vector<string>& keys);
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD>ж<EFBFBD> member Ԫ<EFBFBD><EFBFBD><EFBFBD>Ƿ񼯺<EFBFBD> key <EFBFBD>ij<EFBFBD>Ա
2015-04-15 22:56:48 +08:00
* determine if a given value is a member of a set
2015-01-29 00:38:29 +08:00
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of a set
* @param member {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
* the given value
2015-01-29 00:38:29 +08:00
* @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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD>Ǽ<EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* true if the given is a member of the set, false if it's not a
* member of the set, or error, or it's not a set by the key.
2015-01-29 00:38:29 +08:00
*/
bool sismember(const char* key, const char* member);
bool sismember(const char* key, const char* member, size_t len);
2015-01-29 00:38:29 +08:00
/**
* <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><EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬʱָ<EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>Ԫ<EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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-15 22:56:48 +08:00
* get one or multiple memebers from a set
2015-01-29 00:38:29 +08:00
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of a set
2015-01-29 00:38:29 +08:00
* @param out <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* store the result
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0 <EFBFBD><EFBFBD>ʾû<EFBFBD>г<EFBFBD>Ա
2015-04-15 22:56:48 +08:00
* the number of members, 0 if the set by the key is empty,
* -1 if error happened.
2015-01-29 00:38:29 +08:00
*/
int srandmember(const char* key, string& out);
int srandmember(const char* key, size_t n, std::vector<string>& out);
2015-01-29 00:38:29 +08:00
/**
* <EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD>е<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> member Ԫ<EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD> member Ԫ<EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* Remove the specified members from the set stored at key. if the
* member doesn't exist, it will be ignored.
2015-01-29 00:38:29 +08:00
* @param key {const char*} <EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of the set
2015-01-29 00:38:29 +08:00
* @param first_member {const char*} <EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD>ij<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>д NULL
2015-04-15 22:56:48 +08:00
* the first non-NULL member to be removed in a variable member list,
* and the last one must be NULL indicating the end of the list.
2015-01-29 00:38:29 +08:00
* @retur {int} <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><EFBFBD><EFBFBD> -1<EFBFBD><EFBFBD><EFBFBD><EFBFBD> key <EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0
2015-04-15 22:56:48 +08:00
* the number of members be removed, 0 if the set is empty or the
* key doesn't exist, -1 if error happened or it's not a set by key
2015-01-29 00:38:29 +08:00
*/
int srem(const char* key, const char* first_member, ...);
int srem(const char* key, const std::vector<string>& members);
int srem(const char* key, const std::vector<const char*>& members);
int srem(const char* key, const char* members[],
size_t lens[], size_t argc);
2015-01-23 17:23:04 +08:00
2015-01-29 00:38:29 +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>
2015-04-15 22:56:48 +08:00
* scan the members in a set stored at key
2015-01-29 00:38:29 +08:00
* @param key {const char*} <EFBFBD><EFBFBD>ϣ<EFBFBD><EFBFBD>ֵ
2015-04-15 22:56:48 +08:00
* the key of a set
2015-01-29 00:38:29 +08:00
* @param cursor {int} <EFBFBD>α<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>ֵд 0
2015-04-15 22:56:48 +08:00
* the cursor value, which is 0 at begin
* @param out {std::vector<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>
2015-04-15 22:56:48 +08:00
* store result in appending mode.
2015-01-29 00:38:29 +08:00
* @param pattern {const char*} ƥ<EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>glob <EFBFBD><EFBFBD><EFBFBD>񣬷ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD>Ч
2015-04-15 22:56:48 +08:00
* match pattern, effective only on no-NULL
2015-01-29 00:38:29 +08:00
* @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-15 22:56:48 +08:00
* the max count of one scan process, effective only on no-NULL
2015-01-29 00:38:29 +08:00
* @return {int} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>α<EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>
2015-04-15 22:56:48 +08:00
* return the next cursor position, as below:
2015-01-29 00:38:29 +08:00
* 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +08:00
* scan finish
2015-01-29 00:38:29 +08:00
* -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-04-15 22:56:48 +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-15 22:56:48 +08:00
* the next cursor postion to scan
2015-01-29 00:38:29 +08:00
*/
2015-01-23 17:23:04 +08:00
int sscan(const char* key, int cursor, std::vector<string>& out,
const char* pattern = NULL, const size_t* count = NULL);
};
} // namespace acl