Exemplo n.º 1
0
 /// <summary>
 /// Adds the asynchronous.
 /// </summary>
 /// <param name="key">The key.</param>
 /// <param name="value">The value.</param>
 /// <param name="when">The when.</param>
 /// <returns></returns>
 public async Task <bool> AddAsync(TKey key, TValue value, When when)
 {
     return(await RedisDb.HashSetAsync(RedisKey, KeySerializer.Serialize(key), ValueSerializer.Serialize(value), when : when));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Sets field in the hash stored at key to value. If key does not exist, a new key holding a hash is created. If field already exists in the hash, it is overwritten.
 /// </summary>
 /// <param name="hashField">The field to set in the hash.</param>
 /// <param name="value">The value to set.</param>
 /// <param name="when">Which conditions under which to set the field value (defaults to always).</param>
 /// <remarks>https://redis.io/commands/hset</remarks>
 /// <remarks>https://redis.io/commands/hsetnx</remarks>
 public async Task SetAsync(string hashField, RedisValue value)
 {
     await RedisDb.HashSetAsync(hashField, hashField, value);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds the multiple asynchronous.
 /// </summary>
 /// <param name="items">The items.</param>
 /// <returns></returns>
 public async Task AddMultipleAsync(IEnumerable <KeyValuePair <TKey, TValue> > items)
 {
     await RedisDb.HashSetAsync(RedisKey, items.Select(i => new HashEntry(KeySerializer.Serialize(i.Key), ValueSerializer.Serialize(i.Value))).ToArray());
 }
Exemplo n.º 4
0
 /// <summary>
 /// Sets the specified fields to their respective values in the hash stored at key. This command overwrites any specified fields that already exist in the hash, leaving other unspecified fields untouched. If key does not exist, a new key holding a hash is created.
 /// </summary>
 /// <param name="hashFields">The entries to set in the hash.</param>
 /// <remarks>https://redis.io/commands/hmset</remarks>
 public Task SetAsync(HashEntry[] hashFields)
 {
     return(RedisDb.HashSetAsync(KeyName, hashFields));
 }