iFun Engine API  1.0.0-b3630
Great Technology for Great Games
 All Classes Files Functions Variables Typedefs Macros
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
fun::RedisClient Class Reference

Classes

struct  Reply
 
struct  Result
 

Public Types

typedef function< void(const
Result &, const Ptr< Reply > &)> 
Callback
 
enum  CommandOption {
  kNone = 0, kEX, kPX, kNX,
  kXX, kAND, kOR, kXOR,
  kNOT, kBEFORE, kAFTER
}
 
typedef function< void(const
Result &, double)> 
DoubleCallback
 
typedef function< void(const
Result &, int64_t)> 
IntegerCallback
 
typedef function< void(const
string &, const string
&, const string &)> 
PSubCallback
 
typedef Uuid SerializationTag
 
typedef function< void(const
Result &, const string &)> 
StringCallback
 
typedef std::pair< string, double > StringDoublePair
 
typedef std::vector
< StringDoublePair > 
StringDoublePairList
 
typedef function< void(const
Result &, const
StringDoublePairList &)> 
StringDoublePairListCallback
 
typedef std::vector< string > StringList
 
typedef function< void(const
Result &, const StringList &)> 
StringListCallback
 
typedef std::pair< string, string > StringPair
 
typedef std::vector< StringPair > StringPairList
 
typedef function< void(const
Result &, const StringPairList &)> 
StringPairListCallback
 
typedef function< void(const
string &, const string &)> 
SubCallback
 

Public Member Functions

void Append (const string &key, const string &value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 For redis commands 'Strings' section.
 
Result AppendSync (const string &key, const string &value, int64_t *out)
 
void BitCount (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void BitCount (const string &key, int64_t start, int64_t end, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result BitCountSync (const string &key, int64_t *out)
 
Result BitCountSync (const string &key, int64_t start, int64_t end, int64_t *out)
 
void BitOp (CommandOption operation, const string &dest_key, const StringList &keys, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result BitOpSync (CommandOption operation, const string &dest_key, const StringList &keys, int64_t *out)
 
void Decr (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void DecrBy (const string &key, int64_t decrement, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result DecrBySync (const string &key, int64_t decrement, int64_t *out)
 
Result DecrSync (const string &key, int64_t *out)
 
void Del (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 For redis commands 'Keys' section.
 
void Del (const StringList &keys, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result DelSync (const string &key, int64_t *out)
 
Result DelSync (const StringList &keys, int64_t *out)
 
void DumpProfilingResult (Json *out)
 
void ExecuteCommand (const string &command_name, const std::vector< string > *arguments, const Callback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Ptr< ReplyExecuteCommandSync (const string &command_name, const std::vector< string > *arguments, Result *result=NULL)
 
void Exists (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ExistsSync (const string &key, int64_t *out)
 
void Expire (const string &key, uint64_t seconds, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ExpireSync (const string &key, uint64_t seconds, int64_t *out)
 
void Finalize ()
 
void Get (const string &key, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void GetBit (const string &key, uint64_t offset, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result GetBitSync (const string &key, uint64_t offset, int64_t *out)
 
void GetRange (const string &key, int64_t start, int64_t end, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result GetRangeSync (const string &key, int64_t start, int64_t end, string *out)
 
void GetSet (const string &key, const string &value, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result GetSetSync (const string &key, const string &value, string *out)
 
Result GetSync (const string &key, string *out)
 
void HDel (const string &key, const string &field, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void HDel (const string &key, const StringList &fields, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HDelSync (const string &key, const string &field, int64_t *out)
 
Result HDelSync (const string &key, const StringList &fields, int64_t *out)
 
void HExists (const string &key, const string &field, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 For redis commands 'Hashes' section.
 
Result HExistsSync (const string &key, const string &field, int64_t *out)
 
void HGet (const string &key, const string &field, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void HGetAll (const string &key, const StringPairListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HGetAllSync (const string &key, StringPairList *out)
 
Result HGetSync (const string &key, const string &field, string *out)
 
void HIncrBy (const string &key, const string &field, int64_t increment, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void HIncrByFloat (const string &key, const string &field, double increment, const DoubleCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HIncrByFloatSync (const string &key, const string &field, double increment, double *out)
 
Result HIncrBySync (const string &key, const string &field, int64_t increment, int64_t *out)
 
void HKeys (const string &key, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HKeysSync (const string &key, StringList *out)
 
void HLen (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HLenSync (const string &key, int64_t *out)
 
void HMGet (const string &key, const StringList &fields, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HMGetSync (const string &key, const StringList &fields, StringList *out)
 
void HMSet (const string &key, const StringPairList &field_values, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HMSetSync (const string &key, const StringPairList &field_values, string *out)
 
void HSet (const string &key, const string &field, const string &value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void HSetNx (const string &key, const string &field, const string &value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HSetNxSync (const string &key, const string &field, const string &value, int64_t *out)
 
Result HSetSync (const string &key, const string &field, const string &value, int64_t *out)
 
void HVals (const string &key, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result HValsSync (const string &key, StringList *out)
 
void Incr (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void IncrBy (const string &key, int64_t increment, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void IncrByFloat (const string &key, double increment, const DoubleCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result IncrByFloatSync (const string &key, double increment, double *out)
 
Result IncrBySync (const string &key, int64_t increment, int64_t *out)
 
Result IncrSync (const string &key, int64_t *out)
 
void Initialize ()
 
bool invoke_as_event () const
 
void LIndex (const string &key, int64_t index, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result LIndexSync (const string &key, int64_t index, string *out)
 
void LInsert (const string &key, CommandOption before_or_after, const string &pivot, const string &value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result LInsertSync (const string &key, CommandOption before_or_after, const string &pivot, const string &value, int64_t *out)
 
void LLen (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 For redis commands 'Lists' section.
 
Result LLenSync (const string &key, int64_t *out)
 
void LPop (const string &key, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result LPopSync (const string &key, string *out)
 
void LPush (const string &key, const string &value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void LPush (const string &key, const StringList &values, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result LPushSync (const string &key, const string &value, int64_t *out)
 
Result LPushSync (const string &key, const StringList &values, int64_t *out)
 
void LRange (const string &key, int64_t start, int64_t stop, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result LRangeSync (const string &key, int64_t start, int64_t stop, StringList *out)
 
void LRem (const string &key, int64_t count, const string &value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result LRemSync (const string &key, int64_t count, const string &value, int64_t *out)
 
void LSet (const string &key, int64_t index, const string &value, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result LSetSync (const string &key, int64_t index, const string &value, string *out)
 
void LTrim (const string &key, int64_t start, int64_t stop, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result LTrimSync (const string &key, int64_t start, int64_t stop, string *out)
 
void MGet (const StringList &keys, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result MGetSync (const StringList &keys, StringList *out)
 
void MSet (const StringPairList &key_values, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void MSetNx (const StringPairList &key_values, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result MSetNxSync (const StringPairList &key_values, int64_t *out)
 
Result MSetSync (const StringPairList &key_values, string *out)
 
void Persist (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result PersistSync (const string &key, int64_t *out)
 
void PExpire (const string &key, uint64_t milliseconds, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result PExpireSync (const string &key, uint64_t milliseconds, int64_t *out)
 
void PSetEx (const string &key, uint64_t milliseconds, const string &value, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result PSetExSync (const string &key, uint64_t milliseconds, const string &value, string *out)
 
void PSubscribe (const string &pattern, const PSubCallback &callback)
 
void PSubscribe (const std::vector< string > &patterns, const PSubCallback &callback)
 
void PTTL (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result PTTLSync (const string &key, int64_t *out)
 
void Publish (const string &channel, const string &message, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 For redis commands 'Pub/Sub' section.
 
Result PublishSync (const string &channel, const string &message, int64_t *out)
 
void PUnsubscribe ()
 
void PUnsubscribe (const string &pattern)
 
void PUnsubscribe (const std::vector< string > &patterns)
 
void Rename (const string &key, const string &new_key, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result RenameSync (const string &key, const string &new_key, string *out)
 
void RPop (const string &key, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result RPopSync (const string &key, string *out)
 
void RPush (const string &key, const string &value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void RPush (const string &key, const StringList &values, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result RPushSync (const string &key, const string &value, int64_t *out)
 
Result RPushSync (const string &key, const StringList &values, int64_t *out)
 
void SAdd (const string &key, const string &member, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void SAdd (const string &key, const StringList &members, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SAddSync (const string &key, const string &member, int64_t *out)
 
Result SAddSync (const string &key, const StringList &members, int64_t *out)
 
void SCard (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 For redis commands 'Sets' section.
 
Result SCardSync (const string &key, int64_t *out)
 
void SDiff (const StringList &keys, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void SDiffStore (const string &destination, const StringList &keys, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SDiffStoreSync (const string &destination, const StringList &keys, int64_t *out)
 
Result SDiffSync (const StringList &keys, StringList *out)
 
void Set (const string &key, const string &value, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void Set (const string &key, const string &value, CommandOption ex_or_px, uint64_t time, CommandOption nx_or_xx, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void SetBit (const string &key, uint64_t offset, bool value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SetBitSync (const string &key, uint64_t offset, bool value, int64_t *out)
 
void SetEx (const string &key, uint64_t seconds, const string &value, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SetExSync (const string &key, uint64_t seconds, const string &value, string *out)
 
void SetNx (const string &key, const string &value, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SetNxSync (const string &key, const string &value, int64_t *out)
 
void SetProfiling (bool is_on)
 
Result SetSync (const string &key, const string &value, string *out)
 
Result SetSync (const string &key, const string &value, CommandOption ex_or_px, uint64_t time, CommandOption nx_or_xx, string *out)
 
void SInter (const StringList &keys, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void SInterStore (const string &destination, const StringList &keys, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SInterStoreSync (const string &destination, const StringList &keys, int64_t *out)
 
Result SInterSync (const StringList &keys, StringList *out)
 
void SIsMember (const string &key, const string &member, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SIsMemberSync (const string &key, const string &member, int64_t *out)
 
void SMembers (const string &key, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SMembersSync (const string &key, StringList *out)
 
void SMove (const string &source, const string &destination, const string &member, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SMoveSync (const string &source, const string &destination, const string &member, int64_t *out)
 
void SPop (const string &key, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SPopSync (const string &key, string *out)
 
void SRandMember (const string &key, const StringCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void SRandMember (const string &key, int64_t count, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SRandMemberSync (const string &key, string *out)
 
Result SRandMemberSync (const string &key, int64_t count, StringList *out)
 
void SRem (const string &key, const string &member, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void SRem (const string &key, const StringList &members, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SRemSync (const string &key, const string &member, int64_t *out)
 
Result SRemSync (const string &key, const StringList &members, int64_t *out)
 
void StrLen (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result StrLenSync (const string &key, int64_t *out)
 
void Subscribe (const string &channel, const SubCallback &callback)
 
void Subscribe (const std::vector< string > &channels, const SubCallback &callback)
 
void SUnion (const StringList &keys, const StringListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void SUnionStore (const string &destination, const StringList &keys, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result SUnionStoreSync (const string &destination, const StringList &keys, int64_t *out)
 
Result SUnionSync (const StringList &keys, StringList *out)
 
void TTL (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result TTLSync (const string &key, int64_t *out)
 
void Unsubscribe ()
 
void Unsubscribe (const string &channel)
 
void Unsubscribe (const std::vector< string > &channels)
 
void ZAdd (const string &key, double score, const string &member, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void ZAdd (const string &key, const StringDoublePairList &score_members, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZAddSync (const string &key, double score, const string &member, int64_t *out)
 
Result ZAddSync (const string &key, const StringDoublePairList &score_members, int64_t *out)
 
void ZCard (const string &key, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 For redis commands 'Sorted Set' section.
 
Result ZCardSync (const string &key, int64_t *out)
 
void ZCount (const string &key, const string &min, const string &max, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZCountSync (const string &key, const string &min, const string &max, int64_t *out)
 
void ZIncrBy (const string &key, double increment, const string &member, const DoubleCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZIncrBySync (const string &key, double increment, const string &member, double *out)
 
void ZRange (const string &key, int64_t start, int64_t stop, bool with_scores, const StringDoublePairListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void ZRangeByScore (const string &key, const string &min, const string &max, bool with_scores, const StringDoublePairListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void ZRangeByScore (const string &key, const string &min, const string &max, bool with_scores, uint64_t offset, uint64_t count, const StringDoublePairListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZRangeByScoreSync (const string &key, const string &min, const string &max, bool with_scores, StringDoublePairList *out)
 
Result ZRangeByScoreSync (const string &key, const string &min, const string &max, bool with_scores, uint64_t offset, uint64_t count, StringDoublePairList *out)
 
Result ZRangeSync (const string &key, int64_t start, int64_t stop, bool with_scores, StringDoublePairList *out)
 
void ZRank (const string &key, const string &member, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZRankSync (const string &key, const string &member, int64_t *out)
 
void ZRem (const string &key, const string &member, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void ZRem (const string &key, const StringList &members, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void ZRemRangeByRank (const string &key, int64_t start, int64_t stop, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZRemRangeByRankSync (const string &key, int64_t start, int64_t stop, int64_t *out)
 
void ZRemRangeByScore (const string &key, const string &min, const string &max, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZRemRangeByScoreSync (const string &key, const string &min, const string &max, int64_t *out)
 
Result ZRemSync (const string &key, const string &member, int64_t *out)
 
Result ZRemSync (const string &key, const StringList &members, int64_t *out)
 
void ZRevRange (const string &key, int64_t start, int64_t stop, bool with_scores, const StringDoublePairListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void ZRevRangeByScore (const string &key, const string &max, const string &min, bool with_scores, const StringDoublePairListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
void ZRevRangeByScore (const string &key, const string &max, const string &min, bool with_scores, uint64_t offset, uint64_t count, const StringDoublePairListCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZRevRangeByScoreSync (const string &key, const string &max, const string &min, bool with_scores, StringDoublePairList *out)
 
Result ZRevRangeByScoreSync (const string &key, const string &max, const string &min, bool with_scores, uint64_t offset, uint64_t count, StringDoublePairList *out)
 
Result ZRevRangeSync (const string &key, int64_t start, int64_t stop, bool with_scores, StringDoublePairList *out)
 
void ZRevRank (const string &key, const string &member, const IntegerCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZRevRankSync (const string &key, const string &member, int64_t *out)
 
void ZScore (const string &key, const string &member, const DoubleCallback &callback, const SerializationTag &tag=kDefaultSerializationTag)
 
Result ZScoreSync (const string &key, const string &member, double *out)
 

Static Public Member Functions

static Ptr< RedisClientCreate (const string &server_ip, int server_port, const string &auth_pass, size_t connection_count, bool invoke_as_event=true, size_t database=0)
 

Static Public Attributes

static const SerializationTag kDefaultSerializationTag