iFun Engine API  1.0.0-b6053
Great Technology for Great Games
Classes | Public Types | Static Public Member Functions | List of all members
fun::Redis Class Reference

Classes

struct  Response
 

Public Types

enum  CommandOption {
  kNone = -100, kEX = 0, kPX = 1, kNX = 2,
  kXX = 3
}
 
typedef boost::function< void(const Result &result, const bool &value, const int64_t &value2)> OnBoolIntReturned
 
typedef boost::function< void(const Result &result, const bool &value)> OnBoolReturned
 
typedef boost::function< void(const Result &result, const double &value)> OnDoubleReturned
 
typedef boost::function< void(const Result &result, const int64_t &value)> OnIntReturned
 
typedef boost::function< void(const std::vector< std::pair< Result, double > > &values)> OnMultipleDoubleReturned
 
typedef boost::function< void(const Result &result)> OnNonReturned
 for redis command functions
 
typedef boost::function< void(const string &pattern, const string &channel, const string &message)> OnPSubCallback
 
typedef boost::function< void(const Ptr< Response > &response)> OnResponseReturned
 Callbacks for redis async commands for CommandAsync function.
 
typedef boost::function< void(const string &master_name, const string &old_master_address, const string &new_master_address)> OnSentinelMasterSwitched
 for Redis Sentinel
 
typedef boost::function< void(const Result &result, const size_t &value)> OnSizeReturned
 
typedef boost::function< void(const Result &result, const StrDoublePairList)> OnStrDoublePairListReturned
 
typedef boost::function< void(const Result &result, const string &value)> OnStringReturned
 
typedef boost::function< void(const Result &result, const StrList &values)> OnStrListReturned
 
typedef boost::function< void(const Result &result, const StrPairList &str_pairs)> OnStrPairListReturned
 
typedef boost::function< void(const string &channel, const string &message)> OnSubCallback
 for (p)subscribe redis commands
 
enum  Result { kResultError = 0, kResultSuccess = 1, kResultNil = 2, kResultDisconnected = 3 }
 
typedef std::pair< string, double > StrDoublePair
 
typedef std::vector< StrDoublePair > StrDoublePairList
 
typedef std::vector< stringStrList
 
typedef std::pair< string, stringStrPair
 
typedef std::vector< StrPair > StrPairList
 

Static Public Member Functions

static Result Append (const string &key, const string &value, const string &tag="")
 For redis commands 'Strings' section.
 
static void AppendAsync (const string &key, const string &value, const OnNonReturned &callback, const string &tag="")
 
static Result BitCount (const string &key, size_t *count, const string &tag="")
 
static Result BitCount (const string &key, const int64_t &start, const int64_t &end, size_t *count, const string &tag="")
 
static void BitCountAsync (const string &key, const OnSizeReturned &callback, const string &tag="")
 
static void BitCountAsync (const string &key, const int64_t &start, const int64_t &end, const OnSizeReturned &callback, const string &tag="")
 
static Result BitOp (const string &operation, const string &dest_key, const StrList &keys, size_t *dest_key_size, const string &tag="")
 
static void BitOpAsync (const string &operation, const string &dest_key, const StrList &keys, const OnSizeReturned &callback, const string &tag="")
 
static Result Decr (const string &key, int64_t *decreased, const string &tag="")
 
static void DecrAsync (const string &key, const OnIntReturned &callback, const string &tag="")
 
static Result DecrBy (const string &key, const int64_t &decrement, int64_t *decreased, const string &tag="")
 
static void DecrByAsync (const string &key, const int64_t &decrement, const OnIntReturned &callback, const string &tag="")
 
static Result Del (const string &key, size_t *del_count, const string &tag="")
 For redis commands 'Keys' section.
 
static Result Del (const StrList &keys, size_t *del_count, const string &tag="")
 
static void DelAsync (const string &key, const OnSizeReturned &callback, const string &tag="")
 
static void DelAsync (const StrList &keys, const OnSizeReturned &callback, const string &tag="")
 
static Result Discard (const string &tag="")
 
static Ptr< ResponseExec (const string &tag="")
 
static Ptr< ResponseExecuteCommand (const string &command_name, const std::vector< string > *arguments, const string &tag="")
 
static void ExecuteCommandAsync (const string &command_name, const std::vector< string > *arguments, const OnResponseReturned &callback, const string &tag="")
 
static Result Exists (const string &key, bool *exists, const string &tag="")
 
static void ExistsAsync (const string &key, const OnBoolReturned &callback, const string &tag="")
 
static Result Expire (const string &key, const size_t &seconds, bool *is_set, const string &tag="")
 
static void ExpireAsync (const string &key, const size_t &seconds, const OnBoolReturned &callback, const string &tag="")
 
static Result Get (const string &key, string *value, const string &tag="")
 
static void GetAsync (const string &key, const OnStringReturned &callback, const string &tag="")
 
static Result GetBit (const string &key, const size_t &offset, bool *bit, const string &tag="")
 
static void GetBitAsync (const string &key, const size_t &offset, const OnBoolReturned &callback, const string &tag="")
 
static Result GetRange (const string &key, const int64_t &start, const int64_t &end, string *value, const string &tag="")
 
static void GetRangeAsync (const string &key, const int64_t &start, const int64_t &end, const OnStringReturned &callback, const string &tag="")
 
static Result GetSet (const string &key, const string &new_value, string *old_value, const string &tag="")
 
static void GetSetAsync (const string &key, const string &new_value, const OnStringReturned &callback, const string &tag="")
 
static Result HDel (const string &key, const string &field, size_t *del_count, const string &tag="")
 
static Result HDel (const string &key, const StrList &fields, size_t *del_count, const string &tag="")
 
static void HDelAsync (const string &key, const string &field, const OnSizeReturned &callback, const string &tag="")
 
static void HDelAsync (const string &key, const StrList &fields, const OnSizeReturned &callback, const string &tag="")
 
static Result HExists (const string &key, const string &field, bool *exists, const string &tag="")
 For redis commands 'Hashes' section.
 
static void HExistsAsync (const string &key, const string &field, const OnBoolReturned &callback, const string &tag="")
 
static Result HGet (const string &key, const string &field, string *value, const string &tag="")
 
static Result HGetAll (const string &key, StrPairList *field_values, const string &tag="")
 
static void HGetAllAsync (const string &key, const OnStrPairListReturned &callback, const string &tag="")
 
static void HGetAsync (const string &key, const string &field, const OnStringReturned &callback, const string &tag="")
 
static Result HIncrBy (const string &key, const string &field, const int64_t &increment, int64_t *increased, const string &tag="")
 
static void HIncrByAsync (const string &key, const string &field, const int64_t &increment, const OnIntReturned &callback, const string &tag="")
 
static Result HIncrByFloat (const string &key, const string &field, const double &increment, double *increased, const string &tag="")
 
static void HIncrByFloatAsync (const string &key, const string &field, const double &increment, const OnDoubleReturned &callback, const string &tag="")
 
static Result HKeys (const string &key, StrList *fields, const string &tag="")
 
static void HKeysAsync (const string &key, const OnStrListReturned &callback, const string &tag="")
 
static Result HLen (const string &key, size_t *field_count, const string &tag="")
 
static void HLenAsync (const string &key, const OnSizeReturned &callback, const string &tag="")
 
static Result HMGet (const string &key, const StrList &fields, StrList *values, const string &tag="")
 
static void HMGetAsync (const string &key, const StrList &fields, const OnStrListReturned &callback, const string &tag="")
 
static Result HMSet (const string &key, const StrPairList &field_values, const string &tag="")
 
static void HMSetAsync (const string &key, const StrPairList &field_values, const OnNonReturned &callback, const string &tag="")
 
static Result HSet (const string &key, const string &field, const string &value, const string &tag="")
 
static void HSetAsync (const string &key, const string &field, const string &value, const OnNonReturned &callback, const string &tag="")
 
static Result HSetNx (const string &key, const string &field, const string &value, bool *already_exists, const string &tag="")
 
static void HSetNxAsync (const string &key, const string &field, const string &value, const OnBoolReturned &callback, const string &tag="")
 
static Result HVals (const string &key, StrList *values, const string &tag="")
 
static void HValsAsync (const string &key, const OnStrListReturned &callback, const string &tag="")
 
static Result Incr (const string &key, int64_t *increased, const string &tag="")
 
static void IncrAsync (const string &key, const OnIntReturned &callback, const string &tag="")
 
static Result IncrBy (const string &key, const int64_t &increment, int64_t *increased, const string &tag="")
 
static void IncrByAsync (const string &key, const int64_t &increment, const OnIntReturned &callback, const string &tag="")
 
static Result IncrByFloat (const string &key, const double &increment, double *increased, const string &tag="")
 
static void IncrByFloatAsync (const string &key, const double &increment, const OnDoubleReturned &callback, const string &tag="")
 
static Result LIndex (const string &key, const int64_t &index, string *value, const string &tag="")
 
static void LIndexAsync (const string &key, const int64_t &index, const OnStringReturned &callback, const string &tag="")
 
static Result LInsert (const string &key, const bool &before, const string &pivot, const string &value, bool *key_or_pivot_not_found, int64_t *total_length, const string &tag="")
 
static void LInsertAsync (const string &key, const bool &before, const string &pivot, const string &value, const OnBoolIntReturned &callback, const string &tag="")
 
static Result LLen (const string &key, size_t *length, const string &tag="")
 For redis commands 'Lists' section.
 
static void LLenAsync (const string &key, const OnSizeReturned &callback, const string &tag="")
 
static Result LPop (const string &key, string *value, const string &tag="")
 
static void LPopAsync (const string &key, const OnStringReturned &callback, const string &tag="")
 
static Result LPush (const string &key, const string &value, size_t *total_length, const string &tag="")
 
static Result LPush (const string &key, const StrList &values, size_t *total_length, const string &tag="")
 
static void LPushAsync (const string &key, const string &value, const OnSizeReturned &callback, const string &tag="")
 
static void LPushAsync (const string &key, const StrList &values, const OnSizeReturned &callback, const string &tag="")
 
static Result LRange (const string &key, const int64_t &start, const int64_t &stop, StrList *values, const string &tag="")
 
static void LRangeAsync (const string &key, const int64_t &start, const int64_t &stop, const OnStrListReturned &callback, const string &tag="")
 
static Result LRem (const string &key, const int64_t &count, const string &value, size_t *rem_count, const string &tag="")
 
static void LRemAsync (const string &key, const int64_t &count, const string &value, const OnSizeReturned &callback, const string &tag="")
 
static Result LSet (const string &key, const int64_t &index, const string &value, const string &tag="")
 
static void LSetAsync (const string &key, const int64_t &index, const string &value, const OnNonReturned &callback, const string &tag="")
 
static Result LTrim (const string &key, const int64_t &start, const int64_t &stop, const string &tag="")
 
static void LTrimAsync (const string &key, const int64_t &start, const int64_t &stop, const OnNonReturned &callback, const string &tag="")
 
static Result MGet (const StrList &keys, StrList *values, const string &tag="")
 
static void MGetAsync (const StrList &keys, const OnStrListReturned &callback, const string &tag="")
 
static Result MSet (const StrPairList &key_values, const string &tag="")
 
static void MSetAsync (const StrPairList &key_values, const OnNonReturned &callback, const string &tag="")
 
static Result MSetNx (const StrPairList &key_values, bool *already_exists, const string &tag="")
 
static void MSetNxAsync (const StrPairList &key_values, const OnBoolReturned &callback, const string &tag="")
 
static Result Multi (const string &tag="")
 For redis commands 'Transaction' section.
 
static Result Persist (const string &key, bool *is_removed, const string &tag="")
 
static void PersistAsync (const string &key, const OnBoolReturned &callback, const string &tag="")
 
static Result PExpire (const string &key, const size_t &milliseconds, bool *is_set, const string &tag="")
 
static void PExpireAsync (const string &key, const size_t &milliseconds, const OnBoolReturned &callback, const string &tag="")
 
static Result PSetEx (const string &key, const int64_t &milliseconds, const string &value, const string &tag="")
 
static void PSetExAsync (const string &key, const int64_t &milliseconds, const string &value, const OnNonReturned &callback, const string &tag="")
 
static void PSubscribeAsync (const string &pattern, const OnPSubCallback &callback, const string &tag="")
 
static void PSubscribeAsync (const StrList &patterns, const OnPSubCallback &callback, const string &tag="")
 
static Result PTTL (const string &key, int64_t *remaining_ttl, const string &tag="")
 
static void PTTLAsync (const string &key, const OnIntReturned &callback, const string &tag="")
 
static Result Publish (const string &channel, const string &message, size_t *received_client_count, const string &tag="")
 For redis commands 'Pub/Sub' section.
 
static void PublishAsync (const string &channel, const string &message, const OnSizeReturned &callback, const string &tag="")
 
static Result PUnsubscribe (const string &tag="")
 
static Result PUnsubscribe (const string &pattern, const string &tag="")
 
static Result PUnsubscribe (const StrList &patterns, const string &tag="")
 
static void PUnsubscribeAsync (const OnNonReturned &callback, const string &tag="")
 
static void PUnsubscribeAsync (const string &pattern, const OnNonReturned &callback, const string &tag="")
 
static void PUnsubscribeAsync (const StrList &patterns, const OnNonReturned &callback, const string &tag="")
 
static Result Rename (const string &key, const string &new_key, const string &tag="")
 
static void RenameAsync (const string &key, const string &new_key, const OnNonReturned &callback, const string &tag="")
 
static Result RPop (const string &key, string *value, const string &tag="")
 
static void RPopAsync (const string &key, const OnStringReturned &callback, const string &tag="")
 
static Result RPush (const string &key, const string &value, size_t *total_length, const string &tag="")
 
static Result RPush (const string &key, const StrList &values, size_t *total_length, const string &tag="")
 
static void RPushAsync (const string &key, const string &value, const OnSizeReturned &callback, const string &tag="")
 
static void RPushAsync (const string &key, const StrList &values, const OnSizeReturned &callback, const string &tag="")
 
static Result SAdd (const string &key, const string &member, size_t *add_count, const string &tag="")
 
static Result SAdd (const string &key, const StrList &members, size_t *add_count, const string &tag="")
 
static void SAddAsync (const string &key, const string &member, const OnSizeReturned &callback, const string &tag="")
 
static void SAddAsync (const string &key, const StrList &members, const OnSizeReturned &callback, const string &tag="")
 
static Result Scan (const string &cursor, const string &pattern, StrList *values, const string &tag="")
 
static void ScanAsync (const string &cursor, const string &pattern, const OnStrListReturned &callback, const string &tag="")
 
static Result SCard (const string &key, size_t *cardinality, const string &tag="")
 For redis commands 'Sets' section.
 
static void SCardAsync (const string &key, const OnSizeReturned &callback, const string &tag="")
 
static Result SDiff (const StrList &keys, StrList *members, const string &tag="")
 
static void SDiffAsync (const StrList &keys, const OnStrListReturned &callback, const string &tag="")
 
static Result SDiffStore (const string &destination, const StrList &keys, size_t *destination_size, const string &tag="")
 
static void SDiffStoreAsync (const string &destination, const StrList &keys, const OnSizeReturned &callback, const string &tag="")
 
static Result Set (const string &key, const string &value, const string &tag="")
 
static Result Set (const string &key, const string &value, const CommandOption ex_or_px, const size_t time, const CommandOption nx_or_xx, const string &tag="")
 
static void SetAsync (const string &key, const string &value, const OnNonReturned &callback, const string &tag="")
 
static void SetAsync (const string &key, const string &value, const CommandOption ex_or_px, const size_t time, const CommandOption nx_or_xx, const OnNonReturned &callback, const string &tag="")
 
static Result SetBit (const string &key, const size_t &offset, const bool &new_value, bool *old_value, const string &tag="")
 
static void SetBitAsync (const string &key, const size_t &offset, const bool &new_value, const OnBoolReturned &callback, const string &tag="")
 
static Result SetEx (const string &key, const int64_t &seconds, const string &value, const string &tag="")
 
static void SetExAsync (const string &key, const int64_t &seconds, const string &value, const OnNonReturned &callback, const string &tag="")
 
static Result SetNx (const string &key, const string &value, bool *already_exists, const string &tag="")
 
static void SetNxAsync (const string &key, const string &value, const OnBoolReturned &callback, const string &tag="")
 
static Result SInter (const StrList &keys, StrList *members, const string &tag="")
 
static void SInterAsync (const StrList &keys, const OnStrListReturned &callback, const string &tag="")
 
static Result SInterStore (const string &destination, const StrList &keys, size_t *destination_size, const string &tag="")
 
static void SInterStoreAsync (const string &destination, const StrList &keys, const OnSizeReturned &callback, const string &tag="")
 
static Result SIsMember (const string &key, const string &member, bool *is_member, const string &tag="")
 
static void SIsMemberAsync (const string &key, const string &member, const OnBoolReturned &callback, const string &tag="")
 
static Result SMembers (const string &key, StrList *members, const string &tag="")
 
static void SMembersAsync (const string &key, const OnStrListReturned &callback, const string &tag="")
 
static Result SMove (const string &source, const string &destination, const string &member, bool *is_moved, const string &tag="")
 
static void SMoveAsync (const string &source, const string &destination, const string &member, const OnBoolReturned &callback, const string &tag="")
 
static Result SPop (const string &key, string *member, const string &tag="")
 
static void SPopAsync (const string &key, const OnStringReturned &callback, const string &tag="")
 
static Result SRandMember (const string &key, string *member, const string &tag="")
 
static Result SRandMember (const string &key, const int64_t &count, StrList *members, const string &tag="")
 
static void SRandMemberAsync (const string &key, const OnStringReturned &callback, const string &tag="")
 
static void SRandMemberAsync (const string &key, const int64_t &count, const OnStrListReturned &callback, const string &tag="")
 
static Result SRem (const string &key, const string &member, size_t *rem_count, const string &tag="")
 
static Result SRem (const string &key, const StrList &members, size_t *rem_count, const string &tag="")
 
static void SRemAsync (const string &key, const string &member, const OnSizeReturned &callback, const string &tag="")
 
static void SRemAsync (const string &key, const StrList &members, const OnSizeReturned &callback, const string &tag="")
 
static Result StrLen (const string &key, size_t *length, const string &tag="")
 
static void StrLenAsync (const string &key, const OnSizeReturned &callback, const string &tag="")
 
static void SubscribeAsync (const string &channel, const OnSubCallback &callback, const string &tag="")
 
static void SubscribeAsync (const StrList &channels, const OnSubCallback &callback, const string &tag="")
 
static void SubscribeSentinelSwitchMasterChannelAsync (const OnSentinelMasterSwitched &cb, const string &tag="")
 For redis sentinel section.
 
static Result SUnion (const StrList &keys, StrList *members, const string &tag="")
 
static void SUnionAsync (const StrList &keys, const OnStrListReturned &callback, const string &tag="")
 
static Result SUnionStore (const string &destination, const StrList &keys, size_t *destination_size, const string &tag="")
 
static void SUnionStoreAsync (const string &destination, const StrList &keys, const OnSizeReturned &callback, const string &tag="")
 
static Result TTL (const string &key, int64_t *remaining_ttl, const string &tag="")
 
static void TTLAsync (const string &key, const OnIntReturned &callback, const string &tag="")
 
static Result Unsubscribe (const string &tag="")
 
static Result Unsubscribe (const string &channel, const string &tag="")
 
static Result Unsubscribe (const StrList &channels, const string &tag="")
 
static void UnsubscribeAsync (const OnNonReturned &callback, const string &tag="")
 
static void UnsubscribeAsync (const string &channel, const OnNonReturned &callback, const string &tag="")
 
static void UnsubscribeAsync (const StrList &channels, const OnNonReturned &callback, const string &tag="")
 
static Result ZAdd (const string &key, const double &score, const string &member, const string &tag="")
 
static void ZAddAsync (const string &key, const double &score, const string &member, const OnNonReturned &callback, const string &tag="")
 
static Result ZCard (const string &key, size_t *cardinality, const string &tag="")
 For redis commands 'Sorted Set' section.
 
static void ZCardAsync (const string &key, const OnSizeReturned &callback, const string &tag="")
 
static Result ZCount (const string &key, const string &min, const string &max, size_t *count, const string &tag="")
 
static void ZCountAsync (const string &key, const string &min, const string &max, const OnSizeReturned &callback, const string &tag="")
 
static Result ZIncrBy (const string &key, const double &increment, const string &member, double *new_score, const string &tag="")
 
static void ZIncrByAsync (const string &key, const double &increment, const string &member, const OnDoubleReturned &callback, const string &tag="")
 
static Result ZRem (const string &key, const string &member, size_t *del_count, const string &tag="")
 
static Result ZRem (const string &key, const StrList &members, size_t *del_count, const string &tag="")
 
static void ZRemAsync (const string &key, const string &member, const OnSizeReturned &callback, const string &tag="")
 
static void ZRemAsync (const string &key, const StrList &members, const OnSizeReturned &callback, const string &tag="")
 
static Result ZRevRange (const string &key, const int64_t &start, const int64_t &stop, const bool &withscores, StrDoublePairList *member_scores, const string &tag="")
 
static void ZRevRangeAsync (const string &key, const int64_t &start, const int64_t &stop, const bool &withscores, const OnStrDoublePairListReturned &callback, const string &tag="")
 
static Result ZRevRank (const string &key, const string &member, size_t *rank, const string &tag="")
 
static void ZRevRankAsync (const string &key, const string &member, const OnSizeReturned &callback, const string &tag="")
 
static Result ZScore (const string &key, const string &member, double *score, const string &tag="")
 
static void ZScoreAsync (const string &key, const string &member, const OnDoubleReturned &callback, const string &tag="")
 
static void ZScoreExtAsync (const string &key, const StrList &members, const OnMultipleDoubleReturned &callback, const string &tag="")