/// <summary> /// Returns the value associated with field in the hash stored at key. /// </summary> /// <param name="hashField">The field in the hash to get.</param> /// <returns>The value associated with field, or nil when field is not present in the hash or key does not exist.</returns> /// <remarks>https://redis.io/commands/hget</remarks> public Task <RedisValue> GetAsync(string hashField) { return(RedisDb.HashGetAsync(KeyName, hashField)); }
/// <summary> /// Gets the value asynchronous. /// </summary> /// <param name="key">The key.</param> /// <returns></returns> public async Task <TValue> GetAsync(TKey key) { var redisValue = await RedisDb.HashGetAsync(RedisKey, KeySerializer.Serialize(key)); return(redisValue.IsNull ? default(TValue) : ValueSerializer.Deserialize <TValue>(redisValue)); }
/// <summary> /// Returns the values associated with the specified fields in the hash stored at key. /// For every field that does not exist in the hash, a nil value is returned.Because a non-existing keys are treated as empty hashes, running HMGET against a non-existing key will return a list of nil values. /// </summary> /// <param name="hashFields">The fields in the hash to get.</param> /// <returns>List of values associated with the given fields, in the same order as they are requested.</returns> /// <remarks>https://redis.io/commands/hmget</remarks> public Task <RedisValue[]> GetAsync(string[] hashFields) { return(RedisDb.HashGetAsync(KeyName, hashFields.Select(f => new RedisValue(f)).ToArray())); }