After learning the basic opreation of Redis,we should take some time to summarize the usage.

And I wrote my first edition RedisHelper.Here is the code:

  The Interface IRedis:

     public interface IRedis
{
ITransaction GetTransaction(int db = , bool isRead = false); #region String
#region get
/// <summary>
/// get the string value
/// </summary>
/// <param name="key">the key of value</param>
/// <param name="flag">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
RedisValue Get(string key, CommandFlags flag = CommandFlags.None, int db = );
/// <summary>
/// get the string value(Asynchronous)
/// </summary>
/// <param name="key">the key of value</param>
/// <param name="flag">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue> GetAsync(string key, CommandFlags flag = CommandFlags.None, int db = );
/// <summary>
/// get the entity by deserialization
/// </summary>
/// <param name="key">the key of value</param>
/// <param name="flag">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
T Get<T>(string key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the entity by deserialization(Asynchronous)
/// </summary>
/// <param name="key">the key of value</param>
/// <param name="flag">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<T> GetAsync<T>(string key, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region set
/// <summary>
/// set value to key
/// </summary>
/// <param name="key">the key</param>
/// <param name="value">the value of the key</param>
/// <param name="expiry">time to expiry</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
RedisValue Set(string key, string value, TimeSpan? expiry = default(TimeSpan?), When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// set value to key(Asynchronous)
/// </summary>
/// <param name="key">the key</param>
/// <param name="value">the value of the key</param>
/// <param name="expiry">time to expiry</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> SetAsync(string key, string value, TimeSpan? expiry = default(TimeSpan?), When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region mget
/// <summary>
/// get multi values
/// </summary>
/// <param name="keys">the keys of the values</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> MGet(List<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get multi values(Asynchronous)
/// </summary>
/// <param name="keys">the keys of the values</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> MGetAsync(List<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region mset
/// <summary>
/// set multi values
/// </summary>
/// <param name="kvs">key-values</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool MSet(List<KeyValuePair<RedisKey, RedisValue>> kvs, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// set multi values(Asynchronous)
/// </summary>
/// <param name="kvs">key-values</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> MSetAsync(List<KeyValuePair<RedisKey, RedisValue>> kvs, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region incr incrby incrbyfloat decr decrby
/// <summary>
/// handle the numeric value
/// </summary>
/// <param name="key">key</param>
/// <param name="amount">value to increase or decrease</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
double IncrOrDecrBy(RedisKey key, double value, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// handle the numeric value(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="amount">value to increase or decrease</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<double> IncrOrDecrByAsync(RedisKey key, double value, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region append
/// <summary>
/// append value to the key
/// </summary>
/// <param name="key">key</param>
/// <param name="value">value to append</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long Append(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// append value to the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="value">value to append</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> AppendAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region strlen
/// <summary>
/// get the value's length by the key
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long StrLen(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the value's length by the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> StrLenAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
#endregion
#endregion #region Hash
#region hget
/// <summary>
/// get the value of key's field
/// </summary>
/// <param name="key">key</param>
/// <param name="field">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue> HGetAsync(RedisKey key, RedisValue field, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the value of key's field(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="field">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
RedisValue HGet(RedisKey key, RedisValue field, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region hset
/// <summary>
/// set the field and value of the key
/// </summary>
/// <param name="key">key</param>
/// <param name="field">field of the key</param>
/// <param name="value">value of the field</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool HSet(RedisKey key, RedisValue field, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// set the field and value of the key
/// </summary>
/// <param name="key">key</param>
/// <param name="field">field of the key</param>
/// <param name="value">value of the field</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> HSetAsync(RedisKey key, RedisValue field, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region hmget
/// <summary>
/// get multi values of key's fields
/// </summary>
/// <param name="key">key</param>
/// <param name="fields">fields of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> HMGet(RedisKey key, List<RedisValue> fields, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get multi values of key's fields(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="fields">fields of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> HMGetAsync(RedisKey key, List<RedisValue> fields, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region hmset
/// <summary>
/// set multi values of key's fields
/// </summary>
/// <param name="key">key</param>
/// <param name="entry">name/value pair</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
void HMSet(RedisKey key, List<HashEntry> entry, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// set multi values of key's fields(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="entry">name/value pair</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
Task HMSetAsync(RedisKey key, List<HashEntry> entry, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region hkeys
/// <summary>
/// get all the fields of the key
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> HKeys(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get all the fields of the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> HKeysAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region hvals
/// <summary>
/// get all the values of key's fields
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> HVals(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get all the values of key's fields(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> HValsAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region hincr hincrby hincrbyfloat
/// <summary>
/// handle the numeric value
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="amount">value to increase or decrease</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
double HIncrOrDecrBy(RedisKey key, RedisValue hashField, double amount = , CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// handle the numeric value(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="amount">value to increase or decrease</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<double> HIncrOrDecrByAsync(RedisKey key, RedisValue hashField, double amount = , CommandFlags flags = CommandFlags.None, int db = );
#endregion #region hexists
/// <summary>
/// whether a field exists in the key
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool HExists(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// whether a field exists in the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> HExistsAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region hdel
/// <summary>
/// delete the field from the key
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool HDel(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// delete the field from the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> HDelAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// delete fields from the key
/// </summary>
/// <param name="key">key</param>
/// <param name="hashFields">fields of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long HDel(RedisKey key, IList<RedisValue> hashFields, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// delete fields from the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="hashFields">fields of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> HDelAsync(RedisKey key, IList<RedisValue> hashFields, CommandFlags flags = CommandFlags.None, int db = );
#endregion
#endregion #region List #region lpush
/// <summary>
/// insert the value to the head of list
/// </summary>
/// <param name="key">key</param>
/// <param name="value">node's value</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long LPush(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// insert the value to the head of list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="value">node's value</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> LPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region rpush
/// <summary>
/// insert the value to the tail of list
/// </summary>
/// <param name="key">key</param>
/// <param name="value">node's value</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long RPush(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// insert the value to the tail of list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="value">node's value</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> RPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region lpop
/// <summary>
/// removes the first element of the list
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
RedisValue LPop(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// removes the first element of the list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue> LPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region lrem
/// <summary>
/// removes the first count occurrences of elements equal to value from the list
/// </summary>
/// <param name="key">key</param>
/// <param name="value">value</param>
/// <param name="count">amount of the node's value equal to the value</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long LRem(RedisKey key, RedisValue value, long count = , CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// removes the first count occurrences of elements equal to value from the list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="value">value</param>
/// <param name="count">amount of the node's value equal to the value</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> LRemAsync(RedisKey key, RedisValue value, long count = , CommandFlags flags = CommandFlags.None, int db = );
#endregion #region lrange
/// <summary>
/// get the specified elements of the list stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="start">start index</param>
/// <param name="stop">stop index</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> LRange(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the specified elements of the list stored at key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="start">start index</param>
/// <param name="stop">stop index</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> LRangeAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region llen
/// <summary>
/// get the length of the list
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long LLen(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the length of the list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> LLenAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
#endregion /// <summary>
/// get the element at index index in the list
/// </summary>
/// <param name="key">key</param>
/// <param name="index">index</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
RedisValue LIndex(RedisKey key, long index, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the element at index index in the list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="index">index</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue> LIndexAsync(RedisKey key, long index, CommandFlags flags = CommandFlags.None, int db = ); #region LInsert
/// <summary>
/// inserts value in the list stored at key either before or after the reference value pivot.
/// </summary>
/// <param name="key"></param>
/// <param name="pivot"></param>
/// <param name="value"></param>
/// <param name="flags"></param>
/// <param name="isAfter"></param>
/// <param name="db"></param>
/// <returns></returns>
long LInsert(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None, bool isAfter = false, int db = );
/// <summary>
/// inserts value in the list stored at key either before or after the reference value pivot.
/// </summary>
/// <param name="key"></param>
/// <param name="pivot"></param>
/// <param name="value"></param>
/// <param name="flags"></param>
/// <param name="isAfter"></param>
/// <param name="db"></param>
/// <returns></returns>
Task<long> LInsertAsync(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None, bool isAfter = false, int db = );
#endregion #endregion #region Set
#region sadd
/// <summary>
/// add a member to a set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="value">value of the key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool SAdd(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// add a member to a set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="value">value of the key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> SAddAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// add multi members to a set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="values">values of the key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long SAdd(RedisKey key, IList<RedisValue> values, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// add multi members to a set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="values">values of the key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> SAddAsync(RedisKey key, IList<RedisValue> values, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region sismember
/// <summary>
/// whether member is a member of the set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="value">value</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool SIsMember(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// whether member is a member of the set (Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="value">value</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> SIsMemberAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region smembers
/// <summary>
/// get all the members of the set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> SMembers(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get all the members of the set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> SMembersAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region spop
/// <summary>
/// Removes a random elements from the set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
RedisValue SPop(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Removes a random elements from the set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue> SPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region srem
/// <summary>
/// Remove the specified members from the set
/// </summary>
/// <param name="key">key of the set</param>
/// <param name="value">member to remove</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool SRem(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Remove the specified members from the set(Asynchronous)
/// </summary>
/// <param name="key">key of the set</param>
/// <param name="value">member to remove</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> SRemAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Remove the specified members from the set
/// </summary>
/// <param name="key">key of the set</param>
/// <param name="value">member to remove</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long SRem(RedisKey key, IList<RedisValue> values, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Remove the specified members from the set(Asynchronous)
/// </summary>
/// <param name="key">key of the set</param>
/// <param name="value">member to remove</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> SRemAsync(RedisKey key, IList<RedisValue> values, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region scard
/// <summary>
/// get the number of elements in the set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long SCard(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the number of elements in the set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> SCardAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region sinter
/// <summary>
/// get the members of the set resulting from the intersection of all the given sets.
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> SInter(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the members of the set resulting from the intersection of all the given sets.(Asynchronous)
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> SInterAsync(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region sdiff
/// <summary>
/// get the members of the set resulting from the difference between the first set and all the successive sets.
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> SDiff(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the members of the set resulting from the difference between the first set and all the successive sets.(Asynchronous)
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> SDiffAsync(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region sunion
/// <summary>
/// get the members of the set resulting from the union of all the given sets.
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
IList<RedisValue> SUnion(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// get the members of the set resulting from the union of all the given sets.(Asynchronous)
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<RedisValue[]> SUnionAsync(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = );
#endregion
#endregion #region SortedSet
#region zadd
/// <summary>
/// Adds a member with the score to the sorted set stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="member">member</param>
/// <param name="score">score</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool ZAdd(RedisKey key, RedisValue member, double score, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Adds a member with the score to the sorted set stored at key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="member">member</param>
/// <param name="score">score</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> ZAddAsync(RedisKey key, RedisValue member, double score, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Adds members with scores to the sorted set stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="values">sortedset entity</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long ZAdd(RedisKey key, IList<SortedSetEntry> values, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Adds members with scores to the sorted set stored at key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="values">sortedset entity</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> ZAddAsync(RedisKey key, IList<SortedSetEntry> values, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region zrem
/// <summary>
/// Removes a member from the sorted set stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="member">member</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
bool ZRem(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Removes a member from the sorted set stored at key(Async)
/// </summary>
/// <param name="key">key</param>
/// <param name="member">member</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<bool> ZRemAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Removes members from the sorted set stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="members">members</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
long ZRem(RedisKey key, IList<RedisValue> members, CommandFlags flags = CommandFlags.None, int db = );
/// <summary>
/// Removes members from the sorted set stored at key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="members">members</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
Task<long> ZRemAsync(RedisKey key, IList<RedisValue> members, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region zrange
IList<RedisValue> ZRange(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = ); Task<RedisValue[]> ZRangeAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region zrevrange
IList<RedisValue> ZRevRange(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = ); Task<RedisValue[]> ZRevRangeAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = );
#endregion #region zincrby
double ZIncrby(RedisKey key, RedisValue member, double value = , CommandFlags flags = CommandFlags.None, int db = ); Task<double> ZIncrbyAsync(RedisKey key, RedisValue member, double value = , CommandFlags flags = CommandFlags.None, int db = );
#endregion
#endregion #region pub/sub
void Subscribe(RedisChannel channel, Action<RedisChannel, RedisValue> handle, CommandFlags flags = CommandFlags.None, bool isRead = false); long Publish(RedisChannel channel, RedisValue value, CommandFlags flags = CommandFlags.None, bool isRead = false); void UnSubscrribe(RedisChannel channel, Action<RedisChannel, RedisValue> handle, CommandFlags flags = CommandFlags.None, bool isRead = false);
#endregion
}

  The Implementation are as follow:

 using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks; namespace Redis01
{
public class RedisHelper : IRedis
{
private static IConfigurationRoot GetConnStr()
{
var builder = new ConfigurationBuilder();
builder.SetBasePath(Directory.GetCurrentDirectory());
builder.AddJsonFile("appsettings.json");
var config = builder.Build();
return config;
} private Lazy<ConnectionMultiplexer> _writeConn = new Lazy<ConnectionMultiplexer>(() =>
{
return ConnectionMultiplexer.Connect(GetConnStr().GetValue<string>("RedisConfig:MasterServer"));
}); private Lazy<ConnectionMultiplexer> _readConn = new Lazy<ConnectionMultiplexer>(() =>
{
return ConnectionMultiplexer.Connect(GetConnStr().GetValue<string>("RedisConfig:SlaveServer"));
}); public ConnectionMultiplexer WriteConn
{
get { return _writeConn.Value; }
} public ConnectionMultiplexer ReadConn
{
get { return _readConn.Value; }
} private IDatabase GetDatabase(int db = , bool isRead = false)
{
return isRead ?
ReadConn.GetDatabase(db) :
WriteConn.GetDatabase(db);
} private ISubscriber GetSubscriber(bool isRead = false, object asyncState = null)
{
return isRead ?
ReadConn.GetSubscriber(asyncState) :
WriteConn.GetSubscriber(asyncState);
} public ITransaction GetTransaction(int db = , bool isRead = false)
{
return GetDatabase(db).CreateTransaction();
} #region string
/// <summary>
/// get the string value
/// </summary>
/// <param name="key">the key of value</param>
/// <param name="flag">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public RedisValue Get(string key, CommandFlags flag = CommandFlags.None, int db = )
{
return GetDatabase(db, true).StringGet(key, flag);
}
/// <summary>
/// get the string value(Asynchronous)
/// </summary>
/// <param name="key">the key of value</param>
/// <param name="flag">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue> GetAsync(string key, CommandFlags flag = CommandFlags.None, int db = )
{
return GetDatabase(db, true).StringGetAsync(key, flag);
} /// <summary>
/// set value to key
/// </summary>
/// <param name="key">the key</param>
/// <param name="value">the value of the key</param>
/// <param name="expiry">time to expiry</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public RedisValue Set(string key, string value, TimeSpan? expiry = default(TimeSpan?), When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringSet(key, value, expiry, when, flags);
}
/// <summary>
/// set value to key(Asynchronous)
/// </summary>
/// <param name="key">the key</param>
/// <param name="value">the value of the key</param>
/// <param name="expiry">time to expiry</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> SetAsync(string key, string value, TimeSpan? expiry = default(TimeSpan?), When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringSetAsync(key, value, expiry, when, flags);
} /// <summary>
/// get the entity by deserialization
/// </summary>
/// <param name="key">the key of value</param>
/// <param name="flag">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public T Get<T>(string key, CommandFlags flags = CommandFlags.None, int db = )
{
try
{
return JsonConvert.DeserializeObject<T>(GetDatabase(db, true).StringGet(key, flags));
}
catch (Exception ex)
{
return default(T);
}
}
/// <summary>
/// get the entity by deserialization(Asynchronous)
/// </summary>
/// <param name="key">the key of value</param>
/// <param name="flag">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<T> GetAsync<T>(string key, CommandFlags flags = CommandFlags.None, int db = )
{
try
{
var res = GetDatabase(db, true).StringGetAsync(key, flags);
return JsonConvert.DeserializeObject<Task<T>>(res.ToString());
}
catch (Exception ex)
{
return default(Task<T>);
}
} /// <summary>
/// get multi values
/// </summary>
/// <param name="keys">the keys of the values</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> MGet(List<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).StringGet(keys.ToArray(), flags);
}
/// <summary>
/// get multi values(Asynchronous)
/// </summary>
/// <param name="keys">the keys of the values</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> MGetAsync(List<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).StringGetAsync(keys.ToArray(), flags);
} /// <summary>
/// set multi values
/// </summary>
/// <param name="kvs">key-values</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool MSet(List<KeyValuePair<RedisKey, RedisValue>> kvs, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringSet(kvs.ToArray(), when, flags);
}
/// <summary>
/// set multi values(Asynchronous)
/// </summary>
/// <param name="kvs">key-values</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> MSetAsync(List<KeyValuePair<RedisKey, RedisValue>> kvs, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringSetAsync(kvs.ToArray(), when, flags);
} /// <summary>
/// handle the numeric value
/// </summary>
/// <param name="key">key</param>
/// <param name="amount">value to increase or decrease</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public double IncrOrDecrBy(RedisKey key, double amount, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringIncrement(key, amount, flags);
}
/// <summary>
/// handle the numeric value(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="amount">value to increase or decrease</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<double> IncrOrDecrByAsync(RedisKey key, double value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringIncrementAsync(key, value, flags);
} /// <summary>
/// append value to the key
/// </summary>
/// <param name="key">key</param>
/// <param name="value">value to append</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long Append(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringAppend(key, value, flags);
}
/// <summary>
/// append value to the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="value">value to append</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> AppendAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringAppendAsync(key, value, flags);
} /// <summary>
/// get the value's length by the key
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long StrLen(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringLength(key, flags);
}
/// <summary>
/// get the value's length by the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> StrLenAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).StringLengthAsync(key, flags);
}
#endregion #region Hash
/// <summary>
/// get the value of key's field
/// </summary>
/// <param name="key">key</param>
/// <param name="field">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public RedisValue HGet(RedisKey key, RedisValue field, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).HashGet(key, field, CommandFlags.None);
}
/// <summary>
/// get the value of key's field(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="field">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue> HGetAsync(RedisKey key, RedisValue field, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).HashGetAsync(key, field, CommandFlags.None);
} /// <summary>
/// set the field and value of the key
/// </summary>
/// <param name="key">key</param>
/// <param name="field">field of the key</param>
/// <param name="value">value of the field</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool HSet(RedisKey key, RedisValue field, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashSet(key, field, value, When.Always, CommandFlags.None);
}
/// <summary>
/// set the field and value of the key
/// </summary>
/// <param name="key">key</param>
/// <param name="field">field of the key</param>
/// <param name="value">value of the field</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> HSetAsync(RedisKey key, RedisValue field, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashSetAsync(key, field, value, When.Always, CommandFlags.None);
} /// <summary>
/// get multi values of key's fields
/// </summary>
/// <param name="key">key</param>
/// <param name="fields">fields of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> HMGet(RedisKey key, List<RedisValue> fields, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).HashGet(key, fields.ToArray(), flags);
}
/// <summary>
/// get multi values of key's fields(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="fields">fields of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> HMGetAsync(RedisKey key, List<RedisValue> fields, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).HashGetAsync(key, fields.ToArray(), flags);
} /// <summary>
/// set multi values of key's fields
/// </summary>
/// <param name="key">key</param>
/// <param name="entry">name/value pair</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
public void HMSet(RedisKey key, List<HashEntry> entry, CommandFlags flags = CommandFlags.None, int db = )
{
GetDatabase(db).HashSet(key, entry.ToArray(), flags);
}
/// <summary>
/// set multi values of key's fields(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="entry">name/value pair</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
public Task HMSetAsync(RedisKey key, List<HashEntry> entry, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashSetAsync(key, entry.ToArray(), flags);
} /// <summary>
/// get all the fields of the key
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> HKeys(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).HashKeys(key, flags).ToList();
}
/// <summary>
/// get all the fields of the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> HKeysAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).HashKeysAsync(key, flags);
} /// <summary>
/// get all the values of key's fields
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> HVals(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).HashValues(key, flags).ToList();
}
/// <summary>
/// get all the values of key's fields(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> HValsAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).HashValuesAsync(key, flags);
} /// <summary>
/// handle the numeric value
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="amount">value to increase or decrease</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public double HIncrOrDecrBy(RedisKey key, RedisValue hashField, double amount = , CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashIncrement(key, hashField, amount, flags);
}
/// <summary>
/// handle the numeric value(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="amount">value to increase or decrease</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<double> HIncrOrDecrByAsync(RedisKey key, RedisValue hashField, double amount = , CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashIncrementAsync(key, hashField, amount, flags);
} /// <summary>
/// whether a field exists in the key
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool HExists(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(, true).HashExists(key, hashField, flags);
}
/// <summary>
/// whether a field exists in the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> HExistsAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(, true).HashExistsAsync(key, hashField, flags);
} /// <summary>
/// delete the field from the key
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool HDel(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashDelete(key, hashField, flags);
}
/// <summary>
/// delete the field from the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="hashField">field of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> HDelAsync(RedisKey key, RedisValue hashField, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashDeleteAsync(key, hashField, flags);
}
/// <summary>
/// delete fields from the key
/// </summary>
/// <param name="key">key</param>
/// <param name="hashFields">fields of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long HDel(RedisKey key, IList<RedisValue> hashFields, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashDelete(key, hashFields.ToArray(), flags);
}
/// <summary>
/// delete fields from the key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="hashFields">fields of key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> HDelAsync(RedisKey key, IList<RedisValue> hashFields, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).HashDeleteAsync(key, hashFields.ToArray(), flags);
}
#endregion #region List
/// <summary>
/// insert the value to the head of list
/// </summary>
/// <param name="key">key</param>
/// <param name="value">node's value</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long LPush(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).ListLeftPush(key, value, when, flags);
}
/// <summary>
/// insert the value to the head of list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="value">node's value</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> LPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).ListLeftPushAsync(key, value, when, flags);
} /// <summary>
/// insert the value to the tail of list
/// </summary>
/// <param name="key">key</param>
/// <param name="value">node's value</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long RPush(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).ListRightPush(key, value, when, flags);
}
/// <summary>
/// insert the value to the tail of list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="value">node's value</param>
/// <param name="when">when this operation should be performed</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> RPushAsync(RedisKey key, RedisValue value, When when = When.Always, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).ListRightPushAsync(key, value, when, flags);
} /// <summary>
/// removes the first element of the list
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public RedisValue LPop(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).ListLeftPop(key, flags);
}
/// <summary>
/// removes the first element of the list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue> LPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).ListLeftPopAsync(key, flags);
} /// <summary>
/// removes the first count occurrences of elements equal to value from the list
/// </summary>
/// <param name="key">key</param>
/// <param name="value">value</param>
/// <param name="count">amount of the node's value equal to the value</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long LRem(RedisKey key, RedisValue value, long count = , CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).ListRemove(key, value, count, flags);
}
/// <summary>
/// removes the first count occurrences of elements equal to value from the list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="value">value</param>
/// <param name="count">amount of the node's value equal to the value</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> LRemAsync(RedisKey key, RedisValue value, long count = , CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).ListRemoveAsync(key, value, count, flags);
} /// <summary>
/// get the specified elements of the list stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="start">start index</param>
/// <param name="stop">stop index</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> LRange(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).ListRange(key, start, stop, flags).ToList();
}
/// <summary>
/// get the specified elements of the list stored at key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="start">start index</param>
/// <param name="stop">stop index</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> LRangeAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).ListRangeAsync(key, start, stop, flags);
} /// <summary>
/// get the length of the list
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long LLen(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).ListLength(key, flags);
}
/// <summary>
/// get the length of the list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> LLenAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).ListLengthAsync(key, flags);
} /// <summary>
/// get the element at index index in the list
/// </summary>
/// <param name="key">key</param>
/// <param name="index">index</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public RedisValue LIndex(RedisKey key, long index, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).ListGetByIndex(key, index, flags);
}
/// <summary>
/// get the element at index index in the list(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="index">index</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue> LIndexAsync(RedisKey key, long index, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).ListGetByIndexAsync(key, index, flags);
} /// <summary>
/// inserts value in the list stored at key either before or after the reference value pivot.
/// </summary>
/// <param name="key"></param>
/// <param name="pivot"></param>
/// <param name="value"></param>
/// <param name="flags"></param>
/// <param name="isAfter"></param>
/// <param name="db"></param>
/// <returns></returns>
public long LInsert(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None, bool isAfter = false, int db = )
{
return isAfter
? GetDatabase(db).ListInsertAfter(key, pivot, value, flags)
: GetDatabase(db).ListInsertBefore(key, pivot, value, flags);
}
/// <summary>
/// inserts value in the list stored at key either before or after the reference value pivot.
/// </summary>
/// <param name="key"></param>
/// <param name="pivot"></param>
/// <param name="value"></param>
/// <param name="flags"></param>
/// <param name="isAfter"></param>
/// <param name="db"></param>
/// <returns></returns>
public Task<long> LInsertAsync(RedisKey key, RedisValue pivot, RedisValue value, CommandFlags flags = CommandFlags.None, bool isAfter = false, int db = )
{
return isAfter
? GetDatabase(db).ListInsertAfterAsync(key, pivot, value, flags)
: GetDatabase(db).ListInsertBeforeAsync(key, pivot, value, flags);
}
#endregion #region Set #region sadd
/// <summary>
/// add a member to a set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="value">value of the key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool SAdd(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetAdd(key, value, flags);
}
/// <summary>
/// add a member to a set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="value">value of the key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> SAddAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetAddAsync(key, value, flags);
}
/// <summary>
/// add multi members to a set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="values">values of the key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long SAdd(RedisKey key, IList<RedisValue> values, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetAdd(key, values.ToArray(), flags);
}
/// <summary>
/// add multi members to a set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="values">values of the key</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> SAddAsync(RedisKey key, IList<RedisValue> values, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetAddAsync(key, values.ToArray(), flags);
}
#endregion #region sismember
/// <summary>
/// whether member is a member of the set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="value">value</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool SIsMember(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetContains(key, value, flags);
}
/// <summary>
/// whether member is a member of the set (Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="value">value</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> SIsMemberAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetContainsAsync(key, value, flags);
}
#endregion #region smembers
/// <summary>
/// get all the members of the set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> SMembers(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetMembers(key, flags).ToList();
}
/// <summary>
/// get all the members of the set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> SMembersAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetMembersAsync(key, flags);
}
#endregion #region spop
/// <summary>
/// Removes a random elements from the set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public RedisValue SPop(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetPop(key, flags);
}
/// <summary>
/// Removes a random elements from the set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue> SPopAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetPopAsync(key, flags);
}
#endregion #region srem
/// <summary>
/// Remove the specified members from the set
/// </summary>
/// <param name="key">key of the set</param>
/// <param name="value">member to remove</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool SRem(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetRemove(key, value, flags);
}
/// <summary>
/// Remove the specified members from the set(Asynchronous)
/// </summary>
/// <param name="key">key of the set</param>
/// <param name="value">member to remove</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> SRemAsync(RedisKey key, RedisValue value, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetRemoveAsync(key, value, flags);
}
/// <summary>
/// Remove the specified members from the set
/// </summary>
/// <param name="key">key of the set</param>
/// <param name="value">member to remove</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long SRem(RedisKey key, IList<RedisValue> values, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetRemove(key, values.ToArray(), flags);
}
/// <summary>
/// Remove the specified members from the set(Asynchronous)
/// </summary>
/// <param name="key">key of the set</param>
/// <param name="value">member to remove</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> SRemAsync(RedisKey key, IList<RedisValue> values, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SetRemoveAsync(key, values.ToArray(), flags);
}
#endregion #region scard
/// <summary>
/// get the number of elements in the set
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long SCard(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetLength(key, flags);
}
/// <summary>
/// get the number of elements in the set(Asynchronous)
/// </summary>
/// <param name="key">key of set</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> SCardAsync(RedisKey key, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetLengthAsync(key, flags);
}
#endregion #region sinter
/// <summary>
/// get the members of the set resulting from the intersection of all the given sets.
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> SInter(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetCombine(SetOperation.Intersect, keys.ToArray(), flags).ToList();
}
/// <summary>
/// get the members of the set resulting from the intersection of all the given sets.(Asynchronous)
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> SInterAsync(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetCombineAsync(SetOperation.Intersect, keys.ToArray(), flags);
}
#endregion #region sdiff
/// <summary>
/// get the members of the set resulting from the difference between the first set and all the successive sets.
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> SDiff(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetCombine(SetOperation.Difference, keys.ToArray(), flags).ToList();
}
/// <summary>
/// get the members of the set resulting from the difference between the first set and all the successive sets.(Asynchronous)
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> SDiffAsync(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetCombineAsync(SetOperation.Difference, keys.ToArray(), flags);
}
#endregion #region sunion
/// <summary>
/// get the members of the set resulting from the union of all the given sets.
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public IList<RedisValue> SUnion(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetCombine(SetOperation.Union, keys.ToArray(), flags).ToList();
}
/// <summary>
/// get the members of the set resulting from the union of all the given sets.(Asynchronous)
/// </summary>
/// <param name="keys">keys</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<RedisValue[]> SUnionAsync(IList<RedisKey> keys, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SetCombineAsync(SetOperation.Union, keys.ToArray(), flags);
}
#endregion
#endregion #region Sorted Set
#region zadd
/// <summary>
/// Adds a member with the score to the sorted set stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="member">member</param>
/// <param name="score">score</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool ZAdd(RedisKey key, RedisValue member, double score, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetAdd(key, member, score, flags);
}
/// <summary>
/// Adds a member with the score to the sorted set stored at key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="member">member</param>
/// <param name="score">score</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> ZAddAsync(RedisKey key, RedisValue member, double score, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetAddAsync(key, member, score, flags);
}
/// <summary>
/// Adds members with scores to the sorted set stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="values">sortedset entity</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long ZAdd(RedisKey key, IList<SortedSetEntry> values, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetAdd(key, values.ToArray(), flags);
}
/// <summary>
/// Adds members with scores to the sorted set stored at key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="values">sortedset entity</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> ZAddAsync(RedisKey key, IList<SortedSetEntry> values, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetAddAsync(key, values.ToArray(), flags);
}
#endregion #region zrem
/// <summary>
/// Removes a member from the sorted set stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="member">member</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public bool ZRem(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetRemove(key, member, flags);
}
/// <summary>
/// Removes a member from the sorted set stored at key(Async)
/// </summary>
/// <param name="key">key</param>
/// <param name="member">member</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<bool> ZRemAsync(RedisKey key, RedisValue member, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetRemoveAsync(key, member, flags);
}
/// <summary>
/// Removes members from the sorted set stored at key
/// </summary>
/// <param name="key">key</param>
/// <param name="members">members</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public long ZRem(RedisKey key, IList<RedisValue> members, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetRemove(key, members.ToArray(), flags);
}
/// <summary>
/// Removes members from the sorted set stored at key(Asynchronous)
/// </summary>
/// <param name="key">key</param>
/// <param name="members">members</param>
/// <param name="flags">behaviour</param>
/// <param name="db">index of database</param>
/// <returns></returns>
public Task<long> ZRemAsync(RedisKey key, IList<RedisValue> members, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetRemoveAsync(key, members.ToArray(), flags);
}
#endregion #region zrange
public IList<RedisValue> ZRange(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SortedSetRangeByRank(key, start, stop, Order.Ascending, flags).ToList();
}
public Task<RedisValue[]> ZRangeAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SortedSetRangeByRankAsync(key, start, stop, Order.Ascending, flags);
}
#endregion #region zrevrange
public IList<RedisValue> ZRevRange(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SortedSetRangeByRank(key, start, stop, Order.Descending, flags).ToList();
}
public Task<RedisValue[]> ZRevRangeAsync(RedisKey key, long start, long stop, CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db, true).SortedSetRangeByRankAsync(key, start, stop, Order.Descending, flags);
}
#endregion #region zincrby
public double ZIncrby(RedisKey key, RedisValue member, double value = , CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetIncrement(key, member, value, flags);
}
public Task<double> ZIncrbyAsync(RedisKey key, RedisValue member, double value = , CommandFlags flags = CommandFlags.None, int db = )
{
return GetDatabase(db).SortedSetIncrementAsync(key, member, value, flags);
}
#endregion
#endregion #region pub/sub
public long Publish(RedisChannel channel, RedisValue value, CommandFlags flags = CommandFlags.None, bool isRead = false)
{
return GetSubscriber(isRead).Publish(channel, value, flags);
}
public void Subscribe(RedisChannel channel, Action<RedisChannel, RedisValue> handle, CommandFlags flags = CommandFlags.None, bool isRead = false)
{
GetSubscriber(isRead).Subscribe(channel, handle, flags);
}
public void UnSubscrribe(RedisChannel channel, Action<RedisChannel, RedisValue> handle, CommandFlags flags = CommandFlags.None, bool isRead = false)
{
GetSubscriber(isRead).Unsubscribe(channel, handle, flags);
}
#endregion
}
}

RedisHelper

  So much for this series. The next series will be some complex example. Thanks for your reading.

Basic Tutorials of Redis(9) -First Edition RedisHelper的更多相关文章

  1. Basic Tutorials of Redis(8) -Transaction

    Data play an important part in our project,how can we ensure correctness of the data and prevent the ...

  2. Basic Tutorials of Redis(2) - String

    This post is mainly about how to use the commands to handle the Strings of Redis.And I will show you ...

  3. Basic Tutorials of Redis(7) -Publish and Subscribe

    This post is mainly about the publishment and subscription in Redis.I think you may subscribe some o ...

  4. Basic Tutorials of Redis(6) - List

    Redis's List is different from C#'s List,but similar with C#'s LinkedList.Sometimes I confuse with t ...

  5. Basic Tutorials of Redis(5) - Sorted Set

    The last post is mainly about the unsorted set,in this post I will show you the sorted set playing a ...

  6. Basic Tutorials of Redis(4) -Set

    This post will introduce you to some usages of Set in Redis.The Set is a unordered set,it means that ...

  7. Basic Tutorials of Redis(3) -Hash

    When you first saw the name of Hash,what do you think?HashSet,HashTable or other data structs of C#? ...

  8. Basic Tutorials of Redis(1) - Install And Configure Redis

    Nowaday, Redis became more and more popular , many projects use it in the cache module and the store ...

  9. [C#] 使用 StackExchange.Redis 封装属于自己的 RedisHelper

    使用 StackExchange.Redis 封装属于自己的 RedisHelper 目录 核心类 ConnectionMultiplexer 字符串(String) 哈希(Hash) 列表(List ...

随机推荐

  1. UE4新手引导入门教程

    请大家去这个地址下载:file:///D:/UE4%20Doc/虚幻4新手引导入门教程.pdf

  2. 使用C/C++写Python模块

    最近看开源项目时学习了一下用C/C++写python模块,顺便把学习进行一下总结,废话少说直接开始: 环境:windows.python2.78.VS2010或MingW 1 创建VC工程 (1) 打 ...

  3. css text-fill-color与text-stroke讲解

    顾名思义"text-fill-color"就是文字填充颜色而"text-stroke"就是文字描边.还别说,两个属性可以制作出各种炫酷的文字效果,不过IE系列都 ...

  4. C# 给word文档添加水印

    和PDF一样,在word中,水印也分为图片水印和文本水印,给文档添加图片水印可以使文档变得更为美观,更具有吸引力.文本水印则可以保护文档,提醒别人该文档是受版权保护的,不能随意抄袭.前面我分享了如何给 ...

  5. 浅谈java异常[Exception]

    学习Java的同学注意了!!! 学习过程中遇到什么问题或者想获取学习资源的话,欢迎加入Java学习交流群,群号码:589809992 我们一起学Java! 一. 异常的定义 在<java编程思想 ...

  6. linux压力测试工具stress

    最近给PASS平台添加autoscaling的功能,根据服务器的负载情况autoscaling,为了测试这项功能用到了stress这个压力测试工具,这个工具相当好用了.具体安装方式就不说了.记录下这个 ...

  7. MapReduce

    2016-12-21  16:53:49 mapred-default.xml mapreduce.input.fileinputformat.split.minsize 0 The minimum ...

  8. Spring7:基于注解的Spring MVC(下篇)

    Model 上一篇文章<Spring6:基于注解的Spring MVC(上篇)>,讲了Spring MVC环境搭建.@RequestMapping以及参数绑定,这是Spring MVC中最 ...

  9. 《MSSQL2008技术内幕:T-SQL语言基础》读书笔记(上)

    索引: 一.SQL Server的体系结构 二.查询 三.表表达式 四.集合运算 五.透视.逆透视及分组 六.数据修改 七.事务和并发 八.可编程对象 一.SQL Server体系结构 1.1 数据库 ...

  10. JS对象继承篇

    JS对象继承篇 ECMAScript只支持实现继承,而且其实现继承主要是依靠原型链来实现的 原型链 其基本思路是利用原型让一个引用类型继承另一个引用类型的属性和方法 function Person() ...