public RedisEntry[] HashGetAll(RedisField key) { using (var client = GetRedisClient()) { var bytes = client.HGetAll(key); if (bytes == null) { return(null); } var list = new RedisEntry[bytes.Length / 2]; for (int i = 0; i < list.Length; i++) { list[i] = new RedisEntry(bytes[2 * i], bytes[2 * i + 1]); } return(list); } }
public RedisEntry[] HashGetAll(RedisField key) { using (var client = GetRedisClient()) { var hash = client.HGetAll(key); if (hash.Length == 0) { return(null); } var list = new RedisEntry[hash.Length / 2]; for (int i = 0; i < list.Length; i++) { list[i] = new RedisEntry(hash[2 * i], hash[2 * i + 1]); } return(list); } }
public RedisEntry[] SortedSetRangeByScoreWithScores(RedisField key, Double startScore = Double.NegativeInfinity, Double stopScore = Double.PositiveInfinity, Int64 skip = 0, Int64 take = -1, Order order = Order.Ascending) { using (var client = GetRedisClient()) { Byte[][] bytes = order == Order.Ascending ? client.ZRangeByScoreWithScores(key, startScore, stopScore, (int)skip, (int)take) : client.ZRevRangeByScoreWithScores(key, startScore, stopScore, (int)skip, (int)take); if (bytes == null) { return(null); } var list = new RedisEntry[bytes.Length / 2]; for (int i = 0; i < list.Length; i++) { list[i] = new RedisEntry(bytes[2 * i], bytes[2 * i + 1]); } return(list); } }
public RedisEntry[] SortedSetRangeByRankWithScores(RedisField key, Int64 startPosition = 0, Int64 stopPosition = -1, Order order = Order.Ascending) { using (var client = GetRedisClient()) { Byte[][] bytes = order == Order.Ascending ? client.ZRangeWithScores(key, (int)startPosition, (int)stopPosition) : client.ZRevRangeWithScores(key, (int)startPosition, (int)stopPosition); if (bytes == null) { return(null); } var list = new RedisEntry[bytes.Length / 2]; for (int i = 0; i < list.Length; i++) { list[i] = new RedisEntry(bytes[2 * i], bytes[2 * i + 1]); } return(list); } }
public Int64 HashSet(RedisField key, RedisEntry hash) { using (var client = GetRedisClient()) { return(client.HSet(key, hash.Name, hash.Value)); } }