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

157 lines
5.6 KiB
C++
Raw Normal View History

#pragma once
#include "acl_cpp/acl_cpp_define.hpp"
2015-01-23 17:23:04 +08:00
#include <vector>
#include <map>
#include "acl_cpp/redis/redis_command.hpp"
namespace acl
{
class redis_client;
class redis_result;
class string;
class ACL_CPP_API redis_pubsub : virtual public redis_command
{
public:
2015-03-29 19:27:41 +08:00
/**
* see redis_command::redis_command()
*/
redis_pubsub();
2015-03-29 19:27:41 +08:00
/**
* see redis_command::redis_command(redis_client*)
*/
redis_pubsub(redis_client* conn);
2015-03-29 19:27:41 +08:00
/**
* see redis_command::redis_command(redis_client_cluster*<EFBFBD><EFBFBD> size_t)
2015-03-29 19:27:41 +08:00
*/
redis_pubsub(redis_client_cluster* cluster, size_t max_conns);
2015-03-29 19:27:41 +08:00
virtual ~redis_pubsub();
/////////////////////////////////////////////////////////////////////
/**
2015-01-29 00:38:29 +08:00
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD> channel
* @param channel {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>
* @param msg {const char*} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param len {size_t} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @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>
* -1<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-01-29 00:38:29 +08:00
* 0<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>
*/
int publish(const char* channel, const char* msg, size_t len);
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><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>
* subscribe<EFBFBD><EFBFBD>unsubscribe<EFBFBD><EFBFBD>psubscribe<EFBFBD><EFBFBD>punsubscribe<EFBFBD><EFBFBD>get_message<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>
* ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<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 first_channel {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>ĵ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><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
* @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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
int subscribe(const char* first_channel, ...);
2015-01-23 17:23:04 +08:00
int subscribe(const std::vector<const char*>& channels);
int subscribe(const std::vector<string>& channels);
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>Ϣ
* @param first_channel {const char*} <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>ĵ<EFBFBD>һ<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>
*/
int unsubscribe(const char* first_channel, ...);
2015-01-23 17:23:04 +08:00
int unsubscribe(const std::vector<const char*>& channels);
int unsubscribe(const std::vector<string>& channels);
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>ÿ<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>У<EFBFBD>
* subscribe<EFBFBD><EFBFBD>unsubscribe<EFBFBD><EFBFBD>psubscribe<EFBFBD><EFBFBD>punsubscribe<EFBFBD><EFBFBD>get_message<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>
* ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<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 first_pattern {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>
* @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><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
2015-01-23 17:23:04 +08:00
int psubscribe(const char* first_pattern, ...);
int psubscribe(const std::vector<const char*>& patterns);
int psubscribe(const std::vector<string>& patterns);
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>Ϣ
* @param first_pattern {const char*} <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD>
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>
*/
2015-01-23 17:23:04 +08:00
int punsubscribe(const char* first_pattern, ...);
int punsubscribe(const std::vector<const char*>& patterns);
int punsubscribe(const std::vector<string>& patterns);
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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD> subscribe
* <EFBFBD><EFBFBD> psubscribe <EFBFBD><EFBFBD><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 channel {string&} <EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param msg {string&} <EFBFBD><EFBFBD><EFBFBD>ŵ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
bool get_message(string& channel, string& msg);
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><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
* @param channels {std::vector<string>*} <EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2015-01-29 00:38:29 +08:00
* @param first_pattern {const char*} <EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><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>ʱ<EFBFBD><EFBFBD>ȡָ<EFBFBD><EFBFBD><EFBFBD>еĻ<EFBFBD>ԾƵ<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
* @return {int} <EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD>ԾƵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><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-29 00:38:29 +08:00
*/
2015-01-30 22:58:13 +08:00
int pubsub_channels(std::vector<string>* channels,
2015-01-23 17:23:04 +08:00
const char* first_pattern, ...);
int pubsub_channels(const std::vector<const char*>& patterns,
2015-01-30 22:58:13 +08:00
std::vector<string>* channels);
2015-01-23 17:23:04 +08:00
int pubsub_channels(const std::vector<string>& patterns,
2015-01-30 22:58:13 +08:00
std::vector<string>* channels);
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>ģʽ<EFBFBD>Ŀͻ<EFBFBD><EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param out {std::map<string, int>&} <EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> out->first <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>out->second <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>Ķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param first_pattern {const char*} <EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><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>ʱ<EFBFBD><EFBFBD>ȡָ<EFBFBD><EFBFBD><EFBFBD>еĻ<EFBFBD>ԾƵ<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
* @return {int} Ƶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
2015-01-23 17:23:04 +08:00
int pubsub_numsub(std::map<string, int>& out,
const char* first_channel, ...);
int pubsub_numsub(const std::vector<const char*>& channels,
std::map<string, int>& out);
int pubsub_numsub(const std::vector<string>& channels,
std::map<string, int>& out);
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>ص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><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܺ<EFBFBD>
* @return {int} <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>ģʽ<EFBFBD><EFBFBD><EFBFBD>ܺͣ<EFBFBD>-1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
2015-01-23 17:23:04 +08:00
int pubsub_numpat();
private:
2015-01-23 17:23:04 +08:00
int subop(const char* cmd, const std::vector<const char*>& channels);
int subop(const char* cmd, const std::vector<string>& channels);
int check_channel(const redis_result* obj, const char* cmd,
const string& channel);
2015-01-26 19:58:02 +08:00
int pubsub_numsub(std::map<string, int>& out);
};
} // namespace acl