diff --git a/src/CSRedisClient.cs b/src/CSRedisClient.cs index e8708d1..c9dbfb0 100644 --- a/src/CSRedisClient.cs +++ b/src/CSRedisClient.cs @@ -2043,28 +2043,28 @@ public bool PfAdd(string key, params T[] elements) /// 不含prefix前辍 /// 数量 /// - public (string member, double score)[] ZPopMax(string key, long count) => ExecuteScalar(key, (c, k) => c.Value.ZPopMax(k, count)).Select(a => (a.Item1, a.Item2)).ToArray(); + public (string member, decimal score)[] ZPopMax(string key, long count) => ExecuteScalar(key, (c, k) => c.Value.ZPopMax(k, count)).Select(a => (a.Item1, a.Item2)).ToArray(); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最高得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最高的元素将是第一个元素,然后是分数较低的元素。 /// /// 不含prefix前辍 /// 数量 /// - public (T member, double score)[] ZPopMax(string key, long count) => this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZPopMaxBytes(k, count))); + public (T member, decimal score)[] ZPopMax(string key, long count) => this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZPopMaxBytes(k, count))); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最低得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最低的元素将是第一个元素,然后是分数较高的元素。 /// /// 不含prefix前辍 /// 数量 /// - public (string member, double score)[] ZPopMin(string key, long count) => ExecuteScalar(key, (c, k) => c.Value.ZPopMin(k, count)).Select(a => (a.Item1, a.Item2)).ToArray(); + public (string member, decimal score)[] ZPopMin(string key, long count) => ExecuteScalar(key, (c, k) => c.Value.ZPopMin(k, count)).Select(a => (a.Item1, a.Item2)).ToArray(); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最低得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最低的元素将是第一个元素,然后是分数较高的元素。 /// /// 不含prefix前辍 /// 数量 /// - public (T member, double score)[] ZPopMin(string key, long count) => this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZPopMinBytes(k, count))); + public (T member, decimal score)[] ZPopMin(string key, long count) => this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZPopMinBytes(k, count))); /// /// 向有序集合添加一个或多个成员,或者更新已存在成员的分数 @@ -2072,10 +2072,10 @@ public bool PfAdd(string key, params T[] elements) /// 不含prefix前辍 /// 一个或多个成员分数 /// - public long ZAdd(string key, params (double, object)[] scoreMembers) + public long ZAdd(string key, params (decimal, object)[] scoreMembers) { if (scoreMembers == null || scoreMembers.Any() == false) return 0; - var args = scoreMembers.Select(a => new Tuple(a.Item1, this.SerializeRedisValueInternal(a.Item2))).ToArray(); + var args = scoreMembers.Select(a => new Tuple(a.Item1, this.SerializeRedisValueInternal(a.Item2))).ToArray(); return ExecuteScalar(key, (c, k) => c.Value.ZAdd(k, args)); } /// @@ -2088,10 +2088,10 @@ public long ZAdd(string key, params (double, object)[] scoreMembers) /// 计算在有序集合中指定区间分数的成员数量 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public long ZCount(string key, double min, double max) => ExecuteScalar(key, (c, k) => c.Value.ZCount(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString())); + public long ZCount(string key, decimal min, decimal max) => ExecuteScalar(key, (c, k) => c.Value.ZCount(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString())); /// /// 计算在有序集合中指定区间分数的成员数量 /// @@ -2107,7 +2107,7 @@ public long ZAdd(string key, params (double, object)[] scoreMembers) /// 成员 /// 增量值(默认=1) /// - public double ZIncrBy(string key, object member, double increment = 1) + public decimal ZIncrBy(string key, object member, decimal increment = 1) { var args = this.SerializeRedisValueInternal(member); return ExecuteScalar(key, (c, k) => c.Value.ZIncrBy(k, increment, args)); @@ -2121,7 +2121,7 @@ public double ZIncrBy(string key, object member, double increment = 1) /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public long ZInterStore(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) + public long ZInterStore(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) { if (keys == null || keys.Length == 0) throw new Exception("keys 参数不可为空"); if (weights != null && weights.Length != keys.Length) throw new Exception("weights 和 keys 参数长度必须相同"); @@ -2152,7 +2152,7 @@ public long ZInterStore(string destination, double[] weights, RedisAggregate agg /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public (string member, double score)[] ZRangeWithScores(string key, long start, long stop) => ExecuteScalar(key, (c, k) => c.Value.ZRangeWithScores(k, start, stop)).Select(a => (a.Item1, a.Item2)).ToArray(); + public (string member, decimal score)[] ZRangeWithScores(string key, long start, long stop) => ExecuteScalar(key, (c, k) => c.Value.ZRangeWithScores(k, start, stop)).Select(a => (a.Item1, a.Item2)).ToArray(); /// /// 通过索引区间返回有序集合成指定区间内的成员和分数 /// @@ -2161,31 +2161,31 @@ public long ZInterStore(string destination, double[] weights, RedisAggregate agg /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public (T member, double score)[] ZRangeWithScores(string key, long start, long stop) => this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRangeBytesWithScores(k, start, stop))); + public (T member, decimal score)[] ZRangeWithScores(string key, long start, long stop) => this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRangeBytesWithScores(k, start, stop))); /// /// 通过分数返回有序集合指定区间内的成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public string[] ZRangeByScore(string key, double min, double max, long? count = null, long offset = 0) => - ExecuteScalar(key, (c, k) => c.Value.ZRangeByScore(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), false, offset, count)); + public string[] ZRangeByScore(string key, decimal min, decimal max, long? count = null, long offset = 0) => + ExecuteScalar(key, (c, k) => c.Value.ZRangeByScore(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), false, offset, count)); /// /// 通过分数返回有序集合指定区间内的成员 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public T[] ZRangeByScore(string key, double min, double max, long? count = null, long offset = 0) => - this.DeserializeRedisValueArrayInternal(ExecuteScalar(key, (c, k) => c.Value.ZRangeBytesByScore(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), false, offset, count))); + public T[] ZRangeByScore(string key, decimal min, decimal max, long? count = null, long offset = 0) => + this.DeserializeRedisValueArrayInternal(ExecuteScalar(key, (c, k) => c.Value.ZRangeBytesByScore(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), false, offset, count))); /// /// 通过分数返回有序集合指定区间内的成员 /// @@ -2214,25 +2214,25 @@ public T[] ZRangeByScore(string key, string min, string max, long? count = nu /// 通过分数返回有序集合指定区间内的成员和分数 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public (string member, double score)[] ZRangeByScoreWithScores(string key, double min, double max, long? count = null, long offset = 0) => - ExecuteScalar(key, (c, k) => c.Value.ZRangeByScoreWithScores(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), offset, count)).Select(z => (z.Item1, z.Item2)).ToArray(); + public (string member, decimal score)[] ZRangeByScoreWithScores(string key, decimal min, decimal max, long? count = null, long offset = 0) => + ExecuteScalar(key, (c, k) => c.Value.ZRangeByScoreWithScores(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), offset, count)).Select(z => (z.Item1, z.Item2)).ToArray(); /// /// 通过分数返回有序集合指定区间内的成员和分数 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public (T member, double score)[] ZRangeByScoreWithScores(string key, double min, double max, long? count = null, long offset = 0) => - this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRangeBytesByScoreWithScores(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), offset, count))); + public (T member, decimal score)[] ZRangeByScoreWithScores(string key, decimal min, decimal max, long? count = null, long offset = 0) => + this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRangeBytesByScoreWithScores(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), offset, count))); /// /// 通过分数返回有序集合指定区间内的成员和分数 /// @@ -2242,7 +2242,7 @@ public T[] ZRangeByScore(string key, string min, string max, long? count = nu /// 返回多少成员 /// 返回条件偏移位置 /// - public (string member, double score)[] ZRangeByScoreWithScores(string key, string min, string max, long? count = null, long offset = 0) => + public (string member, decimal score)[] ZRangeByScoreWithScores(string key, string min, string max, long? count = null, long offset = 0) => ExecuteScalar(key, (c, k) => c.Value.ZRangeByScoreWithScores(k, min, max, offset, count)).Select(z => (z.Item1, z.Item2)).ToArray(); /// /// 通过分数返回有序集合指定区间内的成员和分数 @@ -2254,8 +2254,8 @@ public T[] ZRangeByScore(string key, string min, string max, long? count = nu /// 返回多少成员 /// 返回条件偏移位置 /// - public (T member, double score)[] ZRangeByScoreWithScores(string key, string min, string max, long? count = null, long offset = 0) => - this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRangeBytesByScoreWithScores(k, min, max, offset, count))); + public (T member, decimal score)[] ZRangeByScoreWithScores(string key, string min, string max, long? count = null, long offset = 0) => + this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRangeBytesByScoreWithScores(k, min, max, offset, count))); /// /// 返回有序集合中指定成员的索引 @@ -2292,10 +2292,10 @@ public long ZRem(string key, params T[] member) /// 移除有序集合中给定的分数区间的所有成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public long ZRemRangeByScore(string key, double min, double max) => ExecuteScalar(key, (c, k) => c.Value.ZRemRangeByScore(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString())); + public long ZRemRangeByScore(string key, decimal min, decimal max) => ExecuteScalar(key, (c, k) => c.Value.ZRemRangeByScore(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString())); /// /// 移除有序集合中给定的分数区间的所有成员 /// @@ -2329,7 +2329,7 @@ public long ZRem(string key, params T[] member) /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public (string member, double score)[] ZRevRangeWithScores(string key, long start, long stop) => ExecuteScalar(key, (c, k) => c.Value.ZRevRangeWithScores(k, start, stop)).Select(a => (a.Item1, a.Item2)).ToArray(); + public (string member, decimal score)[] ZRevRangeWithScores(string key, long start, long stop) => ExecuteScalar(key, (c, k) => c.Value.ZRevRangeWithScores(k, start, stop)).Select(a => (a.Item1, a.Item2)).ToArray(); /// /// 返回有序集中指定区间内的成员和分数,通过索引,分数从高到底 /// @@ -2338,30 +2338,30 @@ public long ZRem(string key, params T[] member) /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public (T member, double score)[] ZRevRangeWithScores(string key, long start, long stop) => this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRevRangeBytesWithScores(k, start, stop))); + public (T member, decimal score)[] ZRevRangeWithScores(string key, long start, long stop) => this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRevRangeBytesWithScores(k, start, stop))); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public string[] ZRevRangeByScore(string key, double max, double min, long? count = null, long? offset = 0) => ExecuteScalar(key, (c, k) => c.Value.ZRevRangeByScore(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), false, offset, count)); + public string[] ZRevRangeByScore(string key, decimal max, decimal min, long? count = null, long? offset = 0) => ExecuteScalar(key, (c, k) => c.Value.ZRevRangeByScore(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), false, offset, count)); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public T[] ZRevRangeByScore(string key, double max, double min, long? count = null, long offset = 0) => - this.DeserializeRedisValueArrayInternal(ExecuteScalar(key, (c, k) => c.Value.ZRevRangeBytesByScore(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), false, offset, count))); + public T[] ZRevRangeByScore(string key, decimal max, decimal min, long? count = null, long offset = 0) => + this.DeserializeRedisValueArrayInternal(ExecuteScalar(key, (c, k) => c.Value.ZRevRangeBytesByScore(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), false, offset, count))); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// @@ -2389,25 +2389,25 @@ public T[] ZRevRangeByScore(string key, string max, string min, long? count = /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public (string member, double score)[] ZRevRangeByScoreWithScores(string key, double max, double min, long? count = null, long offset = 0) => - ExecuteScalar(key, (c, k) => c.Value.ZRevRangeByScoreWithScores(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), offset, count)).Select(z => (z.Item1, z.Item2)).ToArray(); + public (string member, decimal score)[] ZRevRangeByScoreWithScores(string key, decimal max, decimal min, long? count = null, long offset = 0) => + ExecuteScalar(key, (c, k) => c.Value.ZRevRangeByScoreWithScores(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), offset, count)).Select(z => (z.Item1, z.Item2)).ToArray(); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public (T member, double score)[] ZRevRangeByScoreWithScores(string key, double max, double min, long? count = null, long offset = 0) => - this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRevRangeBytesByScoreWithScores(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), offset, count))); + public (T member, decimal score)[] ZRevRangeByScoreWithScores(string key, decimal max, decimal min, long? count = null, long offset = 0) => + this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRevRangeBytesByScoreWithScores(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), offset, count))); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// @@ -2417,7 +2417,7 @@ public T[] ZRevRangeByScore(string key, string max, string min, long? count = /// 返回多少成员 /// 返回条件偏移位置 /// - public (string member, double score)[] ZRevRangeByScoreWithScores(string key, string max, string min, long? count = null, long offset = 0) => + public (string member, decimal score)[] ZRevRangeByScoreWithScores(string key, string max, string min, long? count = null, long offset = 0) => ExecuteScalar(key, (c, k) => c.Value.ZRevRangeByScoreWithScores(k, max, min, offset, count)).Select(z => (z.Item1, z.Item2)).ToArray(); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 @@ -2429,8 +2429,8 @@ public T[] ZRevRangeByScore(string key, string max, string min, long? count = /// 返回多少成员 /// 返回条件偏移位置 /// - public (T member, double score)[] ZRevRangeByScoreWithScores(string key, string max, string min, long? count = null, long offset = 0) => - this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRevRangeBytesByScoreWithScores(k, max, min, offset, count))); + public (T member, decimal score)[] ZRevRangeByScoreWithScores(string key, string max, string min, long? count = null, long offset = 0) => + this.DeserializeRedisValueTuple1Internal(ExecuteScalar(key, (c, k) => c.Value.ZRevRangeBytesByScoreWithScores(k, max, min, offset, count))); /// /// 返回有序集合中指定成员的排名,有序集成员按分数值递减(从大到小)排序 @@ -2449,7 +2449,7 @@ public T[] ZRevRangeByScore(string key, string max, string min, long? count = /// 不含prefix前辍 /// 成员 /// - public double? ZScore(string key, object member) + public decimal? ZScore(string key, object member) { var args = this.SerializeRedisValueInternal(member); return ExecuteScalar(key, (c, k) => c.Value.ZScore(k, args)); @@ -2463,7 +2463,7 @@ public T[] ZRevRangeByScore(string key, string max, string min, long? count = /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public long ZUnionStore(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) + public long ZUnionStore(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) { if (keys == null || keys.Length == 0) throw new Exception("keys 参数不可为空"); if (weights != null && weights.Length != keys.Length) throw new Exception("weights 和 keys 参数长度必须相同"); @@ -2478,10 +2478,10 @@ public long ZUnionStore(string destination, double[] weights, RedisAggregate agg /// 模式 /// 数量 /// - public RedisScan<(string member, double score)> ZScan(string key, long cursor, string pattern = null, long? count = null) + public RedisScan<(string member, decimal score)> ZScan(string key, long cursor, string pattern = null, long? count = null) { var scan = ExecuteScalar(key, (c, k) => c.Value.ZScan(k, cursor, pattern, count)); - return new RedisScan<(string, double)>(scan.Cursor, scan.Items.Select(z => (z.Item1, z.Item2)).ToArray()); + return new RedisScan<(string, decimal)>(scan.Cursor, scan.Items.Select(z => (z.Item1, z.Item2)).ToArray()); } /// /// 迭代有序集合中的元素 @@ -2492,10 +2492,10 @@ public long ZUnionStore(string destination, double[] weights, RedisAggregate agg /// 模式 /// 数量 /// - public RedisScan<(T member, double score)> ZScan(string key, long cursor, string pattern = null, long? count = null) + public RedisScan<(T member, decimal score)> ZScan(string key, long cursor, string pattern = null, long? count = null) { var scan = ExecuteScalar(key, (c, k) => c.Value.ZScanBytes(k, cursor, pattern, count)); - return new RedisScan<(T, double)>(scan.Cursor, this.DeserializeRedisValueTuple1Internal(scan.Items)); + return new RedisScan<(T, decimal)>(scan.Cursor, this.DeserializeRedisValueTuple1Internal(scan.Items)); } /// @@ -3119,7 +3119,7 @@ public long RPushX(string key, object value) /// 字段 /// 增量值(默认=1) /// - public double HIncrByFloat(string key, string field, double value) => ExecuteScalar(key, (c, k) => c.Value.HIncrByFloat(k, field, value)); + public decimal HIncrByFloat(string key, string field, decimal value) => ExecuteScalar(key, (c, k) => c.Value.HIncrByFloat(k, field, value)); /// /// 获取所有哈希表中的字段 /// @@ -3349,7 +3349,7 @@ public T GetSet(string key, object value) /// 不含prefix前辍 /// 增量值(默认=1) /// - public double IncrByFloat(string key, double value) => ExecuteScalar(key, (c, k) => c.Value.IncrByFloat(k, value)); + public decimal IncrByFloat(string key, decimal value) => ExecuteScalar(key, (c, k) => c.Value.IncrByFloat(k, value)); /// /// 获取多个指定 key 的值(数组) /// @@ -3420,6 +3420,15 @@ public bool Set(string key, object value, int expireSeconds = -1, RedisExistence if (expireSeconds > 0 && exists != null) return ExecuteScalar(key, (c, k) => c.Value.Set(k, redisValule, expireSeconds, exists)) == "OK"; return false; } + public bool Set(string key, object value, TimeSpan expire, RedisExistence? exists = null) + { + object redisValule = this.SerializeRedisValueInternal(value); + if (expire <= TimeSpan.Zero && exists == null) return ExecuteScalar(key, (c, k) => c.Value.Set(k, redisValule)) == "OK"; + if (expire <= TimeSpan.Zero && exists != null) return ExecuteScalar(key, (c, k) => c.Value.Set(k, redisValule, null, exists)) == "OK"; + if (expire > TimeSpan.Zero && exists == null) return ExecuteScalar(key, (c, k) => c.Value.Set(k, redisValule, expire, null)) == "OK"; + if (expire > TimeSpan.Zero && exists != null) return ExecuteScalar(key, (c, k) => c.Value.Set(k, redisValule, expire, exists)) == "OK"; + return false; + } /// /// 对 key 所储存的字符串值,设置或清除指定偏移量上的位(bit) /// @@ -3718,14 +3727,14 @@ public RedisScan Scan(long cursor, string pattern = null, long? count = nu /// 纬度 /// 成员 /// 是否成功 - public bool GeoAdd(string key, double longitude, double latitude, object member) => GeoAdd(key, (longitude, latitude, member)) == 1; + public bool GeoAdd(string key, decimal longitude, decimal latitude, object member) => GeoAdd(key, (longitude, latitude, member)) == 1; /// /// 将指定的地理空间位置(纬度、经度、成员)添加到指定的key中。这些数据将会存储到sorted set这样的目的是为了方便使用GEORADIUS或者GEORADIUSBYMEMBER命令对数据进行半径查询等操作。 /// /// 不含prefix前辍 /// 批量添加的值 /// 添加到sorted set元素的数目,但不包括已更新score的元素。 - public long GeoAdd(string key, params (double longitude, double latitude, object member)[] values) + public long GeoAdd(string key, params (decimal longitude, decimal latitude, object member)[] values) { if (values == null || values.Any() == false) return 0; var args = values.Select(z => (z.longitude, z.latitude, this.SerializeRedisValueInternal(z.member))).ToArray(); @@ -3739,7 +3748,7 @@ public long GeoAdd(string key, params (double longitude, double latitude, object /// 成员2 /// m 表示单位为米;km 表示单位为千米;mi 表示单位为英里;ft 表示单位为英尺; /// 计算出的距离会以双精度浮点数的形式被返回。 如果给定的位置元素不存在, 那么命令返回空值。 - public double? GeoDist(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) + public decimal? GeoDist(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) { var args1 = this.SerializeRedisValueInternal(member1); var args2 = this.SerializeRedisValueInternal(member2); @@ -3763,9 +3772,9 @@ public string[] GeoHash(string key, object[] members) /// 不含prefix前辍 /// 多个查询的成员 /// GEOPOS 命令返回一个数组, 数组中的每个项都由两个元素组成: 第一个元素为给定位置元素的经度, 而第二个元素则为给定位置元素的纬度。当给定的位置元素不存在时, 对应的数组项为空值。 - public (double longitude, double latitude)?[] GeoPos(string key, object[] members) + public (decimal longitude, decimal latitude)?[] GeoPos(string key, object[] members) { - if (members == null || members.Any() == false) return new (double, double)?[0]; + if (members == null || members.Any() == false) return new (decimal, decimal)?[0]; var args = members.Select(z => this.SerializeRedisValueInternal(z)).ToArray(); return ExecuteScalar(key, (c, k) => c.Value.GeoPos(k, args)); } @@ -3781,7 +3790,7 @@ public string[] GeoHash(string key, object[] members) /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public string[] GeoRadius(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public string[] GeoRadius(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadius(k, longitude, latitude, radius, unit, count, sorting, false, false, false)).Select(a => a.member).ToArray(); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -3794,7 +3803,7 @@ public string[] GeoRadius(string key, double longitude, double latitude, double /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public T[] GeoRadius(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public T[] GeoRadius(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusBytes(k, longitude, latitude, radius, unit, count, sorting, false, false, false)).Select(a => this.DeserializeRedisValueInternal(a.member)).ToArray(); /// @@ -3808,7 +3817,7 @@ public T[] GeoRadius(string key, double longitude, double latitude, double ra /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public (string member, double dist)[] GeoRadiusWithDist(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public (string member, decimal dist)[] GeoRadiusWithDist(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadius(k, longitude, latitude, radius, unit, count, sorting, false, true, false)).Select(a => (a.member, a.dist)).ToArray(); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离)。 @@ -3821,7 +3830,7 @@ public T[] GeoRadius(string key, double longitude, double latitude, double ra /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public (T member, double dist)[] GeoRadiusWithDist(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public (T member, decimal dist)[] GeoRadiusWithDist(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusBytes(k, longitude, latitude, radius, unit, count, sorting, false, true, false)).Select(a => (this.DeserializeRedisValueInternal(a.member), a.dist)).ToArray(); /// @@ -3835,7 +3844,7 @@ public T[] GeoRadius(string key, double longitude, double latitude, double ra /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - private (string member, double longitude, double latitude)[] GeoRadiusWithCoord(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + private (string member, decimal longitude, decimal latitude)[] GeoRadiusWithCoord(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadius(k, longitude, latitude, radius, unit, count, sorting, true, false, false)).Select(a => (a.member, a.longitude, a.latitude)).ToArray(); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含经度、纬度)。 @@ -3848,7 +3857,7 @@ public T[] GeoRadius(string key, double longitude, double latitude, double ra /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - private (T member, double longitude, double latitude)[] GeoRadiusWithCoord(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + private (T member, decimal longitude, decimal latitude)[] GeoRadiusWithCoord(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusBytes(k, longitude, latitude, radius, unit, count, sorting, true, false, false)).Select(a => (this.DeserializeRedisValueInternal(a.member), a.longitude, a.latitude)).ToArray(); /// @@ -3862,7 +3871,7 @@ public T[] GeoRadius(string key, double longitude, double latitude, double ra /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public (string member, double dist, double longitude, double latitude)[] GeoRadiusWithDistAndCoord(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public (string member, decimal dist, decimal longitude, decimal latitude)[] GeoRadiusWithDistAndCoord(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadius(k, longitude, latitude, radius, unit, count, sorting, true, true, false)).Select(a => (a.member, a.dist, a.longitude, a.latitude)).ToArray(); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离、经度、纬度)。 @@ -3875,7 +3884,7 @@ public T[] GeoRadius(string key, double longitude, double latitude, double ra /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public (T member, double dist, double longitude, double latitude)[] GeoRadiusWithDistAndCoord(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public (T member, decimal dist, decimal longitude, decimal latitude)[] GeoRadiusWithDistAndCoord(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusBytes(k, longitude, latitude, radius, unit, count, sorting, true, true, false)).Select(a => (this.DeserializeRedisValueInternal(a.member), a.dist, a.longitude, a.latitude)).ToArray(); /// @@ -3888,7 +3897,7 @@ public T[] GeoRadius(string key, double longitude, double latitude, double ra /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public string[] GeoRadiusByMember(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public string[] GeoRadiusByMember(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusByMember(k, member, radius, unit, count, sorting, false, false, false)).Select(a => a.member).ToArray(); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -3900,7 +3909,7 @@ public string[] GeoRadiusByMember(string key, object member, double radius, GeoU /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public T[] GeoRadiusByMember(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public T[] GeoRadiusByMember(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => this.DeserializeRedisValueArrayInternal(ExecuteScalar(key, (c, k) => c.Value.GeoRadiusBytesByMember(k, member, radius, unit, count, sorting, false, false, false)).Select(a => a.member).ToArray()); /// @@ -3913,7 +3922,7 @@ public T[] GeoRadiusByMember(string key, object member, double radius, GeoUni /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public (string member, double dist)[] GeoRadiusByMemberWithDist(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public (string member, decimal dist)[] GeoRadiusByMemberWithDist(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusByMember(k, member, radius, unit, count, sorting, false, true, false)).Select(a => (a.member, a.dist)).ToArray(); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离)。 @@ -3925,7 +3934,7 @@ public T[] GeoRadiusByMember(string key, object member, double radius, GeoUni /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public (T member, double dist)[] GeoRadiusByMemberWithDist(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public (T member, decimal dist)[] GeoRadiusByMemberWithDist(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusBytesByMember(k, member, radius, unit, count, sorting, false, true, false)).Select(a => (this.DeserializeRedisValueInternal(a.member), a.dist)).ToArray(); /// @@ -3938,7 +3947,7 @@ public T[] GeoRadiusByMember(string key, object member, double radius, GeoUni /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - private (string member, double longitude, double latitude)[] GeoRadiusByMemberWithCoord(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + private (string member, decimal longitude, decimal latitude)[] GeoRadiusByMemberWithCoord(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusByMember(k, member, radius, unit, count, sorting, true, false, false)).Select(a => (a.member, a.longitude, a.latitude)).ToArray(); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含经度、纬度)。 @@ -3950,7 +3959,7 @@ public T[] GeoRadiusByMember(string key, object member, double radius, GeoUni /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - private (T member, double longitude, double latitude)[] GeoRadiusByMemberWithCoord(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + private (T member, decimal longitude, decimal latitude)[] GeoRadiusByMemberWithCoord(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusBytesByMember(k, member, radius, unit, count, sorting, true, false, false)).Select(a => (this.DeserializeRedisValueInternal(a.member), a.longitude, a.latitude)).ToArray(); /// @@ -3963,7 +3972,7 @@ public T[] GeoRadiusByMember(string key, object member, double radius, GeoUni /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public (string member, double dist, double longitude, double latitude)[] GeoRadiusByMemberWithDistAndCoord(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public (string member, decimal dist, decimal longitude, decimal latitude)[] GeoRadiusByMemberWithDistAndCoord(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusByMember(k, member, radius, unit, count, sorting, true, true, false)).Select(a => (a.member, a.dist, a.longitude, a.latitude)).ToArray(); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离、经度、纬度)。 @@ -3975,7 +3984,7 @@ public T[] GeoRadiusByMember(string key, object member, double radius, GeoUni /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public (T member, double dist, double longitude, double latitude)[] GeoRadiusByMemberWithDistAndCoord(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public (T member, decimal dist, decimal longitude, decimal latitude)[] GeoRadiusByMemberWithDistAndCoord(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => ExecuteScalar(key, (c, k) => c.Value.GeoRadiusBytesByMember(k, member, radius, unit, count, sorting, true, true, false)).Select(a => (this.DeserializeRedisValueInternal(a.member), a.dist, a.longitude, a.latitude)).ToArray(); #endregion diff --git a/src/CSRedisClientAsync.cs b/src/CSRedisClientAsync.cs index 3f6dea5..50a3a18 100644 --- a/src/CSRedisClientAsync.cs +++ b/src/CSRedisClientAsync.cs @@ -839,28 +839,28 @@ async public Task PfAddAsync(string key, params T[] elements) /// 不含prefix前辍 /// 数量 /// - async public Task<(string member, double score)[]> ZPopMaxAsync(string key, long count) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZPopMaxAsync(k, count))).Select(a => (a.Item1, a.Item2)).ToArray(); + async public Task<(string member, decimal score)[]> ZPopMaxAsync(string key, long count) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZPopMaxAsync(k, count))).Select(a => (a.Item1, a.Item2)).ToArray(); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最高得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最高的元素将是第一个元素,然后是分数较低的元素。 /// /// 不含prefix前辍 /// 数量 /// - async public Task<(T member, double score)[]> ZPopMaxAsync(string key, long count) => this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZPopMaxBytesAsync(k, count))); + async public Task<(T member, decimal score)[]> ZPopMaxAsync(string key, long count) => this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZPopMaxBytesAsync(k, count))); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最低得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最低的元素将是第一个元素,然后是分数较高的元素。 /// /// 不含prefix前辍 /// 数量 /// - async public Task<(string member, double score)[]> ZPopMinAsync(string key, long count) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZPopMinAsync(k, count))).Select(a => (a.Item1, a.Item2)).ToArray(); + async public Task<(string member, decimal score)[]> ZPopMinAsync(string key, long count) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZPopMinAsync(k, count))).Select(a => (a.Item1, a.Item2)).ToArray(); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最低得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最低的元素将是第一个元素,然后是分数较高的元素。 /// /// 不含prefix前辍 /// 数量 /// - async public Task<(T member, double score)[]> ZPopMinAsync(string key, long count) => this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZPopMinBytesAsync(k, count))); + async public Task<(T member, decimal score)[]> ZPopMinAsync(string key, long count) => this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZPopMinBytesAsync(k, count))); /// /// 向有序集合添加一个或多个成员,或者更新已存在成员的分数 @@ -868,10 +868,10 @@ async public Task PfAddAsync(string key, params T[] elements) /// 不含prefix前辍 /// 一个或多个成员分数 /// - async public Task ZAddAsync(string key, params (double, object)[] scoreMembers) + async public Task ZAddAsync(string key, params (decimal, object)[] scoreMembers) { if (scoreMembers == null || scoreMembers.Any() == false) return 0; - var args = scoreMembers.Select(a => new Tuple(a.Item1, this.SerializeRedisValueInternal(a.Item2))).ToArray(); + var args = scoreMembers.Select(a => new Tuple(a.Item1, this.SerializeRedisValueInternal(a.Item2))).ToArray(); return await ExecuteScalarAsync(key, (c, k) => c.Value.ZAddAsync(k, args)); } /// @@ -884,10 +884,10 @@ async public Task ZAddAsync(string key, params (double, object)[] scoreMem /// 计算在有序集合中指定区间分数的成员数量 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public Task ZCountAsync(string key, double min, double max) => ExecuteScalarAsync(key, (c, k) => c.Value.ZCountAsync(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString())); + public Task ZCountAsync(string key, decimal min, decimal max) => ExecuteScalarAsync(key, (c, k) => c.Value.ZCountAsync(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString())); /// /// 计算在有序集合中指定区间分数的成员数量 /// @@ -903,7 +903,7 @@ async public Task ZAddAsync(string key, params (double, object)[] scoreMem /// 成员 /// 增量值(默认=1) /// - public Task ZIncrByAsync(string key, string member, double increment = 1) + public Task ZIncrByAsync(string key, string member, decimal increment = 1) { var args = this.SerializeRedisValueInternal(member); return ExecuteScalarAsync(key, (c, k) => c.Value.ZIncrByAsync(k, increment, args)); @@ -917,7 +917,7 @@ public Task ZIncrByAsync(string key, string member, double increment = 1 /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public Task ZInterStoreAsync(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) + public Task ZInterStoreAsync(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) { if (keys == null || keys.Length == 0) throw new Exception("keys 参数不可为空"); if (weights != null && weights.Length != keys.Length) throw new Exception("weights 和 keys 参数长度必须相同"); @@ -948,7 +948,7 @@ public Task ZInterStoreAsync(string destination, double[] weights, RedisAg /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - async public Task<(string member, double score)[]> ZRangeWithScoresAsync(string key, long start, long stop) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeWithScoresAsync(k, start, stop))).Select(a => (a.Item1, a.Item2)).ToArray(); + async public Task<(string member, decimal score)[]> ZRangeWithScoresAsync(string key, long start, long stop) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeWithScoresAsync(k, start, stop))).Select(a => (a.Item1, a.Item2)).ToArray(); /// /// 通过索引区间返回有序集合成指定区间内的成员和分数 /// @@ -957,31 +957,31 @@ public Task ZInterStoreAsync(string destination, double[] weights, RedisAg /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - async public Task<(T member, double score)[]> ZRangeWithScoresAsync(string key, long start, long stop) => this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeBytesWithScoresAsync(k, start, stop))); + async public Task<(T member, decimal score)[]> ZRangeWithScoresAsync(string key, long start, long stop) => this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeBytesWithScoresAsync(k, start, stop))); /// /// 通过分数返回有序集合指定区间内的成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public Task ZRangeByScoreAsync(string key, double min, double max, long? count = null, long offset = 0) => - ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeByScoreAsync(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), false, offset, count)); + public Task ZRangeByScoreAsync(string key, decimal min, decimal max, long? count = null, long offset = 0) => + ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeByScoreAsync(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), false, offset, count)); /// /// 通过分数返回有序集合指定区间内的成员 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task ZRangeByScoreAsync(string key, double min, double max, long? count = null, long offset = 0) => - this.DeserializeRedisValueArrayInternal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeBytesByScoreAsync(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), false, offset, count))); + async public Task ZRangeByScoreAsync(string key, decimal min, decimal max, long? count = null, long offset = 0) => + this.DeserializeRedisValueArrayInternal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeBytesByScoreAsync(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), false, offset, count))); /// /// 通过分数返回有序集合指定区间内的成员 /// @@ -1010,25 +1010,25 @@ async public Task ZRangeByScoreAsync(string key, string min, string max, /// 通过分数返回有序集合指定区间内的成员和分数 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task<(string member, double score)[]> ZRangeByScoreWithScoresAsync(string key, double min, double max, long? count = null, long offset = 0) => - (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeByScoreWithScoresAsync(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), offset, count))).Select(z => (z.Item1, z.Item2)).ToArray(); + async public Task<(string member, decimal score)[]> ZRangeByScoreWithScoresAsync(string key, decimal min, decimal max, long? count = null, long offset = 0) => + (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeByScoreWithScoresAsync(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), offset, count))).Select(z => (z.Item1, z.Item2)).ToArray(); /// /// 通过分数返回有序集合指定区间内的成员和分数 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task<(T member, double score)[]> ZRangeByScoreWithScoresAsync(string key, double min, double max, long? count = null, long offset = 0) => - this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeBytesByScoreWithScoresAsync(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), offset, count))); + async public Task<(T member, decimal score)[]> ZRangeByScoreWithScoresAsync(string key, decimal min, decimal max, long? count = null, long offset = 0) => + this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeBytesByScoreWithScoresAsync(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), offset, count))); /// /// 通过分数返回有序集合指定区间内的成员和分数 /// @@ -1038,7 +1038,7 @@ async public Task ZRangeByScoreAsync(string key, string min, string max, /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task<(string member, double score)[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? count = null, long offset = 0) => + async public Task<(string member, decimal score)[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? count = null, long offset = 0) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeByScoreWithScoresAsync(k, min, max, offset, count))).Select(z => (z.Item1, z.Item2)).ToArray(); /// /// 通过分数返回有序集合指定区间内的成员和分数 @@ -1050,8 +1050,8 @@ async public Task ZRangeByScoreAsync(string key, string min, string max, /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task<(T member, double score)[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? count = null, long offset = 0) => - this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeBytesByScoreWithScoresAsync(k, min, max, offset, count))); + async public Task<(T member, decimal score)[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? count = null, long offset = 0) => + this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRangeBytesByScoreWithScoresAsync(k, min, max, offset, count))); /// /// 返回有序集合中指定成员的索引 @@ -1088,10 +1088,10 @@ async public Task ZRemAsync(string key, params T[] member) /// 移除有序集合中给定的分数区间的所有成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public Task ZRemRangeByScoreAsync(string key, double min, double max) => ExecuteScalarAsync(key, (c, k) => c.Value.ZRemRangeByScoreAsync(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString())); + public Task ZRemRangeByScoreAsync(string key, decimal min, decimal max) => ExecuteScalarAsync(key, (c, k) => c.Value.ZRemRangeByScoreAsync(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString())); /// /// 移除有序集合中给定的分数区间的所有成员 /// @@ -1125,7 +1125,7 @@ async public Task ZRemAsync(string key, params T[] member) /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - async public Task<(string member, double score)[]> ZRevRangeWithScoresAsync(string key, long start, long stop) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeWithScoresAsync(k, start, stop))).Select(a => (a.Item1, a.Item2)).ToArray(); + async public Task<(string member, decimal score)[]> ZRevRangeWithScoresAsync(string key, long start, long stop) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeWithScoresAsync(k, start, stop))).Select(a => (a.Item1, a.Item2)).ToArray(); /// /// 返回有序集中指定区间内的成员和分数,通过索引,分数从高到底 /// @@ -1134,30 +1134,30 @@ async public Task ZRemAsync(string key, params T[] member) /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - async public Task<(T member, double score)[]> ZRevRangeWithScoresAsync(string key, long start, long stop) => this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeBytesWithScoresAsync(k, start, stop))); + async public Task<(T member, decimal score)[]> ZRevRangeWithScoresAsync(string key, long start, long stop) => this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeBytesWithScoresAsync(k, start, stop))); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public Task ZRevRangeByScoreAsync(string key, double max, double min, long? count = null, long? offset = 0) => ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeByScoreAsync(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), false, offset, count)); + public Task ZRevRangeByScoreAsync(string key, decimal max, decimal min, long? count = null, long? offset = 0) => ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeByScoreAsync(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), false, offset, count)); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task ZRevRangeByScoreAsync(string key, double max, double min, long? count = null, long offset = 0) => - this.DeserializeRedisValueArrayInternal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeBytesByScoreAsync(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), false, offset, count))); + async public Task ZRevRangeByScoreAsync(string key, decimal max, decimal min, long? count = null, long offset = 0) => + this.DeserializeRedisValueArrayInternal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeBytesByScoreAsync(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), false, offset, count))); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// @@ -1185,25 +1185,25 @@ async public Task ZRevRangeByScoreAsync(string key, string max, string m /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task<(string member, double score)[]> ZRevRangeByScoreWithScoresAsync(string key, double max, double min, long? count = null, long offset = 0) => - (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeByScoreWithScoresAsync(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), offset, count))).Select(z => (z.Item1, z.Item2)).ToArray(); + async public Task<(string member, decimal score)[]> ZRevRangeByScoreWithScoresAsync(string key, decimal max, decimal min, long? count = null, long offset = 0) => + (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeByScoreWithScoresAsync(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), offset, count))).Select(z => (z.Item1, z.Item2)).ToArray(); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task<(T member, double score)[]> ZRevRangeByScoreWithScoresAsync(string key, double max, double min, long? count = null, long offset = 0) => - this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeBytesByScoreWithScoresAsync(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), offset, count))); + async public Task<(T member, decimal score)[]> ZRevRangeByScoreWithScoresAsync(string key, decimal max, decimal min, long? count = null, long offset = 0) => + this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeBytesByScoreWithScoresAsync(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), offset, count))); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// @@ -1213,7 +1213,7 @@ async public Task ZRevRangeByScoreAsync(string key, string max, string m /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task<(string member, double score)[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? count = null, long offset = 0) => + async public Task<(string member, decimal score)[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? count = null, long offset = 0) => (await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeByScoreWithScoresAsync(k, max, min, offset, count))).Select(z => (z.Item1, z.Item2)).ToArray(); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 @@ -1225,8 +1225,8 @@ async public Task ZRevRangeByScoreAsync(string key, string max, string m /// 返回多少成员 /// 返回条件偏移位置 /// - async public Task<(T member, double score)[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? count = null, long offset = 0) => - this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeBytesByScoreWithScoresAsync(k, max, min, offset, count))); + async public Task<(T member, decimal score)[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? count = null, long offset = 0) => + this.DeserializeRedisValueTuple1Internal(await ExecuteScalarAsync(key, (c, k) => c.Value.ZRevRangeBytesByScoreWithScoresAsync(k, max, min, offset, count))); /// /// 返回有序集合中指定成员的排名,有序集成员按分数值递减(从大到小)排序 @@ -1245,7 +1245,7 @@ async public Task ZRevRangeByScoreAsync(string key, string max, string m /// 不含prefix前辍 /// 成员 /// - public Task ZScoreAsync(string key, object member) + public Task ZScoreAsync(string key, object member) { var args = this.SerializeRedisValueInternal(member); return ExecuteScalarAsync(key, (c, k) => c.Value.ZScoreAsync(k, args)); @@ -1259,7 +1259,7 @@ async public Task ZRevRangeByScoreAsync(string key, string max, string m /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public Task ZUnionStoreAsync(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) + public Task ZUnionStoreAsync(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) { if (keys == null || keys.Length == 0) throw new Exception("keys 参数不可为空"); if (weights != null && weights.Length != keys.Length) throw new Exception("weights 和 keys 参数长度必须相同"); @@ -1274,10 +1274,10 @@ public Task ZUnionStoreAsync(string destination, double[] weights, RedisAg /// 模式 /// 数量 /// - async public Task> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) + async public Task> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) { var scan = await ExecuteScalarAsync(key, (c, k) => c.Value.ZScanAsync(k, cursor, pattern, count)); - return new RedisScan<(string, double)>(scan.Cursor, scan.Items.Select(z => (z.Item1, z.Item2)).ToArray()); + return new RedisScan<(string, decimal)>(scan.Cursor, scan.Items.Select(z => (z.Item1, z.Item2)).ToArray()); } /// /// 迭代有序集合中的元素 @@ -1288,10 +1288,10 @@ public Task ZUnionStoreAsync(string destination, double[] weights, RedisAg /// 模式 /// 数量 /// - async public Task> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) + async public Task> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) { var scan = await ExecuteScalarAsync(key, (c, k) => c.Value.ZScanBytesAsync(k, cursor, pattern, count)); - return new RedisScan<(T, double)>(scan.Cursor, this.DeserializeRedisValueTuple1Internal(scan.Items)); + return new RedisScan<(T, decimal)>(scan.Cursor, this.DeserializeRedisValueTuple1Internal(scan.Items)); } /// @@ -1813,7 +1813,7 @@ async public Task HDelAsync(string key, params string[] fields) => fields /// 字段 /// 增量值(默认=1) /// - public Task HIncrByFloatAsync(string key, string field, double value) => ExecuteScalarAsync(key, (c, k) => c.Value.HIncrByFloatAsync(k, field, value)); + public Task HIncrByFloatAsync(string key, string field, decimal value) => ExecuteScalarAsync(key, (c, k) => c.Value.HIncrByFloatAsync(k, field, value)); /// /// 获取所有哈希表中的字段 /// @@ -2045,7 +2045,7 @@ async public Task GetSetAsync(string key, object value) /// 不含prefix前辍 /// 增量值(默认=1) /// - public Task IncrByFloatAsync(string key, double value) => ExecuteScalarAsync(key, (c, k) => c.Value.IncrByFloatAsync(k, value)); + public Task IncrByFloatAsync(string key, decimal value) => ExecuteScalarAsync(key, (c, k) => c.Value.IncrByFloatAsync(k, value)); /// /// 获取多个指定 key 的值(数组) /// @@ -2116,6 +2116,15 @@ async public Task SetAsync(string key, object value, int expireSeconds = - if (expireSeconds > 0 && exists != null) return await ExecuteScalarAsync(key, (c, k) => c.Value.SetAsync(k, redisValule, expireSeconds, exists)) == "OK"; return false; } + async public Task SetAsync(string key, object value, TimeSpan expire, RedisExistence? exists = null) + { + object redisValule = this.SerializeRedisValueInternal(value); + if (expire <= TimeSpan.Zero && exists == null) return await ExecuteScalar(key, (c, k) => c.Value.SetAsync(k, redisValule)) == "OK"; + if (expire <= TimeSpan.Zero && exists != null) return await ExecuteScalar(key, (c, k) => c.Value.SetAsync(k, redisValule, null, exists)) == "OK"; + if (expire > TimeSpan.Zero && exists == null) return await ExecuteScalar(key, (c, k) => c.Value.SetAsync(k, redisValule, expire, null)) == "OK"; + if (expire > TimeSpan.Zero && exists != null) return await ExecuteScalar(key, (c, k) => c.Value.SetAsync(k, redisValule, expire, exists)) == "OK"; + return false; + } /// /// 对 key 所储存的字符串值,设置或清除指定偏移量上的位(bit) /// @@ -2414,14 +2423,14 @@ async public Task> ScanAsync(long cursor, string pattern = null, /// 纬度 /// 成员 /// 是否成功 - async public Task GeoAddAsync(string key, double longitude, double latitude, object member) => await GeoAddAsync(key, (longitude, latitude, member)) == 1; + async public Task GeoAddAsync(string key, decimal longitude, decimal latitude, object member) => await GeoAddAsync(key, (longitude, latitude, member)) == 1; /// /// 将指定的地理空间位置(纬度、经度、成员)添加到指定的key中。这些数据将会存储到sorted set这样的目的是为了方便使用GEORADIUS或者GEORADIUSBYMEMBER命令对数据进行半径查询等操作。 /// /// 不含prefix前辍 /// 批量添加的值 /// 添加到sorted set元素的数目,但不包括已更新score的元素。 - async public Task GeoAddAsync(string key, params (double longitude, double latitude, object member)[] values) + async public Task GeoAddAsync(string key, params (decimal longitude, decimal latitude, object member)[] values) { if (values == null || values.Any() == false) return 0; var args = values.Select(z => (z.longitude, z.latitude, this.SerializeRedisValueInternal(z.member))).ToArray(); @@ -2435,7 +2444,7 @@ async public Task GeoAddAsync(string key, params (double longitude, double /// 成员2 /// m 表示单位为米;km 表示单位为千米;mi 表示单位为英里;ft 表示单位为英尺; /// 计算出的距离会以双精度浮点数的形式被返回。 如果给定的位置元素不存在, 那么命令返回空值。 - public Task GeoDistAsync(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) + public Task GeoDistAsync(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) { var args1 = this.SerializeRedisValueInternal(member1); var args2 = this.SerializeRedisValueInternal(member2); @@ -2459,9 +2468,9 @@ async public Task GeoHashAsync(string key, object[] members) /// 不含prefix前辍 /// 多个查询的成员 /// GEOPOS 命令返回一个数组, 数组中的每个项都由两个元素组成: 第一个元素为给定位置元素的经度, 而第二个元素则为给定位置元素的纬度。当给定的位置元素不存在时, 对应的数组项为空值。 - async public Task<(double longitude, double latitude)?[]> GeoPosAsync(string key, object[] members) + async public Task<(decimal longitude, decimal latitude)?[]> GeoPosAsync(string key, object[] members) { - if (members == null || members.Any() == false) return new (double, double)?[0]; + if (members == null || members.Any() == false) return new (decimal, decimal)?[0]; var args = members.Select(z => this.SerializeRedisValueInternal(z)).ToArray(); return await ExecuteScalarAsync(key, (c, k) => c.Value.GeoPosAsync(k, args)); } @@ -2477,7 +2486,7 @@ async public Task GeoHashAsync(string key, object[] members) /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task GeoRadiusAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task GeoRadiusAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusAsync(k, longitude, latitude, radius, unit, count, sorting, false, false, false))).Select(a => a.member).ToArray(); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -2490,7 +2499,7 @@ async public Task GeoRadiusAsync(string key, double longitude, double /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task GeoRadiusAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task GeoRadiusAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusBytesAsync(k, longitude, latitude, radius, unit, count, sorting, false, false, false))).Select(a => this.DeserializeRedisValueInternal(a.member)).ToArray(); /// @@ -2504,7 +2513,7 @@ async public Task GeoRadiusAsync(string key, double longitude, double la /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task<(string member, double dist)[]> GeoRadiusWithDistAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task<(string member, decimal dist)[]> GeoRadiusWithDistAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusAsync(k, longitude, latitude, radius, unit, count, sorting, false, true, false))).Select(a => (a.member, a.dist)).ToArray(); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离)。 @@ -2517,7 +2526,7 @@ async public Task GeoRadiusAsync(string key, double longitude, double la /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task<(T member, double dist)[]> GeoRadiusWithDistAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task<(T member, decimal dist)[]> GeoRadiusWithDistAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusBytesAsync(k, longitude, latitude, radius, unit, count, sorting, false, true, false))).Select(a => (this.DeserializeRedisValueInternal(a.member), a.dist)).ToArray(); /// @@ -2531,7 +2540,7 @@ async public Task GeoRadiusAsync(string key, double longitude, double la /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async private Task<(string member, double longitude, double latitude)[]> GeoRadiusWithCoordAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async private Task<(string member, decimal longitude, decimal latitude)[]> GeoRadiusWithCoordAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusAsync(k, longitude, latitude, radius, unit, count, sorting, true, false, false))).Select(a => (a.member, a.longitude, a.latitude)).ToArray(); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含经度、纬度)。 @@ -2544,7 +2553,7 @@ async public Task GeoRadiusAsync(string key, double longitude, double la /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async private Task<(T member, double longitude, double latitude)[]> GeoRadiusWithCoordAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async private Task<(T member, decimal longitude, decimal latitude)[]> GeoRadiusWithCoordAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusBytesAsync(k, longitude, latitude, radius, unit, count, sorting, true, false, false))).Select(a => (this.DeserializeRedisValueInternal(a.member), a.longitude, a.latitude)).ToArray(); /// @@ -2558,7 +2567,7 @@ async public Task GeoRadiusAsync(string key, double longitude, double la /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task<(string member, double dist, double longitude, double latitude)[]> GeoRadiusWithDistAndCoordAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task<(string member, decimal dist, decimal longitude, decimal latitude)[]> GeoRadiusWithDistAndCoordAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusAsync(k, longitude, latitude, radius, unit, count, sorting, true, true, false))).Select(a => (a.member, a.dist, a.longitude, a.latitude)).ToArray(); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离、经度、纬度)。 @@ -2571,7 +2580,7 @@ async public Task GeoRadiusAsync(string key, double longitude, double la /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task<(T member, double dist, double longitude, double latitude)[]> GeoRadiusWithDistAndCoordAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task<(T member, decimal dist, decimal longitude, decimal latitude)[]> GeoRadiusWithDistAndCoordAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusBytesAsync(k, longitude, latitude, radius, unit, count, sorting, true, true, false))).Select(a => (this.DeserializeRedisValueInternal(a.member), a.dist, a.longitude, a.latitude)).ToArray(); /// @@ -2584,7 +2593,7 @@ async public Task GeoRadiusAsync(string key, double longitude, double la /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task GeoRadiusByMemberAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task GeoRadiusByMemberAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusByMemberAsync(k, member, radius, unit, count, sorting, false, false, false))).Select(a => a.member).ToArray(); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -2596,7 +2605,7 @@ async public Task GeoRadiusByMemberAsync(string key, object member, do /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task GeoRadiusByMemberAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task GeoRadiusByMemberAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusBytesByMemberAsync(k, member, radius, unit, count, sorting, false, false, false))).Select(a => this.DeserializeRedisValueInternal(a.member)).ToArray(); /// @@ -2609,7 +2618,7 @@ async public Task GeoRadiusByMemberAsync(string key, object member, doub /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task<(string member, double dist)[]> GeoRadiusByMemberWithDistAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task<(string member, decimal dist)[]> GeoRadiusByMemberWithDistAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusByMemberAsync(k, member, radius, unit, count, sorting, false, true, false))).Select(a => (a.member, a.dist)).ToArray(); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离)。 @@ -2621,7 +2630,7 @@ async public Task GeoRadiusByMemberAsync(string key, object member, doub /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task<(T member, double dist)[]> GeoRadiusByMemberWithDistAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task<(T member, decimal dist)[]> GeoRadiusByMemberWithDistAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusBytesByMemberAsync(k, member, radius, unit, count, sorting, false, true, false))).Select(a => (this.DeserializeRedisValueInternal(a.member), a.dist)).ToArray(); /// @@ -2634,7 +2643,7 @@ async public Task GeoRadiusByMemberAsync(string key, object member, doub /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async private Task<(string member, double longitude, double latitude)[]> GeoRadiusByMemberWithCoordAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async private Task<(string member, decimal longitude, decimal latitude)[]> GeoRadiusByMemberWithCoordAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusByMemberAsync(k, member, radius, unit, count, sorting, true, false, false))).Select(a => (a.member, a.longitude, a.latitude)).ToArray(); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含经度、纬度)。 @@ -2646,7 +2655,7 @@ async public Task GeoRadiusByMemberAsync(string key, object member, doub /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async private Task<(T member, double longitude, double latitude)[]> GeoRadiusByMemberWithCoordAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async private Task<(T member, decimal longitude, decimal latitude)[]> GeoRadiusByMemberWithCoordAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusBytesByMemberAsync(k, member, radius, unit, count, sorting, true, false, false))).Select(a => (this.DeserializeRedisValueInternal(a.member), a.longitude, a.latitude)).ToArray(); /// @@ -2659,7 +2668,7 @@ async public Task GeoRadiusByMemberAsync(string key, object member, doub /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task<(string member, double dist, double longitude, double latitude)[]> GeoRadiusByMemberWithDistAndCoordAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task<(string member, decimal dist, decimal longitude, decimal latitude)[]> GeoRadiusByMemberWithDistAndCoordAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusByMemberAsync(k, member, radius, unit, count, sorting, true, true, false))).Select(a => (a.member, a.dist, a.longitude, a.latitude)).ToArray(); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离、经度、纬度)。 @@ -2671,7 +2680,7 @@ async public Task GeoRadiusByMemberAsync(string key, object member, doub /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - async public Task<(T member, double dist, double longitude, double latitude)[]> GeoRadiusByMemberWithDistAndCoordAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + async public Task<(T member, decimal dist, decimal longitude, decimal latitude)[]> GeoRadiusByMemberWithDistAndCoordAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => (await ExecuteScalarAsync(key, (c, k) => c.Value.GeoRadiusBytesByMemberAsync(k, member, radius, unit, count, sorting, true, true, false))).Select(a => (this.DeserializeRedisValueInternal(a.member), a.dist, a.longitude, a.latitude)).ToArray(); #endregion } diff --git a/src/CSRedisClientPipe.cs b/src/CSRedisClientPipe.cs index 1483e0f..8efb461 100644 --- a/src/CSRedisClientPipe.cs +++ b/src/CSRedisClientPipe.cs @@ -193,34 +193,34 @@ public CSRedisClientPipe Publish(string channel, string message) /// 不含prefix前辍 /// 数量 /// - public CSRedisClientPipe<(string member, double score)[]> ZPopMax(string key, long count) => - PipeCommand(key, (c, k) => { c.Value.ZPopMax(k, count); return default((string, double)[]); }, obj => - ((Tuple[])obj).Select(a => (a.Item1, a.Item2)).ToArray()); + public CSRedisClientPipe<(string member, decimal score)[]> ZPopMax(string key, long count) => + PipeCommand(key, (c, k) => { c.Value.ZPopMax(k, count); return default((string, decimal)[]); }, obj => + ((Tuple[])obj).Select(a => (a.Item1, a.Item2)).ToArray()); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最高得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最高的元素将是第一个元素,然后是分数较低的元素。 /// /// 不含prefix前辍 /// 数量 /// - public CSRedisClientPipe<(T member, double score)[]> ZPopMax(string key, long count) => - PipeCommand(key, (c, k) => { c.Value.ZPopMaxBytes(k, count); return default((T member, double score)[]); }, obj => rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); + public CSRedisClientPipe<(T member, decimal score)[]> ZPopMax(string key, long count) => + PipeCommand(key, (c, k) => { c.Value.ZPopMaxBytes(k, count); return default((T member, decimal score)[]); }, obj => rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最低得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最低的元素将是第一个元素,然后是分数较高的元素。 /// /// 不含prefix前辍 /// 数量 /// - public CSRedisClientPipe<(string member, double score)[]> ZPopMin(string key, long count) => - PipeCommand(key, (c, k) => { c.Value.ZPopMin(k, count); return default((string, double)[]); }, obj => - ((Tuple[])obj).Select(a => (a.Item1, a.Item2)).ToArray()); + public CSRedisClientPipe<(string member, decimal score)[]> ZPopMin(string key, long count) => + PipeCommand(key, (c, k) => { c.Value.ZPopMin(k, count); return default((string, decimal)[]); }, obj => + ((Tuple[])obj).Select(a => (a.Item1, a.Item2)).ToArray()); /// /// [redis-server 5.0.0] 删除并返回有序集合key中的最多count个具有最低得分的成员。如未指定,count的默认值为1。指定一个大于有序集合的基数的count不会产生错误。 当返回多个元素时候,得分最低的元素将是第一个元素,然后是分数较高的元素。 /// /// 不含prefix前辍 /// 数量 /// - public CSRedisClientPipe<(T member, double score)[]> ZPopMin(string key, long count) => - PipeCommand(key, (c, k) => { c.Value.ZPopMinBytes(k, count); return default((T member, double score)[]); }, obj => rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); + public CSRedisClientPipe<(T member, decimal score)[]> ZPopMin(string key, long count) => + PipeCommand(key, (c, k) => { c.Value.ZPopMinBytes(k, count); return default((T member, decimal score)[]); }, obj => rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); /// /// 向有序集合添加一个或多个成员,或者更新已存在成员的分数 @@ -228,10 +228,10 @@ public CSRedisClientPipe Publish(string channel, string message) /// 不含prefix前辍 /// 一个或多个成员分数 /// - public CSRedisClientPipe ZAdd(string key, params (double, object)[] scoreMembers) + public CSRedisClientPipe ZAdd(string key, params (decimal, object)[] scoreMembers) { if (scoreMembers == null || scoreMembers.Any() == false) throw new Exception("scoreMembers 参数不可为空"); - var ms = scoreMembers.Select(a => new Tuple(a.Item1, rds.SerializeRedisValueInternal(a.Item2))).ToArray(); + var ms = scoreMembers.Select(a => new Tuple(a.Item1, rds.SerializeRedisValueInternal(a.Item2))).ToArray(); return PipeCommand(key, (c, k) => c.Value.ZAdd(k, ms)); } /// @@ -244,10 +244,10 @@ public CSRedisClientPipe ZAdd(string key, params (double, object)[] scoreM /// 计算在有序集合中指定区间分数的成员数量 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public CSRedisClientPipe ZCount(string key, double min, double max) => PipeCommand(key, (c, k) => c.Value.ZCount(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString())); + public CSRedisClientPipe ZCount(string key, decimal min, decimal max) => PipeCommand(key, (c, k) => c.Value.ZCount(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString())); /// /// 计算在有序集合中指定区间分数的成员数量 /// @@ -263,7 +263,7 @@ public CSRedisClientPipe ZAdd(string key, params (double, object)[] scoreM /// 成员 /// 增量值(默认=1) /// - public CSRedisClientPipe ZIncrBy(string key, string member, double increment = 1) => PipeCommand(key, (c, k) => c.Value.ZIncrBy(k, increment, member)); + public CSRedisClientPipe ZIncrBy(string key, string member, decimal increment = 1) => PipeCommand(key, (c, k) => c.Value.ZIncrBy(k, increment, member)); /// /// 计算给定的一个或多个有序集的交集,将结果集存储在新的有序集合 destination 中 @@ -273,7 +273,7 @@ public CSRedisClientPipe ZAdd(string key, params (double, object)[] scoreM /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public CSRedisClientPipe ZInterStore(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) + public CSRedisClientPipe ZInterStore(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) { if (keys == null || keys.Length == 0) throw new Exception("keys 参数不可为空"); if (weights != null && weights.Length != keys.Length) throw new Exception("weights 和 keys 参数长度必须相同"); @@ -307,9 +307,9 @@ public CSRedisClientPipe ZRange(string key, long start, long stop) => /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public CSRedisClientPipe<(string member, double score)[]> ZRangeWithScores(string key, long start, long stop) => - PipeCommand(key, (c, k) => { c.Value.ZRangeWithScores(k, start, stop); return default((string, double)[]); }, obj => - ((Tuple[])obj).Select(a => (a.Item1, a.Item2)).ToArray()); + public CSRedisClientPipe<(string member, decimal score)[]> ZRangeWithScores(string key, long start, long stop) => + PipeCommand(key, (c, k) => { c.Value.ZRangeWithScores(k, start, stop); return default((string, decimal)[]); }, obj => + ((Tuple[])obj).Select(a => (a.Item1, a.Item2)).ToArray()); /// /// 通过索引区间返回有序集合成指定区间内的成员和分数 /// @@ -318,32 +318,32 @@ public CSRedisClientPipe ZRange(string key, long start, long stop) => /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public CSRedisClientPipe<(T member, double score)[]> ZRangeWithScores(string key, long start, long stop) => - PipeCommand(key, (c, k) => { c.Value.ZRangeBytesWithScores(k, start, stop); return default((T member, double score)[]); }, obj => rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); + public CSRedisClientPipe<(T member, decimal score)[]> ZRangeWithScores(string key, long start, long stop) => + PipeCommand(key, (c, k) => { c.Value.ZRangeBytesWithScores(k, start, stop); return default((T member, decimal score)[]); }, obj => rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); /// /// 通过分数返回有序集合指定区间内的成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe ZRangeByScore(string key, double min, double max, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => c.Value.ZRangeByScore(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), false, offset, count)); + public CSRedisClientPipe ZRangeByScore(string key, decimal min, decimal max, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => c.Value.ZRangeByScore(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), false, offset, count)); /// /// 通过分数返回有序集合指定区间内的成员 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe ZRangeByScore(string key, double min, double max, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRangeBytesByScore(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), false, offset, count); return default(T[]); }, obj => + public CSRedisClientPipe ZRangeByScore(string key, decimal min, decimal max, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRangeBytesByScore(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), false, offset, count); return default(T[]); }, obj => rds.DeserializeRedisValueArrayInternal((byte[][])obj)); /// /// 通过分数返回有序集合指定区间内的成员 @@ -374,27 +374,27 @@ public CSRedisClientPipe ZRangeByScore(string key, string min, string ma /// 通过分数返回有序集合指定区间内的成员和分数 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe<(string member, double score)[]> ZRangeByScoreWithScores(string key, double min, double max, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRangeByScoreWithScores(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), offset, count); return default((string, double)[]); }, obj => - ((Tuple[])obj).Select(z => (z.Item1, z.Item2))); + public CSRedisClientPipe<(string member, decimal score)[]> ZRangeByScoreWithScores(string key, decimal min, decimal max, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRangeByScoreWithScores(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), offset, count); return default((string, decimal)[]); }, obj => + ((Tuple[])obj).Select(z => (z.Item1, z.Item2))); /// /// 通过分数返回有序集合指定区间内的成员和分数 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe<(T member, double score)[]> ZRangeByScoreWithScores(string key, double min, double max, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRangeBytesByScoreWithScores(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString(), offset, count); return default((T, double)[]); }, obj => - rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); + public CSRedisClientPipe<(T member, decimal score)[]> ZRangeByScoreWithScores(string key, decimal min, decimal max, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRangeBytesByScoreWithScores(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString(), offset, count); return default((T, decimal)[]); }, obj => + rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); /// /// 通过分数返回有序集合指定区间内的成员和分数 /// @@ -404,7 +404,7 @@ public CSRedisClientPipe ZRangeByScore(string key, string min, string ma /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe<(string member, double score)[]> ZRangeByScoreWithScores(string key, string min, string max, long? count = null, long offset = 0) => + public CSRedisClientPipe<(string member, decimal score)[]> ZRangeByScoreWithScores(string key, string min, string max, long? count = null, long offset = 0) => PipeCommand(key, (c, k) => c.Value.ZRangeByScoreWithScores(k, min, max, offset, count).Select(z => (z.Item1, z.Item2)).ToArray()); /// /// 通过分数返回有序集合指定区间内的成员和分数 @@ -416,9 +416,9 @@ public CSRedisClientPipe ZRangeByScore(string key, string min, string ma /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe<(T member, double score)[]> ZRangeByScoreWithScores(string key, string min, string max, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRangeBytesByScoreWithScores(k, min, max, offset, count); return default((T, double)[]); }, obj => - rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); + public CSRedisClientPipe<(T member, decimal score)[]> ZRangeByScoreWithScores(string key, string min, string max, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRangeBytesByScoreWithScores(k, min, max, offset, count); return default((T, decimal)[]); }, obj => + rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); /// /// 返回有序集合中指定成员的索引 @@ -450,10 +450,10 @@ public CSRedisClientPipe ZRem(string key, params T[] member) /// 移除有序集合中给定的分数区间的所有成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public CSRedisClientPipe ZRemRangeByScore(string key, double min, double max) => PipeCommand(key, (c, k) => c.Value.ZRemRangeByScore(k, min == double.MinValue ? "-inf" : min.ToString(), max == double.MaxValue ? "+inf" : max.ToString())); + public CSRedisClientPipe ZRemRangeByScore(string key, decimal min, decimal max) => PipeCommand(key, (c, k) => c.Value.ZRemRangeByScore(k, min == decimal.MinValue ? "-inf" : min.ToString(), max == decimal.MaxValue ? "+inf" : max.ToString())); /// /// 移除有序集合中给定的分数区间的所有成员 /// @@ -489,9 +489,9 @@ public CSRedisClientPipe ZRevRange(string key, long start, long stop) => /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public CSRedisClientPipe<(string member, double score)[]> ZRevRangeWithScores(string key, long start, long stop) => - PipeCommand(key, (c, k) => { c.Value.ZRevRangeWithScores(k, start, stop); return default((string, double)[]); }, obj => - ((Tuple[])obj).Select(a => (a.Item1, a.Item2)).ToArray()); + public CSRedisClientPipe<(string member, decimal score)[]> ZRevRangeWithScores(string key, long start, long stop) => + PipeCommand(key, (c, k) => { c.Value.ZRevRangeWithScores(k, start, stop); return default((string, decimal)[]); }, obj => + ((Tuple[])obj).Select(a => (a.Item1, a.Item2)).ToArray()); /// /// 返回有序集中指定区间内的成员和分数,通过索引,分数从高到底 /// @@ -500,33 +500,33 @@ public CSRedisClientPipe ZRevRange(string key, long start, long stop) => /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public CSRedisClientPipe<(T member, double score)[]> ZRevRangeWithScores(string key, long start, long stop) => - PipeCommand(key, (c, k) => { c.Value.ZRevRangeBytesWithScores(k, start, stop); return default((T, double)[]); }, obj => - rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); + public CSRedisClientPipe<(T member, decimal score)[]> ZRevRangeWithScores(string key, long start, long stop) => + PipeCommand(key, (c, k) => { c.Value.ZRevRangeBytesWithScores(k, start, stop); return default((T, decimal)[]); }, obj => + rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe ZRevRangeByScore(string key, double max, double min, long? count = null, long? offset = 0) => - PipeCommand(key, (c, k) => c.Value.ZRevRangeByScore(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), false, offset, count)); + public CSRedisClientPipe ZRevRangeByScore(string key, decimal max, decimal min, long? count = null, long? offset = 0) => + PipeCommand(key, (c, k) => c.Value.ZRevRangeByScore(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), false, offset, count)); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe ZRevRangeByScore(string key, double max, double min, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRevRangeBytesByScore(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), false, offset, count); return default(T[]); }, obj => + public CSRedisClientPipe ZRevRangeByScore(string key, decimal max, decimal min, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRevRangeBytesByScore(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), false, offset, count); return default(T[]); }, obj => rds.DeserializeRedisValueArrayInternal((byte[][])obj)); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 @@ -557,27 +557,27 @@ public CSRedisClientPipe ZRevRangeByScore(string key, string max, string /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe<(string member, double score)[]> ZRevRangeByScoreWithScores(string key, double max, double min, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRevRangeByScoreWithScores(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), offset, count); return default((string member, double score)[]); }, obj => - ((Tuple[])obj).Select(z => (z.Item1, z.Item2)).ToArray()); + public CSRedisClientPipe<(string member, decimal score)[]> ZRevRangeByScoreWithScores(string key, decimal max, decimal min, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRevRangeByScoreWithScores(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), offset, count); return default((string member, decimal score)[]); }, obj => + ((Tuple[])obj).Select(z => (z.Item1, z.Item2)).ToArray()); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe<(T member, double score)[]> ZRevRangeByScoreWithScores(string key, double max, double min, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRevRangeBytesByScoreWithScores(k, max == double.MaxValue ? "+inf" : max.ToString(), min == double.MinValue ? "-inf" : min.ToString(), offset, count); return default((T member, double score)[]); }, obj => - rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); + public CSRedisClientPipe<(T member, decimal score)[]> ZRevRangeByScoreWithScores(string key, decimal max, decimal min, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRevRangeBytesByScoreWithScores(k, max == decimal.MaxValue ? "+inf" : max.ToString(), min == decimal.MinValue ? "-inf" : min.ToString(), offset, count); return default((T member, decimal score)[]); }, obj => + rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// @@ -587,9 +587,9 @@ public CSRedisClientPipe ZRevRangeByScore(string key, string max, string /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe<(string member, double score)[]> ZRevRangeByScoreWithScores(string key, string max, string min, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRevRangeByScoreWithScores(k, max, min, offset, count); return default((string, double)[]); }, obj => - ((Tuple[])obj).Select(z => (z.Item1, z.Item2)).ToArray()); + public CSRedisClientPipe<(string member, decimal score)[]> ZRevRangeByScoreWithScores(string key, string max, string min, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRevRangeByScoreWithScores(k, max, min, offset, count); return default((string, decimal)[]); }, obj => + ((Tuple[])obj).Select(z => (z.Item1, z.Item2)).ToArray()); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// @@ -600,9 +600,9 @@ public CSRedisClientPipe ZRevRangeByScore(string key, string max, string /// 返回多少成员 /// 返回条件偏移位置 /// - public CSRedisClientPipe<(T member, double score)[]> ZRevRangeByScoreWithScores(string key, string max, string min, long? count = null, long offset = 0) => - PipeCommand(key, (c, k) => { c.Value.ZRevRangeBytesByScoreWithScores(k, max, min, offset, count); return default((T, double)[]); }, obj => - rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); + public CSRedisClientPipe<(T member, decimal score)[]> ZRevRangeByScoreWithScores(string key, string max, string min, long? count = null, long offset = 0) => + PipeCommand(key, (c, k) => { c.Value.ZRevRangeBytesByScoreWithScores(k, max, min, offset, count); return default((T, decimal)[]); }, obj => + rds.DeserializeRedisValueTuple1Internal((Tuple[])obj)); /// /// 返回有序集合中指定成员的排名,有序集成员按分数值递减(从大到小)排序 @@ -617,7 +617,7 @@ public CSRedisClientPipe ZRevRangeByScore(string key, string max, string /// 不含prefix前辍 /// 成员 /// - public CSRedisClientPipe ZScore(string key, object member) => PipeCommand(key, (c, k) => c.Value.ZScore(k, rds.SerializeRedisValueInternal(member))); + public CSRedisClientPipe ZScore(string key, object member) => PipeCommand(key, (c, k) => c.Value.ZScore(k, rds.SerializeRedisValueInternal(member))); /// /// 计算给定的一个或多个有序集的并集,将结果集存储在新的有序集合 destination 中 @@ -627,7 +627,7 @@ public CSRedisClientPipe ZRevRangeByScore(string key, string max, string /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public CSRedisClientPipe ZUnionStore(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) + public CSRedisClientPipe ZUnionStore(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) { if (keys == null || keys.Length == 0) throw new Exception("keys 参数不可为空"); if (weights != null && weights.Length != keys.Length) throw new Exception("weights 和 keys 参数长度必须相同"); @@ -644,11 +644,11 @@ public CSRedisClientPipe ZUnionStore(string destination, double[] weights, /// 模式 /// 数量 /// - public CSRedisClientPipe> ZScan(string key, long cursor, string pattern = null, long? count = null) => - PipeCommand(key, (c, k) => { c.Value.ZScan(k, cursor, pattern, count); return default(RedisScan<(string, double)>); }, obj => + public CSRedisClientPipe> ZScan(string key, long cursor, string pattern = null, long? count = null) => + PipeCommand(key, (c, k) => { c.Value.ZScan(k, cursor, pattern, count); return default(RedisScan<(string, decimal)>); }, obj => { - var scan = (RedisScan>)obj; - return new RedisScan<(string, double)>(scan.Cursor, scan.Items.Select(z => (z.Item1, z.Item2)).ToArray()); + var scan = (RedisScan>)obj; + return new RedisScan<(string, decimal)>(scan.Cursor, scan.Items.Select(z => (z.Item1, z.Item2)).ToArray()); }); /// /// 迭代有序集合中的元素 @@ -659,11 +659,11 @@ public CSRedisClientPipe ZUnionStore(string destination, double[] weights, /// 模式 /// 数量 /// - public CSRedisClientPipe> ZScan(string key, long cursor, string pattern = null, long? count = null) => - PipeCommand(key, (c, k) => { c.Value.ZScanBytes(k, cursor, pattern, count); return default(RedisScan<(T, double)>); }, obj => + public CSRedisClientPipe> ZScan(string key, long cursor, string pattern = null, long? count = null) => + PipeCommand(key, (c, k) => { c.Value.ZScanBytes(k, cursor, pattern, count); return default(RedisScan<(T, decimal)>); }, obj => { - var scan = (RedisScan>)obj; - return new RedisScan<(T, double)>(scan.Cursor, rds.DeserializeRedisValueTuple1Internal(scan.Items)); + var scan = (RedisScan>)obj; + return new RedisScan<(T, decimal)>(scan.Cursor, rds.DeserializeRedisValueTuple1Internal(scan.Items)); }); /// @@ -1207,7 +1207,7 @@ public CSRedisClientPipe HDel(string key, params string[] fields) /// 字段 /// 增量值(默认=1) /// - public CSRedisClientPipe HIncrByFloat(string key, string field, double value) => PipeCommand(key, (c, k) => c.Value.HIncrByFloat(k, field, value)); + public CSRedisClientPipe HIncrByFloat(string key, string field, decimal value) => PipeCommand(key, (c, k) => c.Value.HIncrByFloat(k, field, value)); /// /// 获取所有哈希表中的字段 /// @@ -1430,7 +1430,7 @@ public CSRedisClientPipe BitOp(RedisBitOp op, string destKey, params strin /// 不含prefix前辍 /// 增量值(默认=1) /// - public CSRedisClientPipe IncrBy(string key, double value) => PipeCommand(key, (c, k) => c.Value.IncrByFloat(k, value)); + public CSRedisClientPipe IncrBy(string key, decimal value) => PipeCommand(key, (c, k) => c.Value.IncrByFloat(k, value)); /// /// 获取多个指定 key 的值(数组) /// @@ -1460,6 +1460,15 @@ public CSRedisClientPipe Set(string key, object value, int expireSeconds = if (expireSeconds > 0 && exists != null) return PipeCommand(key, (c, k) => { c.Value.Set(k, redisValule, expireSeconds, exists); return false; }, obj => obj?.ToString() == "OK"); return PipeCommand(key, (c, k) => { c.Value.Set(k, redisValule); return false; }, obj => obj?.ToString() == "OK"); } + public CSRedisClientPipe Set(string key, object value, TimeSpan expire, RedisExistence? exists = null) + { + object redisValule = rds.SerializeRedisValueInternal(value); + if (expire <= TimeSpan.Zero && exists == null) return PipeCommand(key, (c, k) => { c.Value.Set(k, redisValule); return false; }, obj => obj?.ToString() == "OK"); + if (expire <= TimeSpan.Zero && exists != null) return PipeCommand(key, (c, k) => { c.Value.Set(k, redisValule, null, exists); return false; }, obj => obj?.ToString() == "OK"); + if (expire > TimeSpan.Zero && exists == null) return PipeCommand(key, (c, k) => { c.Value.Set(k, redisValule, expire, null); return false; }, obj => obj?.ToString() == "OK"); + if (expire > TimeSpan.Zero && exists != null) return PipeCommand(key, (c, k) => { c.Value.Set(k, redisValule, expire, exists); return false; }, obj => obj?.ToString() == "OK"); + return PipeCommand(key, (c, k) => { c.Value.Set(k, redisValule); return false; }, obj => obj?.ToString() == "OK"); + } /// /// 对 key 所储存的字符串值,设置或清除指定偏移量上的位(bit) /// diff --git a/src/IRedisClientAsync.cs b/src/IRedisClientAsync.cs index 2fe5731..40f1980 100644 --- a/src/IRedisClientAsync.cs +++ b/src/IRedisClientAsync.cs @@ -465,7 +465,7 @@ Task HGetAllAsync(string key) /// Field to increment /// Increment value /// Value of field after increment - Task HIncrByFloatAsync(string key, string field, double increment); + Task HIncrByFloatAsync(string key, string field, decimal increment); @@ -965,7 +965,7 @@ Task HMSetAsync(string key, T obj) /// Minimum score is exclusive /// Maximum score is exclusive /// Number of elements in the specified score range - Task ZCountAsync(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false); + Task ZCountAsync(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false); @@ -989,7 +989,7 @@ Task HMSetAsync(string key, T obj) /// Increment by value /// Sorted set member to increment /// New score of member - Task ZIncrByAsync(string key, double increment, object member); + Task ZIncrByAsync(string key, decimal increment, object member); @@ -1002,7 +1002,7 @@ Task HMSetAsync(string key, T obj) /// Aggregation function of resulting set /// Sorted set keys to intersect /// Number of elements in the resulting sorted set - Task ZInterStoreAsync(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys); + Task ZInterStoreAsync(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys); @@ -1039,8 +1039,8 @@ Task HMSetAsync(string key, T obj) /// Start offset /// Stop offset /// Array of elements in the specified range with scores - Task[]> ZRangeWithScoresAsync(string key, long start, long stop); - Task[]> ZRangeBytesWithScoresAsync(string key, long start, long stop); + Task[]> ZRangeWithScoresAsync(string key, long start, long stop); + Task[]> ZRangeBytesWithScoresAsync(string key, long start, long stop); @@ -1056,8 +1056,8 @@ Task HMSetAsync(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - Task ZRangeByScoreAsync(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); - Task ZRangeBytesByScoreAsync(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); + Task ZRangeByScoreAsync(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); + Task ZRangeBytesByScoreAsync(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); @@ -1087,8 +1087,8 @@ Task HMSetAsync(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - Task[]> ZRangeByScoreWithScoresAsync(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); - Task[]> ZRangeBytesByScoreWithScoresAsync(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); + Task[]> ZRangeByScoreWithScoresAsync(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); + Task[]> ZRangeBytesByScoreWithScoresAsync(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); @@ -1101,8 +1101,8 @@ Task HMSetAsync(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - Task[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? offset = null, long? count = null); - Task[]> ZRangeBytesByScoreWithScoresAsync(string key, string min, string max, long? offset = null, long? count = null); + Task[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? offset = null, long? count = null); + Task[]> ZRangeBytesByScoreWithScoresAsync(string key, string min, string max, long? offset = null, long? count = null); @@ -1149,7 +1149,7 @@ Task HMSetAsync(string key, T obj) /// Minimum score is exclusive /// Maximum score is exclusive /// Number of elements removed - Task ZRemRangeByScoreAsync(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false); + Task ZRemRangeByScoreAsync(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false); Task ZRemRangeByScoreAsync(string key, string min, string max); @@ -1175,8 +1175,8 @@ Task HMSetAsync(string key, T obj) /// Start offset /// Stop offset /// List of elements in the specified range (with optional scores) - Task[]> ZRevRangeWithScoresAsync(string key, long start, long stop); - Task[]> ZRevRangeBytesWithScoresAsync(string key, long start, long stop); + Task[]> ZRevRangeWithScoresAsync(string key, long start, long stop); + Task[]> ZRevRangeBytesWithScoresAsync(string key, long start, long stop); @@ -1192,8 +1192,8 @@ Task HMSetAsync(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - Task ZRevRangeByScoreAsync(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); - Task ZRevRangeBytesByScoreAsync(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); + Task ZRevRangeByScoreAsync(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); + Task ZRevRangeBytesByScoreAsync(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); @@ -1223,8 +1223,8 @@ Task HMSetAsync(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - Task[]> ZRevRangeByScoreWithScoresAsync(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); - Task[]> ZRevRangeBytesByScoreWithScoresAsync(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); + Task[]> ZRevRangeByScoreWithScoresAsync(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); + Task[]> ZRevRangeBytesByScoreWithScoresAsync(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); @@ -1237,8 +1237,8 @@ Task HMSetAsync(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - Task[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? offset = null, long? count = null); - Task[]> ZRevRangeBytesByScoreWithScoresAsync(string key, string max, string min, long? offset = null, long? count = null); + Task[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? offset = null, long? count = null); + Task[]> ZRevRangeBytesByScoreWithScoresAsync(string key, string max, string min, long? offset = null, long? count = null); @@ -1259,7 +1259,7 @@ Task HMSetAsync(string key, T obj) /// Sorted set key /// Member to lookup /// Score of member, or null if member does not exist - Task ZScoreAsync(string key, object member); + Task ZScoreAsync(string key, object member); @@ -1272,7 +1272,7 @@ Task HMSetAsync(string key, T obj) /// Aggregation function of resulting set /// Sorted set keys to union /// Number of elements in the resulting sorted set - Task ZUnionStoreAsync(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys); + Task ZUnionStoreAsync(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys); @@ -1285,8 +1285,8 @@ Task HMSetAsync(string key, T obj) /// Glob-style pattern to filter returned elements /// Maximum number of elements to return /// Updated cursor and result set - Task>> ZScanAsync(string key, long cursor, string pattern = null, long? count = null); - Task>> ZScanBytesAsync(string key, long cursor, string pattern = null, long? count = null); + Task>> ZScanAsync(string key, long cursor, string pattern = null, long? count = null); + Task>> ZScanBytesAsync(string key, long cursor, string pattern = null, long? count = null); @@ -1576,7 +1576,7 @@ Task HMSetAsync(string key, T obj) /// Key to modify /// Increment amount /// Value of key after increment - Task IncrByFloatAsync(string key, double increment); + Task IncrByFloatAsync(string key, decimal increment); @@ -2112,14 +2112,14 @@ Task HMSetAsync(string key, T obj) #endregion #region Geo redis-server 3.2 - Task GeoAddAsync(string key, params (double longitude, double latitude, object member)[] values); - Task GeoDistAsync(string key, object member1, object member2, GeoUnit unit = GeoUnit.m); + Task GeoAddAsync(string key, params (decimal longitude, decimal latitude, object member)[] values); + Task GeoDistAsync(string key, object member1, object member2, GeoUnit unit = GeoUnit.m); Task GeoHashAsync(string key, object[] members); - Task<(double longitude, double latitude)?[]> GeoPosAsync(string key, object[] members); - Task<(string member, double dist, double longitude, double latitude, long hash)[]> GeoRadiusAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); - Task<(byte[] member, double dist, double longitude, double latitude, long hash)[]> GeoRadiusBytesAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); - Task<(string member, double dist, double longitude, double latitude, long hash)[]> GeoRadiusByMemberAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); - Task<(byte[] member, double dist, double longitude, double latitude, long hash)[]> GeoRadiusBytesByMemberAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); + Task<(decimal longitude, decimal latitude)?[]> GeoPosAsync(string key, object[] members); + Task<(string member, decimal dist, decimal longitude, decimal latitude, long hash)[]> GeoRadiusAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); + Task<(byte[] member, decimal dist, decimal longitude, decimal latitude, long hash)[]> GeoRadiusBytesAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); + Task<(string member, decimal dist, decimal longitude, decimal latitude, long hash)[]> GeoRadiusByMemberAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); + Task<(byte[] member, decimal dist, decimal longitude, decimal latitude, long hash)[]> GeoRadiusBytesByMemberAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); #endregion #endif } diff --git a/src/IRedisClientSync.cs b/src/IRedisClientSync.cs index 4df6d42..58a061c 100644 --- a/src/IRedisClientSync.cs +++ b/src/IRedisClientSync.cs @@ -385,7 +385,7 @@ T HGetAll(string key) /// Field to increment /// Increment value /// Value of field after increment - double HIncrByFloat(string key, string field, double increment); + decimal HIncrByFloat(string key, string field, decimal increment); /// @@ -920,7 +920,7 @@ string HMSet(string key, T obj) /// Minimum score is exclusive /// Maximum score is exclusive /// Number of elements in the specified score range - long ZCount(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false); + long ZCount(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false); @@ -944,7 +944,7 @@ string HMSet(string key, T obj) /// Increment by value /// Sorted set member to increment /// New score of member - double ZIncrBy(string key, double increment, object member); + decimal ZIncrBy(string key, decimal increment, object member); @@ -957,7 +957,7 @@ string HMSet(string key, T obj) /// Aggregation function of resulting set /// Sorted set keys to intersect /// Number of elements in the resulting sorted set - long ZInterStore(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys); + long ZInterStore(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys); @@ -994,8 +994,8 @@ string HMSet(string key, T obj) /// Start offset /// Stop offset /// Array of elements in the specified range with scores - Tuple[] ZRangeWithScores(string key, long start, long stop); - Tuple[] ZRangeBytesWithScores(string key, long start, long stop); + Tuple[] ZRangeWithScores(string key, long start, long stop); + Tuple[] ZRangeBytesWithScores(string key, long start, long stop); @@ -1011,8 +1011,8 @@ string HMSet(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores); - string[] ZRangeByScore(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); - byte[][] ZRangeBytesByScore(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); + string[] ZRangeByScore(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); + byte[][] ZRangeBytesByScore(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); @@ -1042,8 +1042,8 @@ string HMSet(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores); - Tuple[] ZRangeByScoreWithScores(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); - Tuple[] ZRangeBytesByScoreWithScores(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); + Tuple[] ZRangeByScoreWithScores(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); + Tuple[] ZRangeBytesByScoreWithScores(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null); @@ -1056,8 +1056,8 @@ string HMSet(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores); - Tuple[] ZRangeByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null); - Tuple[] ZRangeBytesByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null); + Tuple[] ZRangeByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null); + Tuple[] ZRangeBytesByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null); @@ -1104,7 +1104,7 @@ string HMSet(string key, T obj) /// Minimum score is exclusive /// Maximum score is exclusive /// Number of elements removed - long ZRemRangeByScore(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false); + long ZRemRangeByScore(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false); long ZRemRangeByScore(string key, string min, string max); @@ -1130,8 +1130,8 @@ string HMSet(string key, T obj) /// Start offset /// Stop offset /// List of elements in the specified range (with optional scores); - Tuple[] ZRevRangeWithScores(string key, long start, long stop); - Tuple[] ZRevRangeBytesWithScores(string key, long start, long stop); + Tuple[] ZRevRangeWithScores(string key, long start, long stop); + Tuple[] ZRevRangeBytesWithScores(string key, long start, long stop); @@ -1148,8 +1148,8 @@ string HMSet(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores); - string[] ZRevRangeByScore(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); - byte[][] ZRevRangeBytesByScore(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); + string[] ZRevRangeByScore(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); + byte[][] ZRevRangeBytesByScore(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); @@ -1179,8 +1179,8 @@ string HMSet(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores); - Tuple[] ZRevRangeByScoreWithScores(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); - Tuple[] ZRevRangeBytesByScoreWithScores(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); + Tuple[] ZRevRangeByScoreWithScores(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); + Tuple[] ZRevRangeBytesByScoreWithScores(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null); @@ -1193,8 +1193,8 @@ string HMSet(string key, T obj) /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores); - Tuple[] ZRevRangeByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null); - Tuple[] ZRevRangeBytesByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null); + Tuple[] ZRevRangeByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null); + Tuple[] ZRevRangeBytesByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null); @@ -1215,7 +1215,7 @@ string HMSet(string key, T obj) /// Sorted set key /// Member to lookup /// Score of member, or null if member does not exist - double? ZScore(string key, object member); + decimal? ZScore(string key, object member); @@ -1228,7 +1228,7 @@ string HMSet(string key, T obj) /// Aggregation function of resulting set /// Sorted set keys to union /// Number of elements in the resulting sorted set - long ZUnionStore(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys); + long ZUnionStore(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys); @@ -1252,8 +1252,8 @@ string HMSet(string key, T obj) /// Glob-style pattern to filter returned elements /// Maximum number of elements to return /// Updated cursor and result set - RedisScan> ZScan(string key, long cursor, string pattern = null, long? count = null); - RedisScan> ZScanBytes(string key, long cursor, string pattern = null, long? count = null); + RedisScan> ZScan(string key, long cursor, string pattern = null, long? count = null); + RedisScan> ZScanBytes(string key, long cursor, string pattern = null, long? count = null); @@ -1577,7 +1577,7 @@ string HMSet(string key, T obj) /// Key to modify /// Increment amount /// Value of key after increment - double IncrByFloat(string key, double increment); + decimal IncrByFloat(string key, decimal increment); @@ -2124,14 +2124,14 @@ string HMSet(string key, T obj) #endregion #region Geo redis-server 3.2 - long GeoAdd(string key, params (double longitude, double latitude, object member)[] values); - double? GeoDist(string key, object member1, object member2, GeoUnit unit = GeoUnit.m); + long GeoAdd(string key, params (decimal longitude, decimal latitude, object member)[] values); + decimal? GeoDist(string key, object member1, object member2, GeoUnit unit = GeoUnit.m); string[] GeoHash(string key, object[] members); - (double longitude, double latitude)?[] GeoPos(string key, object[] members); - (string member, double dist, double longitude, double latitude, long hash)[] GeoRadius(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); - (byte[] member, double dist, double longitude, double latitude, long hash)[] GeoRadiusBytes(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); - (string member, double dist, double longitude, double latitude, long hash)[] GeoRadiusByMember(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); - (byte[] member, double dist, double longitude, double latitude, long hash)[] GeoRadiusBytesByMember(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); + (decimal longitude, decimal latitude)?[] GeoPos(string key, object[] members); + (string member, decimal dist, decimal longitude, decimal latitude, long hash)[] GeoRadius(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); + (byte[] member, decimal dist, decimal longitude, decimal latitude, long hash)[] GeoRadiusBytes(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); + (string member, decimal dist, decimal longitude, decimal latitude, long hash)[] GeoRadiusByMember(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); + (byte[] member, decimal dist, decimal longitude, decimal latitude, long hash)[] GeoRadiusBytesByMember(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false); #endregion } diff --git a/src/Internal/Commands/RedisFloat.cs b/src/Internal/Commands/RedisFloat.cs index 095ed55..30e1d3f 100644 --- a/src/Internal/Commands/RedisFloat.cs +++ b/src/Internal/Commands/RedisFloat.cs @@ -4,29 +4,29 @@ namespace CSRedis.Internal.Commands { - class RedisFloat : RedisCommand + class RedisFloat : RedisCommand { public RedisFloat(string command, params object[] args) : base(command, args) { } - public override double Parse(RedisReader reader) + public override decimal Parse(RedisReader reader) { return FromString(reader.ReadBulkString()); } - static double FromString(string input) + static decimal FromString(string input) { - return Double.Parse(input, NumberStyles.Float, CultureInfo.InvariantCulture); + return decimal.Parse(input); } - public class Nullable : RedisCommand + public class Nullable : RedisCommand { public Nullable(string command, params object[] args) : base(command, args) { } - public override double? Parse(RedisReader reader) + public override decimal? Parse(RedisReader reader) { string result = reader.ReadBulkString(); if (string.IsNullOrEmpty(result)) diff --git a/src/Internal/RedisCommand.cs b/src/Internal/RedisCommand.cs index 2b170cf..ddfdf21 100644 --- a/src/Internal/RedisCommand.cs +++ b/src/Internal/RedisCommand.cs @@ -263,7 +263,7 @@ public static RedisInt HIncrBy(string key, string field, long increment) { return new RedisInt("HINCRBY", key, field, increment); } - public static RedisFloat HIncrByFloat(string key, string field, double increment) + public static RedisFloat HIncrByFloat(string key, string field, decimal increment) { return new RedisFloat("HINCRBYFLOAT", key, field, increment); } @@ -652,21 +652,21 @@ public static RedisScanCommand SScanBytes(string key, long cursor, strin #endregion #region Sorted Sets - public static RedisArray.WeakPairs ZPopMax(string key, long count) + public static RedisArray.WeakPairs ZPopMax(string key, long count) { - return new RedisArray.WeakPairs("ZPOPMAX", key, count); + return new RedisArray.WeakPairs("ZPOPMAX", key, count); } - public static RedisArray.StrongPairs ZPopMaxBytes(string key, long count) + public static RedisArray.StrongPairs ZPopMaxBytes(string key, long count) { - return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZPOPMAX", key, count); + return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZPOPMAX", key, count); } - public static RedisArray.WeakPairs ZPopMin(string key, long count) + public static RedisArray.WeakPairs ZPopMin(string key, long count) { - return new RedisArray.WeakPairs("ZPOPMIN", key, count); + return new RedisArray.WeakPairs("ZPOPMIN", key, count); } - public static RedisArray.StrongPairs ZPopMinBytes(string key, long count) + public static RedisArray.StrongPairs ZPopMinBytes(string key, long count) { - return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZPOPMIN", key, count); + return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZPOPMIN", key, count); } public static RedisInt ZAdd(string key, params Tuple[] scoreMembers) @@ -683,7 +683,7 @@ public static RedisInt ZCard(string key) { return new RedisInt("ZCARD", key); } - public static RedisInt ZCount(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false) + public static RedisInt ZCount(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); @@ -693,11 +693,11 @@ public static RedisInt ZCount(string key, string min, string max) { return new RedisInt("ZCOUNT", key, min, max); } - public static RedisFloat ZIncrBy(string key, double increment, object member) + public static RedisFloat ZIncrBy(string key, decimal increment, object member) { return new RedisFloat("ZINCRBY", key, increment, member); } - public static RedisInt ZInterStore(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys) + public static RedisInt ZInterStore(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys) { List args = new List(); args.Add(destination); @@ -730,33 +730,33 @@ public static RedisArray.Bytes ZRangeBytes(string key, long start, long stop, bo : new[] { key, start.ToString(), stop.ToString() }; return new RedisArray.Bytes("ZRANGE", args); } - public static RedisArray.WeakPairs ZRangeWithScores(string key, long start, long stop) + public static RedisArray.WeakPairs ZRangeWithScores(string key, long start, long stop) { - return new RedisArray.WeakPairs("ZRANGE", key, start, stop, "WITHSCORES"); + return new RedisArray.WeakPairs("ZRANGE", key, start, stop, "WITHSCORES"); } - public static RedisArray.StrongPairs ZRangeBytesWithScores(string key, long start, long stop) + public static RedisArray.StrongPairs ZRangeBytesWithScores(string key, long start, long stop) { - return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZRANGE", key, start, stop, "WITHSCORES"); + return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZRANGE", key, start, stop, "WITHSCORES"); } - public static RedisArray.Strings ZRangeByScore(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public static RedisArray.Strings ZRangeByScore(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); return ZRangeByScore(key, min_score, max_score, withScores, offset, count); } - public static RedisArray.Bytes ZRangeBytesByScore(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public static RedisArray.Bytes ZRangeBytesByScore(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); return ZRangeBytesByScore(key, min_score, max_score, withScores, offset, count); } - public static RedisArray.WeakPairs ZRangeByScoreWithScores(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public static RedisArray.WeakPairs ZRangeByScoreWithScores(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); return ZRangeByScoreWithScores(key, min_score, max_score, offset, count); } - public static RedisArray.StrongPairs ZRangeBytesByScoreWithScores(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public static RedisArray.StrongPairs ZRangeBytesByScoreWithScores(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); @@ -782,21 +782,21 @@ public static RedisArray.Bytes ZRangeBytesByScore(string key, string min, string return new RedisArray.Bytes("ZRANGEBYSCORE", args); } - public static RedisArray.WeakPairs ZRangeByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null) + public static RedisArray.WeakPairs ZRangeByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null) { object[] args = new[] { key, min, max, "WITHSCORES" }; if (offset.HasValue && count.HasValue) args = RedisArgs.Concat(args, new[] { "LIMIT", offset.Value.ToString(), count.Value.ToString() }); - return new RedisArray.WeakPairs("ZRANGEBYSCORE", args); + return new RedisArray.WeakPairs("ZRANGEBYSCORE", args); } - public static RedisArray.StrongPairs ZRangeBytesByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null) + public static RedisArray.StrongPairs ZRangeBytesByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null) { object[] args = new[] { key, min, max, "WITHSCORES" }; if (offset.HasValue && count.HasValue) args = RedisArgs.Concat(args, new[] { "LIMIT", offset.Value.ToString(), count.Value.ToString() }); - return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZRANGEBYSCORE", args); + return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZRANGEBYSCORE", args); } public static RedisInt.Nullable ZRank(string key, object member) { @@ -811,7 +811,7 @@ public static RedisInt ZRemRangeByRank(string key, long start, long stop) { return new RedisInt("ZREMRANGEBYRANK", key, start, stop); } - public static RedisInt ZRemRangeByScore(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false) + public static RedisInt ZRemRangeByScore(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); @@ -836,21 +836,21 @@ public static RedisArray.Bytes ZRevRangeBytes(string key, long start, long stop, : new[] { key, start.ToString(), stop.ToString() }; return new RedisArray.Bytes("ZREVRANGE", args); } - public static RedisArray.WeakPairs ZRevRangeWithScores(string key, long start, long stop) + public static RedisArray.WeakPairs ZRevRangeWithScores(string key, long start, long stop) { - return new RedisArray.WeakPairs("ZREVRANGE", key, start.ToString(), stop.ToString(), "WITHSCORES"); + return new RedisArray.WeakPairs("ZREVRANGE", key, start.ToString(), stop.ToString(), "WITHSCORES"); } - public static RedisArray.StrongPairs ZRevRangeBytesWithScores(string key, long start, long stop) + public static RedisArray.StrongPairs ZRevRangeBytesWithScores(string key, long start, long stop) { - return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZREVRANGE", key, start.ToString(), stop.ToString(), "WITHSCORES"); + return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZREVRANGE", key, start.ToString(), stop.ToString(), "WITHSCORES"); } - public static RedisArray.Strings ZRevRangeByScore(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public static RedisArray.Strings ZRevRangeByScore(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); return ZRevRangeByScore(key, max_score, min_score, withScores, offset, count); } - public static RedisArray.Bytes ZRevRangeBytesByScore(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public static RedisArray.Bytes ZRevRangeBytesByScore(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); @@ -876,33 +876,33 @@ public static RedisArray.Bytes ZRevRangeBytesByScore(string key, string max, str return new RedisArray.Bytes("ZREVRANGEBYSCORE", args); } - public static RedisArray.WeakPairs ZRevRangeByScoreWithScores(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public static RedisArray.WeakPairs ZRevRangeByScoreWithScores(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); return ZRevRangeByScoreWithScores(key, max_score, min_score, offset, count); } - public static RedisArray.StrongPairs ZRevRangeBytesByScoreWithScores(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public static RedisArray.StrongPairs ZRevRangeBytesByScoreWithScores(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { string min_score = RedisArgs.GetScore(min, exclusiveMin); string max_score = RedisArgs.GetScore(max, exclusiveMax); return ZRevRangeBytesByScoreWithScores(key, max_score, min_score, offset, count); } - public static RedisArray.WeakPairs ZRevRangeByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null) + public static RedisArray.WeakPairs ZRevRangeByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null) { object[] args = new[] { key, max, min, "WITHSCORES" }; if (count.HasValue) args = RedisArgs.Concat(args, new[] { "LIMIT", (offset ?? 0).ToString(), count.Value.ToString() }); - return new RedisArray.WeakPairs("ZREVRANGEBYSCORE", args); + return new RedisArray.WeakPairs("ZREVRANGEBYSCORE", args); } - public static RedisArray.StrongPairs ZRevRangeBytesByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null) + public static RedisArray.StrongPairs ZRevRangeBytesByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null) { object[] args = new[] { key, max, min, "WITHSCORES" }; if (count.HasValue) args = RedisArgs.Concat(args, new[] { "LIMIT", (offset ?? 0).ToString(), count.Value.ToString() }); - return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZREVRANGEBYSCORE", args); + return new RedisArray.StrongPairs(new RedisBytes(null), new RedisFloat(null), "ZREVRANGEBYSCORE", args); } public static RedisInt.Nullable ZRevRank(string key, object member) { @@ -912,7 +912,7 @@ public static RedisFloat.Nullable ZScore(string key, object member) { return new RedisFloat.Nullable("ZSCORE", key, member); } - public static RedisInt ZUnionStore(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys) + public static RedisInt ZUnionStore(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys) { List args = new List(); args.Add(destination); @@ -931,7 +931,7 @@ public static RedisInt ZUnionStore(string destination, double[] weights = null, } return new RedisInt("ZUNIONSTORE", args.ToArray()); } - public static RedisScanCommand> ZScan(string key, long cursor, string pattern = null, long? count = null) + public static RedisScanCommand> ZScan(string key, long cursor, string pattern = null, long? count = null) { var args = new List(); args.Add(key); @@ -940,12 +940,12 @@ public static RedisScanCommand> ZScan(string key, long cur args.AddRange(new[] { "MATCH", pattern }); if (count != null) args.AddRange(new object[] { "COUNT", count }); - return new RedisScanCommand>( - new RedisArray.WeakPairs("ZSCAN", args.ToArray())); - //>( - //new RedisTuple.Generic.Bulk("ZSCAN", args.ToArray()))); + return new RedisScanCommand>( + new RedisArray.WeakPairs("ZSCAN", args.ToArray())); + //>( + //new RedisTuple.Generic.Bulk("ZSCAN", args.ToArray()))); } - public static RedisScanCommand> ZScanBytes(string key, long cursor, string pattern = null, long? count = null) + public static RedisScanCommand> ZScanBytes(string key, long cursor, string pattern = null, long? count = null) { var args = new List(); args.Add(key); @@ -954,11 +954,11 @@ public static RedisScanCommand> ZScanBytes(string key, lon args.AddRange(new[] { "MATCH", pattern }); if (count != null) args.AddRange(new object[] { "COUNT", count }); - return new RedisScanCommand>( - new RedisArray.StrongPairs( + return new RedisScanCommand>( + new RedisArray.StrongPairs( new RedisBytes(null), new RedisFloat(null), "ZSCAN", args.ToArray())); - //>( - //new RedisTuple.Generic.Bulk("ZSCAN", args.ToArray()))); + //>( + //new RedisTuple.Generic.Bulk("ZSCAN", args.ToArray()))); } public static RedisArray.Strings ZRangeByLex(string key, string min, string max, long? offset = null, long? count = null) { @@ -1137,7 +1137,7 @@ public static RedisInt IncrBy(string key, long increment) { return new RedisInt("INCRBY", key, increment); } - public static RedisFloat IncrByFloat(string key, double increment) + public static RedisFloat IncrByFloat(string key, decimal increment) { return new RedisFloat("INCRBYFLOAT", key, increment); } diff --git a/src/Internal/Utilities/RedisArgs.cs b/src/Internal/Utilities/RedisArgs.cs index c229bef..01ebf75 100644 --- a/src/Internal/Utilities/RedisArgs.cs +++ b/src/Internal/Utilities/RedisArgs.cs @@ -63,11 +63,11 @@ public static object[] GetTupleArgs(Tuple[] tupl /// Numeric base score /// Score is exclusive, rather than inclusive /// String representing Redis score/range notation - public static string GetScore(double score, bool isExclusive) + public static string GetScore(decimal score, bool isExclusive) { - if (Double.IsNegativeInfinity(score) || score == Double.MinValue) + if (score == decimal.MinValue) return "-inf"; - else if (Double.IsPositiveInfinity(score) || score == Double.MaxValue) + else if (score == decimal.MaxValue) return "+inf"; else if (isExclusive) return '(' + score.ToString(); diff --git a/src/RedisClient.Async.cs b/src/RedisClient.Async.cs index 2670f50..27607ca 100644 --- a/src/RedisClient.Async.cs +++ b/src/RedisClient.Async.cs @@ -531,7 +531,7 @@ public Task HIncrByAsync(string key, string field, long increment) /// Field to increment /// Increment value /// Value of field after increment - public Task HIncrByFloatAsync(string key, string field, double increment) + public Task HIncrByFloatAsync(string key, string field, decimal increment) { return WriteAsync(RedisCommands.HIncrByFloat(key, field, increment)); } @@ -1063,19 +1063,19 @@ public Task> SScanBytesAsync(string key, long cursor, string p #endregion #region Sorted Sets - public Task[]> ZPopMaxAsync(string key, long count) + public Task[]> ZPopMaxAsync(string key, long count) { return WriteAsync(RedisCommands.ZPopMax(key, count)); } - public Task[]> ZPopMaxBytesAsync(string key, long count) + public Task[]> ZPopMaxBytesAsync(string key, long count) { return WriteAsync(RedisCommands.ZPopMaxBytes(key, count)); } - public Task[]> ZPopMinAsync(string key, long count) + public Task[]> ZPopMinAsync(string key, long count) { return WriteAsync(RedisCommands.ZPopMin(key, count)); } - public Task[]> ZPopMinBytesAsync(string key, long count) + public Task[]> ZPopMinBytesAsync(string key, long count) { return WriteAsync(RedisCommands.ZPopMinBytes(key, count)); } @@ -1122,7 +1122,7 @@ public Task ZCardAsync(string key) /// Minimum score is exclusive /// Maximum score is exclusive /// Number of elements in the specified score range - public Task ZCountAsync(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false) + public Task ZCountAsync(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false) { return WriteAsync(RedisCommands.ZCount(key, min, max, exclusiveMin, exclusiveMax)); } @@ -1146,7 +1146,7 @@ public Task ZCountAsync(string key, string min, string max) /// Increment by value /// Sorted set member to increment /// New score of member - public Task ZIncrByAsync(string key, double increment, object member) + public Task ZIncrByAsync(string key, decimal increment, object member) { return WriteAsync(RedisCommands.ZIncrBy(key, increment, member)); } @@ -1159,7 +1159,7 @@ public Task ZIncrByAsync(string key, double increment, object member) /// Aggregation function of resulting set /// Sorted set keys to intersect /// Number of elements in the resulting sorted set - public Task ZInterStoreAsync(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys) + public Task ZInterStoreAsync(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys) { return WriteAsync(RedisCommands.ZInterStore(destination, weights, aggregate, keys)); } @@ -1199,11 +1199,11 @@ public Task ZRangeBytesAsync(string key, long start, long stop, bool w /// Start offset /// Stop offset /// Array of elements in the specified range with scores - public Task[]> ZRangeWithScoresAsync(string key, long start, long stop) + public Task[]> ZRangeWithScoresAsync(string key, long start, long stop) { return WriteAsync(RedisCommands.ZRangeWithScores(key, start, stop)); } - public Task[]> ZRangeBytesWithScoresAsync(string key, long start, long stop) + public Task[]> ZRangeBytesWithScoresAsync(string key, long start, long stop) { return WriteAsync(RedisCommands.ZRangeBytesWithScores(key, start, stop)); } @@ -1220,11 +1220,11 @@ public Task[]> ZRangeBytesWithScoresAsync(string key, long /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - public Task ZRangeByScoreAsync(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public Task ZRangeByScoreAsync(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRangeByScore(key, min, max, withScores, exclusiveMin, exclusiveMax, offset, count)); } - public Task ZRangeBytesByScoreAsync(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public Task ZRangeBytesByScoreAsync(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRangeBytesByScore(key, min, max, withScores, exclusiveMin, exclusiveMax, offset, count)); } @@ -1259,11 +1259,11 @@ public Task ZRangeBytesByScoreAsync(string key, string min, string max /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - public Task[]> ZRangeByScoreWithScoresAsync(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public Task[]> ZRangeByScoreWithScoresAsync(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRangeByScoreWithScores(key, min, max, exclusiveMin, exclusiveMax, offset, count)); } - public Task[]> ZRangeBytesByScoreWithScoresAsync(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public Task[]> ZRangeBytesByScoreWithScoresAsync(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRangeBytesByScoreWithScores(key, min, max, exclusiveMin, exclusiveMax, offset, count)); } @@ -1277,11 +1277,11 @@ public Task[]> ZRangeBytesByScoreWithScoresAsync(string ke /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - public Task[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? offset = null, long? count = null) + public Task[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRangeByScoreWithScores(key, min, max, offset, count)); } - public Task[]> ZRangeBytesByScoreWithScoresAsync(string key, string min, string max, long? offset = null, long? count = null) + public Task[]> ZRangeBytesByScoreWithScoresAsync(string key, string min, string max, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRangeBytesByScoreWithScores(key, min, max, offset, count)); } @@ -1329,7 +1329,7 @@ public Task ZRemRangeByRankAsync(string key, long start, long stop) /// Minimum score is exclusive /// Maximum score is exclusive /// Number of elements removed - public Task ZRemRangeByScoreAsync(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false) + public Task ZRemRangeByScoreAsync(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false) { return WriteAsync(RedisCommands.ZRemRangeByScore(key, min, max, exclusiveMin, exclusiveMax)); } @@ -1362,11 +1362,11 @@ public Task ZRevRangeBytesAsync(string key, long start, long stop, boo /// Start offset /// Stop offset /// List of elements in the specified range (with optional scores) - public Task[]> ZRevRangeWithScoresAsync(string key, long start, long stop) + public Task[]> ZRevRangeWithScoresAsync(string key, long start, long stop) { return WriteAsync(RedisCommands.ZRevRangeWithScores(key, start, stop)); } - public Task[]> ZRevRangeBytesWithScoresAsync(string key, long start, long stop) + public Task[]> ZRevRangeBytesWithScoresAsync(string key, long start, long stop) { return WriteAsync(RedisCommands.ZRevRangeBytesWithScores(key, start, stop)); } @@ -1383,11 +1383,11 @@ public Task[]> ZRevRangeBytesWithScoresAsync(string key, l /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - public Task ZRevRangeByScoreAsync(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public Task ZRevRangeByScoreAsync(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRevRangeByScore(key, max, min, withScores, exclusiveMax, exclusiveMin, offset, count)); } - public Task ZRevRangeBytesByScoreAsync(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public Task ZRevRangeBytesByScoreAsync(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRevRangeBytesByScore(key, max, min, withScores, exclusiveMax, exclusiveMin, offset, count)); } @@ -1422,11 +1422,11 @@ public Task ZRevRangeBytesByScoreAsync(string key, string max, string /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - public Task[]> ZRevRangeByScoreWithScoresAsync(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public Task[]> ZRevRangeByScoreWithScoresAsync(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRevRangeByScoreWithScores(key, max, min, exclusiveMax, exclusiveMin, offset, count)); } - public Task[]> ZRevRangeBytesByScoreWithScoresAsync(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public Task[]> ZRevRangeBytesByScoreWithScoresAsync(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRevRangeBytesByScoreWithScores(key, max, min, exclusiveMax, exclusiveMin, offset, count)); } @@ -1440,11 +1440,11 @@ public Task[]> ZRevRangeBytesByScoreWithScoresAsync(string /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - public Task[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? offset = null, long? count = null) + public Task[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRevRangeByScoreWithScores(key, max, min, offset, count)); } - public Task[]> ZRevRangeBytesByScoreWithScoresAsync(string key, string max, string min, long? offset = null, long? count = null) + public Task[]> ZRevRangeBytesByScoreWithScoresAsync(string key, string max, string min, long? offset = null, long? count = null) { return WriteAsync(RedisCommands.ZRevRangeBytesByScoreWithScores(key, max, min, offset, count)); } @@ -1466,7 +1466,7 @@ public Task[]> ZRevRangeBytesByScoreWithScoresAsync(string /// Sorted set key /// Member to lookup /// Score of member, or null if member does not exist - public Task ZScoreAsync(string key, object member) + public Task ZScoreAsync(string key, object member) { return WriteAsync(RedisCommands.ZScore(key, member)); } @@ -1479,7 +1479,7 @@ public Task[]> ZRevRangeBytesByScoreWithScoresAsync(string /// Aggregation function of resulting set /// Sorted set keys to union /// Number of elements in the resulting sorted set - public Task ZUnionStoreAsync(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys) + public Task ZUnionStoreAsync(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys) { return WriteAsync(RedisCommands.ZUnionStore(destination, weights, aggregate, keys)); } @@ -1492,11 +1492,11 @@ public Task ZUnionStoreAsync(string destination, double[] weights = null, /// Glob-style pattern to filter returned elements /// Maximum number of elements to return /// Updated cursor and result set - public Task>> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) + public Task>> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) { return WriteAsync(RedisCommands.ZScan(key, cursor, pattern, count)); } - public Task>> ZScanBytesAsync(string key, long cursor, string pattern = null, long? count = null) + public Task>> ZScanBytesAsync(string key, long cursor, string pattern = null, long? count = null) { return WriteAsync(RedisCommands.ZScanBytes(key, cursor, pattern, count)); } @@ -1803,7 +1803,7 @@ public Task IncrByAsync(string key, long increment) /// Key to modify /// Increment amount /// Value of key after increment - public Task IncrByFloatAsync(string key, double increment) + public Task IncrByFloatAsync(string key, decimal increment) { return WriteAsync(RedisCommands.IncrByFloat(key, increment)); } @@ -2343,7 +2343,7 @@ public Task PfMergeAsync(string destKey, params string[] sourceKeys) #endregion #region Geo redis-server 3.2 - public Task GeoAddAsync(string key, params (double longitude, double latitude, object member)[] values) + public Task GeoAddAsync(string key, params (decimal longitude, decimal latitude, object member)[] values) { if (values == null || values.Length == 0) throw new Exception("values 参数不能为空"); var args = new List(); @@ -2351,7 +2351,7 @@ public Task GeoAddAsync(string key, params (double longitude, double latit foreach (var v in values) args.AddRange(new object[] { v.longitude, v.latitude, v.member }); return WriteAsync(new RedisInt("GEOADD", args.ToArray())); } - public Task GeoDistAsync(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) + public Task GeoDistAsync(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) { if (unit == GeoUnit.m) return WriteAsync(new RedisFloat.Nullable("GEODIST", key, member1, member2)); return WriteAsync(new RedisFloat.Nullable("GEODIST", key, member1, member2, unit)); @@ -2364,16 +2364,16 @@ public Task GeoHashAsync(string key, object[] members) args.AddRange(members); return WriteAsync(new RedisArray.Strings("GEOHASH", args.ToArray())); } - async public Task<(double longitude, double latitude)?[]> GeoPosAsync(string key, object[] members) + async public Task<(decimal longitude, decimal latitude)?[]> GeoPosAsync(string key, object[] members) { if (members == null || members.Length == 0) throw new Exception("values 参数不能为空"); var args = new List(); args.Add(key); args.AddRange(members); - var ret = await WriteAsync(new RedisArray.Generic(new RedisArray.Generic(new RedisFloat("GEOPOS", args.ToArray())))); - return ret.Select(a => a != null && a.Length == 2 ? new (double, double)?((a[0], a[1])) : null).ToArray(); + var ret = await WriteAsync(new RedisArray.Generic(new RedisArray.Generic(new RedisFloat("GEOPOS", args.ToArray())))); + return ret.Select(a => a != null && a.Length == 2 ? new (decimal, decimal)?((a[0], a[1])) : null).ToArray(); } - async public Task<(string member, double dist, double longitude, double latitude, long hash)[]> GeoRadiusAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) + async public Task<(string member, decimal dist, decimal longitude, decimal latitude, long hash)[]> GeoRadiusAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) { var args = new List(new object[] { key, longitude, latitude, radius, unit }); if (withCoord) args.Add("WITHCOORD"); @@ -2382,15 +2382,15 @@ public Task GeoHashAsync(string key, object[] members) if (count.HasValue) args.Add(count); if (sorting.HasValue) args.Add(sorting); - var cmd = new RedisTuple.Generic.Single( + var cmd = new RedisTuple.Generic.Single( new RedisString(null), withDist == false ? null : new RedisFloat(null), withHash == false ? null : new RedisInt(null), - withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUS", args.ToArray()); - var ret = await WriteAsync(new RedisArray.Generic>(cmd)); - return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(double) : a.Item4[0], a.Item4 == null ? default(double) : a.Item4[1], a.Item3)).ToArray(); + withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUS", args.ToArray()); + var ret = await WriteAsync(new RedisArray.Generic>(cmd)); + return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(decimal) : a.Item4[0], a.Item4 == null ? default(decimal) : a.Item4[1], a.Item3)).ToArray(); } - async public Task<(byte[] member, double dist, double longitude, double latitude, long hash)[]> GeoRadiusBytesAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) + async public Task<(byte[] member, decimal dist, decimal longitude, decimal latitude, long hash)[]> GeoRadiusBytesAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) { var args = new List(new object[] { key, longitude, latitude, radius, unit }); if (withCoord) args.Add("WITHCOORD"); @@ -2399,15 +2399,15 @@ public Task GeoHashAsync(string key, object[] members) if (count.HasValue) args.Add(count); if (sorting.HasValue) args.Add(sorting); - var cmd = new RedisTuple.Generic.Single( + var cmd = new RedisTuple.Generic.Single( new RedisBytes(null), withDist == false ? null : new RedisFloat(null), withHash == false ? null : new RedisInt(null), - withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUS", args.ToArray()); - var ret = await WriteAsync(new RedisArray.Generic>(cmd)); - return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(double) : a.Item4[0], a.Item4 == null ? default(double) : a.Item4[1], a.Item3)).ToArray(); + withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUS", args.ToArray()); + var ret = await WriteAsync(new RedisArray.Generic>(cmd)); + return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(decimal) : a.Item4[0], a.Item4 == null ? default(decimal) : a.Item4[1], a.Item3)).ToArray(); } - async public Task<(string member, double dist, double longitude, double latitude, long hash)[]> GeoRadiusByMemberAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) + async public Task<(string member, decimal dist, decimal longitude, decimal latitude, long hash)[]> GeoRadiusByMemberAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) { var args = new List(new object[] { key, member, radius, unit }); if (withCoord) args.Add("WITHCOORD"); @@ -2416,15 +2416,15 @@ public Task GeoHashAsync(string key, object[] members) if (count.HasValue) args.Add(count); if (sorting.HasValue) args.Add(sorting); - var cmd = new RedisTuple.Generic.Single( + var cmd = new RedisTuple.Generic.Single( new RedisString(null), withDist == false ? null : new RedisFloat(null), withHash == false ? null : new RedisInt(null), - withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUSBYMEMBER", args.ToArray()); - var ret = await WriteAsync(new RedisArray.Generic>(cmd)); - return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(double) : a.Item4[0], a.Item4 == null ? default(double) : a.Item4[1], a.Item3)).ToArray(); + withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUSBYMEMBER", args.ToArray()); + var ret = await WriteAsync(new RedisArray.Generic>(cmd)); + return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(decimal) : a.Item4[0], a.Item4 == null ? default(decimal) : a.Item4[1], a.Item3)).ToArray(); } - async public Task<(byte[] member, double dist, double longitude, double latitude, long hash)[]> GeoRadiusBytesByMemberAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) + async public Task<(byte[] member, decimal dist, decimal longitude, decimal latitude, long hash)[]> GeoRadiusBytesByMemberAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) { var args = new List(new object[] { key, member, radius, unit }); if (withCoord) args.Add("WITHCOORD"); @@ -2433,13 +2433,13 @@ public Task GeoHashAsync(string key, object[] members) if (count.HasValue) args.Add(count); if (sorting.HasValue) args.Add(sorting); - var cmd = new RedisTuple.Generic.Single( + var cmd = new RedisTuple.Generic.Single( new RedisBytes(null), withDist == false ? null : new RedisFloat(null), withHash == false ? null : new RedisInt(null), - withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUSBYMEMBER", args.ToArray()); - var ret = await WriteAsync(new RedisArray.Generic>(cmd)); - return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(double) : a.Item4[0], a.Item4 == null ? default(double) : a.Item4[1], a.Item3)).ToArray(); + withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUSBYMEMBER", args.ToArray()); + var ret = await WriteAsync(new RedisArray.Generic>(cmd)); + return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(decimal) : a.Item4[0], a.Item4 == null ? default(decimal) : a.Item4[1], a.Item3)).ToArray(); } #endregion } diff --git a/src/RedisClient.Sync.cs b/src/RedisClient.Sync.cs index d269ebe..80048f0 100644 --- a/src/RedisClient.Sync.cs +++ b/src/RedisClient.Sync.cs @@ -533,7 +533,7 @@ public long HIncrBy(string key, string field, long increment) /// Field to increment /// Increment value /// Value of field after increment - public double HIncrByFloat(string key, string field, double increment) + public decimal HIncrByFloat(string key, string field, decimal increment) { return Write(RedisCommands.HIncrByFloat(key, field, increment)); } @@ -1217,19 +1217,19 @@ public RedisScan SScanBytes(string key, long cursor, string pattern = nu #endregion #region Sorted Sets - public Tuple[] ZPopMax(string key, long count) + public Tuple[] ZPopMax(string key, long count) { return Write(RedisCommands.ZPopMax(key, count)); } - public Tuple[] ZPopMaxBytes(string key, long count) + public Tuple[] ZPopMaxBytes(string key, long count) { return Write(RedisCommands.ZPopMaxBytes(key, count)); } - public Tuple[] ZPopMin(string key, long count) + public Tuple[] ZPopMin(string key, long count) { return Write(RedisCommands.ZPopMin(key, count)); } - public Tuple[] ZPopMinBytes(string key, long count) + public Tuple[] ZPopMinBytes(string key, long count) { return Write(RedisCommands.ZPopMinBytes(key, count)); } @@ -1275,7 +1275,7 @@ public long ZCard(string key) /// Minimum score is exclusive /// Maximum score is exclusive /// Number of elements in the specified score range - public long ZCount(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false) + public long ZCount(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false) { return Write(RedisCommands.ZCount(key, min, max, exclusiveMin, exclusiveMax)); } @@ -1299,7 +1299,7 @@ public long ZCount(string key, string min, string max) /// Increment by value /// Sorted set member to increment /// New score of member - public double ZIncrBy(string key, double increment, object member) + public decimal ZIncrBy(string key, decimal increment, object member) { return Write(RedisCommands.ZIncrBy(key, increment, member)); } @@ -1312,7 +1312,7 @@ public double ZIncrBy(string key, double increment, object member) /// Aggregation function of resulting set /// Sorted set keys to intersect /// Number of elements in the resulting sorted set - public long ZInterStore(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys) + public long ZInterStore(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys) { return Write(RedisCommands.ZInterStore(destination, weights, aggregate, keys)); } @@ -1352,11 +1352,11 @@ public byte[][] ZRangeBytes(string key, long start, long stop, bool withScores = /// Start offset /// Stop offset /// Array of elements in the specified range with scores - public Tuple[] ZRangeWithScores(string key, long start, long stop) + public Tuple[] ZRangeWithScores(string key, long start, long stop) { return Write(RedisCommands.ZRangeWithScores(key, start, stop)); } - public Tuple[] ZRangeBytesWithScores(string key, long start, long stop) + public Tuple[] ZRangeBytesWithScores(string key, long start, long stop) { return Write(RedisCommands.ZRangeBytesWithScores(key, start, stop)); } @@ -1373,11 +1373,11 @@ public Tuple[] ZRangeBytesWithScores(string key, long start, lon /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - public string[] ZRangeByScore(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public string[] ZRangeByScore(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { return Write(RedisCommands.ZRangeByScore(key, min, max, withScores, exclusiveMin, exclusiveMax, offset, count)); } - public byte[][] ZRangeBytesByScore(string key, double min, double max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public byte[][] ZRangeBytesByScore(string key, decimal min, decimal max, bool withScores = false, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { return Write(RedisCommands.ZRangeBytesByScore(key, min, max, withScores, exclusiveMin, exclusiveMax, offset, count)); } @@ -1412,11 +1412,11 @@ public byte[][] ZRangeBytesByScore(string key, string min, string max, bool with /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - public Tuple[] ZRangeByScoreWithScores(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public Tuple[] ZRangeByScoreWithScores(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { return Write(RedisCommands.ZRangeByScoreWithScores(key, min, max, exclusiveMin, exclusiveMax, offset, count)); } - public Tuple[] ZRangeBytesByScoreWithScores(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) + public Tuple[] ZRangeBytesByScoreWithScores(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false, long? offset = null, long? count = null) { return Write(RedisCommands.ZRangeBytesByScoreWithScores(key, min, max, exclusiveMin, exclusiveMax, offset, count)); } @@ -1430,11 +1430,11 @@ public Tuple[] ZRangeBytesByScoreWithScores(string key, double m /// Start offset /// Number of elements to return /// List of elements in the specified range (with optional scores) - public Tuple[] ZRangeByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null) + public Tuple[] ZRangeByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null) { return Write(RedisCommands.ZRangeByScoreWithScores(key, min, max, offset, count)); } - public Tuple[] ZRangeBytesByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null) + public Tuple[] ZRangeBytesByScoreWithScores(string key, string min, string max, long? offset = null, long? count = null) { return Write(RedisCommands.ZRangeBytesByScoreWithScores(key, min, max, offset, count)); } @@ -1482,7 +1482,7 @@ public long ZRemRangeByRank(string key, long start, long stop) /// Minimum score is exclusive /// Maximum score is exclusive /// Number of elements removed - public long ZRemRangeByScore(string key, double min, double max, bool exclusiveMin = false, bool exclusiveMax = false) + public long ZRemRangeByScore(string key, decimal min, decimal max, bool exclusiveMin = false, bool exclusiveMax = false) { return Write(RedisCommands.ZRemRangeByScore(key, min, max, exclusiveMin, exclusiveMax)); } @@ -1515,11 +1515,11 @@ public byte[][] ZRevRangeBytes(string key, long start, long stop, bool withScore /// Start offset /// Stop offset /// List of elements in the specified range (with optional scores) - public Tuple[] ZRevRangeWithScores(string key, long start, long stop) + public Tuple[] ZRevRangeWithScores(string key, long start, long stop) { return Write(RedisCommands.ZRevRangeWithScores(key, start, stop)); } - public Tuple[] ZRevRangeBytesWithScores(string key, long start, long stop) + public Tuple[] ZRevRangeBytesWithScores(string key, long start, long stop) { return Write(RedisCommands.ZRevRangeBytesWithScores(key, start, stop)); } @@ -1536,11 +1536,11 @@ public Tuple[] ZRevRangeBytesWithScores(string key, long start, /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - public string[] ZRevRangeByScore(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public string[] ZRevRangeByScore(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { return Write(RedisCommands.ZRevRangeByScore(key, max, min, withScores, exclusiveMax, exclusiveMin, offset, count)); } - public byte[][] ZRevRangeBytesByScore(string key, double max, double min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public byte[][] ZRevRangeBytesByScore(string key, decimal max, decimal min, bool withScores = false, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { return Write(RedisCommands.ZRevRangeBytesByScore(key, max, min, withScores, exclusiveMax, exclusiveMin, offset, count)); } @@ -1575,11 +1575,11 @@ public byte[][] ZRevRangeBytesByScore(string key, string max, string min, bool w /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - public Tuple[] ZRevRangeByScoreWithScores(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public Tuple[] ZRevRangeByScoreWithScores(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { return Write(RedisCommands.ZRevRangeByScoreWithScores(key, max, min, exclusiveMax, exclusiveMin, offset, count)); } - public Tuple[] ZRevRangeBytesByScoreWithScores(string key, double max, double min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) + public Tuple[] ZRevRangeBytesByScoreWithScores(string key, decimal max, decimal min, bool exclusiveMax = false, bool exclusiveMin = false, long? offset = null, long? count = null) { return Write(RedisCommands.ZRevRangeBytesByScoreWithScores(key, max, min, exclusiveMax, exclusiveMin, offset, count)); } @@ -1593,11 +1593,11 @@ public Tuple[] ZRevRangeBytesByScoreWithScores(string key, doubl /// Start offset /// Number of elements to return /// List of elements in the specified score range (with optional scores) - public Tuple[] ZRevRangeByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null) + public Tuple[] ZRevRangeByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null) { return Write(RedisCommands.ZRevRangeByScoreWithScores(key, max, min, offset, count)); } - public Tuple[] ZRevRangeBytesByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null) + public Tuple[] ZRevRangeBytesByScoreWithScores(string key, string max, string min, long? offset = null, long? count = null) { return Write(RedisCommands.ZRevRangeBytesByScoreWithScores(key, max, min, offset, count)); } @@ -1619,7 +1619,7 @@ public Tuple[] ZRevRangeBytesByScoreWithScores(string key, strin /// Sorted set key /// Member to lookup /// Score of member, or null if member does not exist - public double? ZScore(string key, object member) + public decimal? ZScore(string key, object member) { return Write(RedisCommands.ZScore(key, member)); } @@ -1632,7 +1632,7 @@ public Tuple[] ZRevRangeBytesByScoreWithScores(string key, strin /// Aggregation function of resulting set /// Sorted set keys to union /// Number of elements in the resulting sorted set - public long ZUnionStore(string destination, double[] weights = null, RedisAggregate? aggregate = null, params string[] keys) + public long ZUnionStore(string destination, decimal[] weights = null, RedisAggregate? aggregate = null, params string[] keys) { return Write(RedisCommands.ZUnionStore(destination, weights, aggregate, keys)); } @@ -1656,11 +1656,11 @@ public long ZUnionStore(string destination, params string[] keys) /// Glob-style pattern to filter returned elements /// Maximum number of elements to return /// Updated cursor and result set - public RedisScan> ZScan(string key, long cursor, string pattern = null, long? count = null) + public RedisScan> ZScan(string key, long cursor, string pattern = null, long? count = null) { return Write(RedisCommands.ZScan(key, cursor, pattern, count)); } - public RedisScan> ZScanBytes(string key, long cursor, string pattern = null, long? count = null) + public RedisScan> ZScanBytes(string key, long cursor, string pattern = null, long? count = null) { return Write(RedisCommands.ZScanBytes(key, cursor, pattern, count)); } @@ -2004,7 +2004,7 @@ public long IncrBy(string key, long increment) /// Key to modify /// Increment amount /// Value of key after increment - public double IncrByFloat(string key, double increment) + public decimal IncrByFloat(string key, decimal increment) { return Write(RedisCommands.IncrByFloat(key, increment)); } @@ -2557,7 +2557,7 @@ public string PfMerge(string destKey, params string[] sourceKeys) #endregion #region Geo redis-server 3.2 - public long GeoAdd(string key, params (double longitude, double latitude, object member)[] values) + public long GeoAdd(string key, params (decimal longitude, decimal latitude, object member)[] values) { if (values == null || values.Length == 0) throw new Exception("values 参数不能为空"); var args = new List(); @@ -2565,7 +2565,7 @@ public long GeoAdd(string key, params (double longitude, double latitude, object foreach (var v in values) args.AddRange(new object[] { v.longitude, v.latitude, v.member }); return Write(new RedisInt("GEOADD", args.ToArray())); } - public double? GeoDist(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) + public decimal? GeoDist(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) { if (unit == GeoUnit.m) return Write(new RedisFloat.Nullable("GEODIST", key, member1, member2)); return Write(new RedisFloat.Nullable("GEODIST", key, member1, member2, unit)); @@ -2578,16 +2578,16 @@ public string[] GeoHash(string key, object[] members) args.AddRange(members); return Write(new RedisArray.Strings("GEOHASH", args.ToArray())); } - public (double longitude, double latitude)?[] GeoPos(string key, object[] members) + public (decimal longitude, decimal latitude)?[] GeoPos(string key, object[] members) { if (members == null || members.Length == 0) throw new Exception("values 参数不能为空"); var args = new List(); args.Add(key); args.AddRange(members); - var ret = Write(new RedisArray.Generic(new RedisArray.Generic(new RedisFloat("GEOPOS", args.ToArray())))); - return ret.Select(a => a != null && a.Length == 2 ? new (double, double)?((a[0], a[1])) : null).ToArray(); + var ret = Write(new RedisArray.Generic(new RedisArray.Generic(new RedisFloat("GEOPOS", args.ToArray())))); + return ret.Select(a => a != null && a.Length == 2 ? new (decimal, decimal)?((a[0], a[1])) : null).ToArray(); } - public (string member, double dist, double longitude, double latitude, long hash)[] GeoRadius(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) + public (string member, decimal dist, decimal longitude, decimal latitude, long hash)[] GeoRadius(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) { var args = new List(new object[] { key, longitude, latitude, radius, unit }); if (withCoord) args.Add("WITHCOORD"); @@ -2596,15 +2596,15 @@ public string[] GeoHash(string key, object[] members) if (count.HasValue) args.AddRange(new object[] { "COUNT", count }); if (sorting.HasValue) args.Add(sorting); - var cmd = new RedisTuple.Generic.Single( + var cmd = new RedisTuple.Generic.Single( new RedisString(null), withDist == false ? null : new RedisFloat(null), withHash == false ? null : new RedisInt(null), - withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUS", args.ToArray()); - var ret = Write(new RedisArray.Generic>(cmd)); - return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(double) : a.Item4[0], a.Item4 == null ? default(double) : a.Item4[1], a.Item3)).ToArray(); + withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUS", args.ToArray()); + var ret = Write(new RedisArray.Generic>(cmd)); + return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(decimal) : a.Item4[0], a.Item4 == null ? default(decimal) : a.Item4[1], a.Item3)).ToArray(); } - public (byte[] member, double dist, double longitude, double latitude, long hash)[] GeoRadiusBytes(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) + public (byte[] member, decimal dist, decimal longitude, decimal latitude, long hash)[] GeoRadiusBytes(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) { var args = new List(new object[] { key, longitude, latitude, radius, unit }); if (withCoord) args.Add("WITHCOORD"); @@ -2613,15 +2613,15 @@ public string[] GeoHash(string key, object[] members) if (count.HasValue) args.AddRange(new object[] { "COUNT", count }); if (sorting.HasValue) args.Add(sorting); - var cmd = new RedisTuple.Generic.Single( + var cmd = new RedisTuple.Generic.Single( new RedisBytes(null), withDist == false ? null : new RedisFloat(null), withHash == false ? null : new RedisInt(null), - withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUS", args.ToArray()); - var ret = Write(new RedisArray.Generic>(cmd)); - return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(double) : a.Item4[0], a.Item4 == null ? default(double) : a.Item4[1], a.Item3)).ToArray(); + withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUS", args.ToArray()); + var ret = Write(new RedisArray.Generic>(cmd)); + return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(decimal) : a.Item4[0], a.Item4 == null ? default(decimal) : a.Item4[1], a.Item3)).ToArray(); } - public (string member, double dist, double longitude, double latitude, long hash)[] GeoRadiusByMember(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) + public (string member, decimal dist, decimal longitude, decimal latitude, long hash)[] GeoRadiusByMember(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) { var args = new List(new object[] { key, member, radius, unit }); if (withCoord) args.Add("WITHCOORD"); @@ -2630,15 +2630,15 @@ public string[] GeoHash(string key, object[] members) if (count.HasValue) args.AddRange(new object[] { "COUNT", count }); if (sorting.HasValue) args.Add(sorting); - var cmd = new RedisTuple.Generic.Single( + var cmd = new RedisTuple.Generic.Single( new RedisString(null), withDist == false ? null : new RedisFloat(null), withHash == false ? null : new RedisInt(null), - withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUSBYMEMBER", args.ToArray()); - var ret = Write(new RedisArray.Generic>(cmd)); - return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(double) : a.Item4[0], a.Item4 == null ? default(double) : a.Item4[1], a.Item3)).ToArray(); + withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUSBYMEMBER", args.ToArray()); + var ret = Write(new RedisArray.Generic>(cmd)); + return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(decimal) : a.Item4[0], a.Item4 == null ? default(decimal) : a.Item4[1], a.Item3)).ToArray(); } - public (byte[] member, double dist, double longitude, double latitude, long hash)[] GeoRadiusBytesByMember(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) + public (byte[] member, decimal dist, decimal longitude, decimal latitude, long hash)[] GeoRadiusBytesByMember(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null, bool withCoord = false, bool withDist = false, bool withHash = false) { var args = new List(new object[] { key, member, radius, unit }); if (withCoord) args.Add("WITHCOORD"); @@ -2647,13 +2647,13 @@ public string[] GeoHash(string key, object[] members) if (count.HasValue) args.AddRange(new object[] { "COUNT", count }); if (sorting.HasValue) args.Add(sorting); - var cmd = new RedisTuple.Generic.Single( + var cmd = new RedisTuple.Generic.Single( new RedisBytes(null), withDist == false ? null : new RedisFloat(null), withHash == false ? null : new RedisInt(null), - withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUSBYMEMBER", args.ToArray()); - var ret = Write(new RedisArray.Generic>(cmd)); - return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(double) : a.Item4[0], a.Item4 == null ? default(double) : a.Item4[1], a.Item3)).ToArray(); + withCoord == false ? null : new RedisArray.Generic(new RedisFloat(null)), "GEORADIUSBYMEMBER", args.ToArray()); + var ret = Write(new RedisArray.Generic>(cmd)); + return ret.Select(a => (a.Item1, a.Item2, a.Item4 == null ? default(decimal) : a.Item4[0], a.Item4 == null ? default(decimal) : a.Item4[1], a.Item3)).ToArray(); } #endregion diff --git a/src/RedisHelper.cs b/src/RedisHelper.cs index 55ee60c..36c8040 100644 --- a/src/RedisHelper.cs +++ b/src/RedisHelper.cs @@ -280,7 +280,7 @@ public static void Initialization(CSRedisClient csredis) /// 不含prefix前辍 /// 一个或多个成员分数 /// - public static long ZAdd(string key, params (double, object)[] scoreMembers) => Instance.ZAdd(key, scoreMembers); + public static long ZAdd(string key, params (decimal, object)[] scoreMembers) => Instance.ZAdd(key, scoreMembers); /// /// 获取有序集合的成员数量 /// @@ -291,10 +291,10 @@ public static void Initialization(CSRedisClient csredis) /// 计算在有序集合中指定区间分数的成员数量 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public static long ZCount(string key, double min, double max) => Instance.ZCount(key, min, max); + public static long ZCount(string key, decimal min, decimal max) => Instance.ZCount(key, min, max); /// /// 计算在有序集合中指定区间分数的成员数量 /// @@ -310,7 +310,7 @@ public static void Initialization(CSRedisClient csredis) /// 成员 /// 增量值(默认=1) /// - public static double ZIncrBy(string key, string member, double increment = 1) => Instance.ZIncrBy(key, member, increment); + public static decimal ZIncrBy(string key, string member, decimal increment = 1) => Instance.ZIncrBy(key, member, increment); /// /// 计算给定的一个或多个有序集的交集,将结果集存储在新的有序集合 destination 中 @@ -320,7 +320,7 @@ public static void Initialization(CSRedisClient csredis) /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public static long ZInterStore(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) => Instance.ZInterStore(destination, weights, aggregate, keys); + public static long ZInterStore(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) => Instance.ZInterStore(destination, weights, aggregate, keys); /// /// 通过索引区间返回有序集合成指定区间内的成员 @@ -346,7 +346,7 @@ public static void Initialization(CSRedisClient csredis) /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public static (string member, double score)[] ZRangeWithScores(string key, long start, long stop) => Instance.ZRangeWithScores(key, start, stop); + public static (string member, decimal score)[] ZRangeWithScores(string key, long start, long stop) => Instance.ZRangeWithScores(key, start, stop); /// /// 通过索引区间返回有序集合成指定区间内的成员和分数 /// @@ -355,30 +355,30 @@ public static void Initialization(CSRedisClient csredis) /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public static (T member, double score)[] ZRangeWithScores(string key, long start, long stop) => Instance.ZRangeWithScores(key, start, stop); + public static (T member, decimal score)[] ZRangeWithScores(string key, long start, long stop) => Instance.ZRangeWithScores(key, start, stop); /// /// 通过分数返回有序集合指定区间内的成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public static string[] ZRangeByScore(string key, double min, double max, long? limit = null, long offset = 0) => + public static string[] ZRangeByScore(string key, decimal min, decimal max, long? limit = null, long offset = 0) => Instance.ZRangeByScore(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public static T[] ZRangeByScore(string key, double min, double max, long? limit = null, long offset = 0) => + public static T[] ZRangeByScore(string key, decimal min, decimal max, long? limit = null, long offset = 0) => Instance.ZRangeByScore(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员 @@ -408,24 +408,24 @@ public static T[] ZRangeByScore(string key, string min, string max, long? lim /// 通过分数返回有序集合指定区间内的成员和分数 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public static (string member, double score)[] ZRangeByScoreWithScores(string key, double min, double max, long? limit = null, long offset = 0) => + public static (string member, decimal score)[] ZRangeByScoreWithScores(string key, decimal min, decimal max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreWithScores(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员和分数 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public static (T member, double score)[] ZRangeByScoreWithScores(string key, double min, double max, long? limit = null, long offset = 0) => + public static (T member, decimal score)[] ZRangeByScoreWithScores(string key, decimal min, decimal max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreWithScores(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员和分数 @@ -436,7 +436,7 @@ public static (T member, double score)[] ZRangeByScoreWithScores(string key, /// 返回多少成员 /// 返回条件偏移位置 /// - public static (string member, double score)[] ZRangeByScoreWithScores(string key, string min, string max, long? limit = null, long offset = 0) => + public static (string member, decimal score)[] ZRangeByScoreWithScores(string key, string min, string max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreWithScores(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员和分数 @@ -448,7 +448,7 @@ public static (string member, double score)[] ZRangeByScoreWithScores(string key /// 返回多少成员 /// 返回条件偏移位置 /// - public static (T member, double score)[] ZRangeByScoreWithScores(string key, string min, string max, long? limit = null, long offset = 0) => + public static (T member, decimal score)[] ZRangeByScoreWithScores(string key, string min, string max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreWithScores(key, min, max, limit, offset); /// @@ -477,10 +477,10 @@ public static (T member, double score)[] ZRangeByScoreWithScores(string key, /// 移除有序集合中给定的分数区间的所有成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public static long ZRemRangeByScore(string key, double min, double max) => Instance.ZRemRangeByScore(key, min, max); + public static long ZRemRangeByScore(string key, decimal min, decimal max) => Instance.ZRemRangeByScore(key, min, max); /// /// 移除有序集合中给定的分数区间的所有成员 /// @@ -514,7 +514,7 @@ public static (T member, double score)[] ZRangeByScoreWithScores(string key, /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public static (string member, double score)[] ZRevRangeWithScores(string key, long start, long stop) => Instance.ZRevRangeWithScores(key, start, stop); + public static (string member, decimal score)[] ZRevRangeWithScores(string key, long start, long stop) => Instance.ZRevRangeWithScores(key, start, stop); /// /// 返回有序集中指定区间内的成员和分数,通过索引,分数从高到底 /// @@ -523,29 +523,29 @@ public static (T member, double score)[] ZRangeByScoreWithScores(string key, /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public static (T member, double score)[] ZRevRangeWithScores(string key, long start, long stop) => Instance.ZRevRangeWithScores(key, start, stop); + public static (T member, decimal score)[] ZRevRangeWithScores(string key, long start, long stop) => Instance.ZRevRangeWithScores(key, start, stop); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public static string[] ZRevRangeByScore(string key, double max, double min, long? limit = null, long? offset = 0) => Instance.ZRevRangeByScore(key, max, min, limit, offset); + public static string[] ZRevRangeByScore(string key, decimal max, decimal min, long? limit = null, long? offset = 0) => Instance.ZRevRangeByScore(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public static T[] ZRevRangeByScore(string key, double max, double min, long? limit = null, long offset = 0) => + public static T[] ZRevRangeByScore(string key, decimal max, decimal min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScore(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 @@ -574,24 +574,24 @@ public static T[] ZRevRangeByScore(string key, string max, string min, long? /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public static (string member, double score)[] ZRevRangeByScoreWithScores(string key, double max, double min, long? limit = null, long offset = 0) => + public static (string member, decimal score)[] ZRevRangeByScoreWithScores(string key, decimal max, decimal min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreWithScores(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public static (T member, double score)[] ZRevRangeByScoreWithScores(string key, double max, double min, long? limit = null, long offset = 0) => + public static (T member, decimal score)[] ZRevRangeByScoreWithScores(string key, decimal max, decimal min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreWithScores(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 @@ -602,7 +602,7 @@ public static (T member, double score)[] ZRevRangeByScoreWithScores(string ke /// 返回多少成员 /// 返回条件偏移位置 /// - public static (string member, double score)[] ZRevRangeByScoreWithScores(string key, string max, string min, long? limit = null, long offset = 0) => + public static (string member, decimal score)[] ZRevRangeByScoreWithScores(string key, string max, string min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreWithScores(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 @@ -614,7 +614,7 @@ public static (string member, double score)[] ZRevRangeByScoreWithScores(string /// 返回多少成员 /// 返回条件偏移位置 /// - public static (T member, double score)[] ZRevRangeByScoreWithScores(string key, string max, string min, long? limit = null, long offset = 0) => + public static (T member, decimal score)[] ZRevRangeByScoreWithScores(string key, string max, string min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreWithScores(key, max, min, limit, offset); /// @@ -630,7 +630,7 @@ public static (T member, double score)[] ZRevRangeByScoreWithScores(string ke /// 不含prefix前辍 /// 成员 /// - public static double? ZScore(string key, object member) => Instance.ZScore(key, member); + public static decimal? ZScore(string key, object member) => Instance.ZScore(key, member); /// /// 计算给定的一个或多个有序集的并集,将结果集存储在新的有序集合 destination 中 @@ -640,7 +640,7 @@ public static (T member, double score)[] ZRevRangeByScoreWithScores(string ke /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public static long ZUnionStore(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) => Instance.ZUnionStore(destination, weights, aggregate, keys); + public static long ZUnionStore(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) => Instance.ZUnionStore(destination, weights, aggregate, keys); /// /// 迭代有序集合中的元素 @@ -650,7 +650,7 @@ public static (T member, double score)[] ZRevRangeByScoreWithScores(string ke /// 模式 /// 数量 /// - public static RedisScan<(string member, double score)> ZScan(string key, long cursor, string pattern = null, long? count = null) => + public static RedisScan<(string member, decimal score)> ZScan(string key, long cursor, string pattern = null, long? count = null) => Instance.ZScan(key, cursor, pattern, count); /// /// 迭代有序集合中的元素 @@ -661,7 +661,7 @@ public static (T member, double score)[] ZRevRangeByScoreWithScores(string ke /// 模式 /// 数量 /// - public static RedisScan<(T member, double score)> ZScan(string key, long cursor, string pattern = null, long? count = null) => + public static RedisScan<(T member, decimal score)> ZScan(string key, long cursor, string pattern = null, long? count = null) => Instance.ZScan(key, cursor, pattern, count); /// @@ -1185,7 +1185,7 @@ public static RedisScan SScan(string key, long cursor, string pattern = nu /// 字段 /// 增量值(默认=1) /// - public static double HIncrByFloat(string key, string field, double value = 1) => Instance.HIncrByFloat(key, field, value); + public static decimal HIncrByFloat(string key, string field, decimal value = 1) => Instance.HIncrByFloat(key, field, value); /// /// 获取所有哈希表中的字段 /// @@ -1370,7 +1370,7 @@ public static RedisScan SScan(string key, long cursor, string pattern = nu /// 不含prefix前辍 /// 增量值(默认=1) /// - public static double IncrByFloat(string key, double value = 1) => Instance.IncrByFloat(key, value); + public static decimal IncrByFloat(string key, decimal value = 1) => Instance.IncrByFloat(key, value); /// /// 获取多个指定 key 的值(数组) /// @@ -1404,8 +1404,8 @@ public static RedisScan SScan(string key, long cursor, string pattern = nu /// 过期(秒单位) /// Nx, Xx /// - public static bool Set(string key, object value, int expireSeconds = -1, RedisExistence? exists = null) => - Instance.Set(key, value, expireSeconds, exists); + public static bool Set(string key, object value, int expireSeconds = -1, RedisExistence? exists = null) => Instance.Set(key, value, expireSeconds, exists); + public static bool Set(string key, object value, TimeSpan expire, RedisExistence? exists = null) => Instance.Set(key, value, expire, exists); /// /// 对 key 所储存的字符串值,设置或清除指定偏移量上的位(bit) /// @@ -1649,14 +1649,14 @@ public static long SortAndStore(string key, string destination, long? count = nu /// 纬度 /// 成员 /// 是否成功 - public static bool GeoAdd(string key, double longitude, double latitude, object member) => Instance.GeoAdd(key, longitude, latitude, member); + public static bool GeoAdd(string key, decimal longitude, decimal latitude, object member) => Instance.GeoAdd(key, longitude, latitude, member); /// /// 将指定的地理空间位置(纬度、经度、成员)添加到指定的key中。这些数据将会存储到sorted set这样的目的是为了方便使用GEORADIUS或者GEORADIUSBYMEMBER命令对数据进行半径查询等操作。 /// /// 不含prefix前辍 /// 批量添加的值 /// 添加到sorted set元素的数目,但不包括已更新score的元素。 - public static long GeoAdd(string key, params (double longitude, double latitude, object member)[] values) => Instance.GeoAdd(key, values); + public static long GeoAdd(string key, params (decimal longitude, decimal latitude, object member)[] values) => Instance.GeoAdd(key, values); /// /// 返回两个给定位置之间的距离。如果两个位置之间的其中一个不存在, 那么命令返回空值。GEODIST 命令在计算距离时会假设地球为完美的球形, 在极限情况下, 这一假设最大会造成 0.5% 的误差。 /// @@ -1665,7 +1665,7 @@ public static long SortAndStore(string key, string destination, long? count = nu /// 成员2 /// m 表示单位为米;km 表示单位为千米;mi 表示单位为英里;ft 表示单位为英尺; /// 计算出的距离会以双精度浮点数的形式被返回。 如果给定的位置元素不存在, 那么命令返回空值。 - public static double? GeoDist(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) => Instance.GeoDist(key, member1, member2, unit); + public static decimal? GeoDist(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) => Instance.GeoDist(key, member1, member2, unit); /// /// 返回一个或多个位置元素的 Geohash 表示。通常使用表示位置的元素使用不同的技术,使用Geohash位置52点整数编码。由于编码和解码过程中所使用的初始最小和最大坐标不同,编码的编码也不同于标准。 /// @@ -1679,7 +1679,7 @@ public static long SortAndStore(string key, string destination, long? count = nu /// 不含prefix前辍 /// 多个查询的成员 /// GEOPOS 命令返回一个数组, 数组中的每个项都由两个元素组成: 第一个元素为给定位置元素的经度, 而第二个元素则为给定位置元素的纬度。当给定的位置元素不存在时, 对应的数组项为空值。 - public static (double longitude, double latitude)?[] GeoPos(string key, object[] members) => Instance.GeoPos(key, members); + public static (decimal longitude, decimal latitude)?[] GeoPos(string key, object[] members) => Instance.GeoPos(key, members); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -1692,7 +1692,7 @@ public static long SortAndStore(string key, string destination, long? count = nu /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static string[] GeoRadius(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static string[] GeoRadius(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadius(key, longitude, latitude, radius, unit, count, sorting); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -1705,7 +1705,7 @@ public static string[] GeoRadius(string key, double longitude, double latitude, /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static T[] GeoRadius(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static T[] GeoRadius(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadius(key, longitude, latitude, radius, unit, count, sorting); /// @@ -1719,7 +1719,7 @@ public static T[] GeoRadius(string key, double longitude, double latitude, do /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static (string member, double dist)[] GeoRadiusWithDist(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static (string member, decimal dist)[] GeoRadiusWithDist(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusWithDist(key, longitude, latitude, radius, unit, count, sorting); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离)。 @@ -1732,7 +1732,7 @@ public static (string member, double dist)[] GeoRadiusWithDist(string key, doubl /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static (T member, double dist)[] GeoRadiusWithDist(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static (T member, decimal dist)[] GeoRadiusWithDist(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusWithDist(key, longitude, latitude, radius, unit, count, sorting); ///// @@ -1746,7 +1746,7 @@ public static (T member, double dist)[] GeoRadiusWithDist(string key, double ///// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 ///// 排序 ///// - //private static (string member, double longitude, double latitude)[] GeoRadiusWithCoord(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + //private static (string member, decimal longitude, decimal latitude)[] GeoRadiusWithCoord(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => // Instance.GeoRadiusWithCoord(key, longitude, latitude, radius, unit, count, sorting); ///// ///// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含经度、纬度)。 @@ -1759,7 +1759,7 @@ public static (T member, double dist)[] GeoRadiusWithDist(string key, double ///// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 ///// 排序 ///// - //private static (T member, double longitude, double latitude)[] GeoRadiusWithCoord(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + //private static (T member, decimal longitude, decimal latitude)[] GeoRadiusWithCoord(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => // Instance.GeoRadiusWithCoord(key, longitude, latitude, radius, unit, count, sorting); /// @@ -1773,7 +1773,7 @@ public static (T member, double dist)[] GeoRadiusWithDist(string key, double /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static (string member, double dist, double longitude, double latitude)[] GeoRadiusWithDistAndCoord(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static (string member, decimal dist, decimal longitude, decimal latitude)[] GeoRadiusWithDistAndCoord(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusWithDistAndCoord(key, longitude, latitude, radius, unit, count, sorting); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离、经度、纬度)。 @@ -1786,7 +1786,7 @@ public static (string member, double dist, double longitude, double latitude)[] /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static (T member, double dist, double longitude, double latitude)[] GeoRadiusWithDistAndCoord(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static (T member, decimal dist, decimal longitude, decimal latitude)[] GeoRadiusWithDistAndCoord(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusWithDistAndCoord(key, longitude, latitude, radius, unit, count, sorting); /// @@ -1799,7 +1799,7 @@ public static (T member, double dist, double longitude, double latitude)[] GeoRa /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static string[] GeoRadiusByMember(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static string[] GeoRadiusByMember(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMember(key, member, radius, unit, count, sorting); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -1811,7 +1811,7 @@ public static string[] GeoRadiusByMember(string key, object member, double radiu /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static T[] GeoRadiusByMember(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static T[] GeoRadiusByMember(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMember(key, member, radius, unit, count, sorting); /// @@ -1824,7 +1824,7 @@ public static T[] GeoRadiusByMember(string key, object member, double radius, /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static (string member, double dist)[] GeoRadiusByMemberWithDist(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static (string member, decimal dist)[] GeoRadiusByMemberWithDist(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberWithDist(key, member, radius, unit, count, sorting); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离)。 @@ -1836,7 +1836,7 @@ public static (string member, double dist)[] GeoRadiusByMemberWithDist(string ke /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static (T member, double dist)[] GeoRadiusByMemberWithDist(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static (T member, decimal dist)[] GeoRadiusByMemberWithDist(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberWithDist(key, member, radius, unit, count, sorting); ///// @@ -1849,7 +1849,7 @@ public static (T member, double dist)[] GeoRadiusByMemberWithDist(string key, ///// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 ///// 排序 ///// - //private static (string member, double longitude, double latitude)[] GeoRadiusByMemberWithCoord(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + //private static (string member, decimal longitude, decimal latitude)[] GeoRadiusByMemberWithCoord(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => // Instance.GeoRadiusByMemberWithCoord(key, member, radius, unit, count, sorting); ///// ///// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含经度、纬度)。 @@ -1861,7 +1861,7 @@ public static (T member, double dist)[] GeoRadiusByMemberWithDist(string key, ///// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 ///// 排序 ///// - //private static (T member, double longitude, double latitude)[] GeoRadiusByMemberWithCoord(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + //private static (T member, decimal longitude, decimal latitude)[] GeoRadiusByMemberWithCoord(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => // Instance.GeoRadiusByMemberWithCoord(key, member, radius, unit, count, sorting); /// @@ -1874,7 +1874,7 @@ public static (T member, double dist)[] GeoRadiusByMemberWithDist(string key, /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static (string member, double dist, double longitude, double latitude)[] GeoRadiusByMemberWithDistAndCoord(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static (string member, decimal dist, decimal longitude, decimal latitude)[] GeoRadiusByMemberWithDistAndCoord(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberWithDistAndCoord(key, member, radius, unit, count, sorting); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离、经度、纬度)。 @@ -1886,7 +1886,7 @@ public static (string member, double dist, double longitude, double latitude)[] /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static (T member, double dist, double longitude, double latitude)[] GeoRadiusByMemberWithDistAndCoord(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static (T member, decimal dist, decimal longitude, decimal latitude)[] GeoRadiusByMemberWithDistAndCoord(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberWithDistAndCoord(key, member, radius, unit, count, sorting); #endregion diff --git a/src/RedisHelperAsync.cs b/src/RedisHelperAsync.cs index 648e03e..15a9e95 100644 --- a/src/RedisHelperAsync.cs +++ b/src/RedisHelperAsync.cs @@ -177,7 +177,7 @@ partial class RedisHelper /// 不含prefix前辍 /// 一个或多个成员分数 /// - public static Task ZAddAsync(string key, params (double, object)[] scoreMembers) => Instance.ZAddAsync(key, scoreMembers); + public static Task ZAddAsync(string key, params (decimal, object)[] scoreMembers) => Instance.ZAddAsync(key, scoreMembers); /// /// 获取有序集合的成员数量 /// @@ -188,10 +188,10 @@ partial class RedisHelper /// 计算在有序集合中指定区间分数的成员数量 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public static Task ZCountAsync(string key, double min, double max) => Instance.ZCountAsync(key, min, max); + public static Task ZCountAsync(string key, decimal min, decimal max) => Instance.ZCountAsync(key, min, max); /// /// 计算在有序集合中指定区间分数的成员数量 /// @@ -207,7 +207,7 @@ partial class RedisHelper /// 成员 /// 增量值(默认=1) /// - public static Task ZIncrByAsync(string key, string member, double increment = 1) => Instance.ZIncrByAsync(key, member, increment); + public static Task ZIncrByAsync(string key, string member, decimal increment = 1) => Instance.ZIncrByAsync(key, member, increment); /// /// 计算给定的一个或多个有序集的交集,将结果集存储在新的有序集合 destination 中 @@ -217,7 +217,7 @@ partial class RedisHelper /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public static Task ZInterStoreAsync(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) => Instance.ZInterStoreAsync(destination, weights, aggregate, keys); + public static Task ZInterStoreAsync(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) => Instance.ZInterStoreAsync(destination, weights, aggregate, keys); /// /// 通过索引区间返回有序集合成指定区间内的成员 @@ -243,7 +243,7 @@ partial class RedisHelper /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public static Task<(string member, double score)[]> ZRangeWithScoresAsync(string key, long start, long stop) => Instance.ZRangeWithScoresAsync(key, start, stop); + public static Task<(string member, decimal score)[]> ZRangeWithScoresAsync(string key, long start, long stop) => Instance.ZRangeWithScoresAsync(key, start, stop); /// /// 通过索引区间返回有序集合成指定区间内的成员和分数 /// @@ -252,29 +252,29 @@ partial class RedisHelper /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public static Task<(T member, double score)[]> ZRangeWithScoresAsync(string key, long start, long stop) => Instance.ZRangeWithScoresAsync(key, start, stop); + public static Task<(T member, decimal score)[]> ZRangeWithScoresAsync(string key, long start, long stop) => Instance.ZRangeWithScoresAsync(key, start, stop); /// /// 通过分数返回有序集合指定区间内的成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task ZRangeByScoreAsync(string key, double min, double max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreAsync(key, min, max, limit, offset); + public static Task ZRangeByScoreAsync(string key, decimal min, decimal max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreAsync(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task ZRangeByScoreAsync(string key, double min, double max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreAsync(key, min, max, limit, offset); + public static Task ZRangeByScoreAsync(string key, decimal min, decimal max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreAsync(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员 /// @@ -301,24 +301,24 @@ partial class RedisHelper /// 通过分数返回有序集合指定区间内的成员和分数 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task<(string member, double score)[]> ZRangeByScoreWithScoresAsync(string key, double min, double max, long? limit = null, long offset = 0) => + public static Task<(string member, decimal score)[]> ZRangeByScoreWithScoresAsync(string key, decimal min, decimal max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreWithScoresAsync(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员和分数 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task<(T member, double score)[]> ZRangeByScoreWithScoresAsync(string key, double min, double max, long? limit = null, long offset = 0) => + public static Task<(T member, decimal score)[]> ZRangeByScoreWithScoresAsync(string key, decimal min, decimal max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreWithScoresAsync(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员和分数 @@ -329,7 +329,7 @@ partial class RedisHelper /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task<(string member, double score)[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? limit = null, long offset = 0) => + public static Task<(string member, decimal score)[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreWithScoresAsync(key, min, max, limit, offset); /// /// 通过分数返回有序集合指定区间内的成员和分数 @@ -341,7 +341,7 @@ partial class RedisHelper /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task<(T member, double score)[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? limit = null, long offset = 0) => + public static Task<(T member, decimal score)[]> ZRangeByScoreWithScoresAsync(string key, string min, string max, long? limit = null, long offset = 0) => Instance.ZRangeByScoreWithScoresAsync(key, min, max, limit, offset); /// @@ -370,10 +370,10 @@ partial class RedisHelper /// 移除有序集合中给定的分数区间的所有成员 /// /// 不含prefix前辍 - /// 分数最小值 double.MinValue 1 - /// 分数最大值 double.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 /// - public static Task ZRemRangeByScoreAsync(string key, double min, double max) => Instance.ZRemRangeByScoreAsync(key, min, max); + public static Task ZRemRangeByScoreAsync(string key, decimal min, decimal max) => Instance.ZRemRangeByScoreAsync(key, min, max); /// /// 移除有序集合中给定的分数区间的所有成员 /// @@ -407,7 +407,7 @@ partial class RedisHelper /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public static Task<(string member, double score)[]> ZRevRangeWithScoresAsync(string key, long start, long stop) => Instance.ZRevRangeWithScoresAsync(key, start, stop); + public static Task<(string member, decimal score)[]> ZRevRangeWithScoresAsync(string key, long start, long stop) => Instance.ZRevRangeWithScoresAsync(key, start, stop); /// /// 返回有序集中指定区间内的成员和分数,通过索引,分数从高到底 /// @@ -416,29 +416,29 @@ partial class RedisHelper /// 开始位置,0表示第一个元素,-1表示最后一个元素 /// 结束位置,0表示第一个元素,-1表示最后一个元素 /// - public static Task<(T member, double score)[]> ZRevRangeWithScoresAsync(string key, long start, long stop) => Instance.ZRevRangeWithScoresAsync(key, start, stop); + public static Task<(T member, decimal score)[]> ZRevRangeWithScoresAsync(string key, long start, long stop) => Instance.ZRevRangeWithScoresAsync(key, start, stop); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task ZRevRangeByScoreAsync(string key, double max, double min, long? limit = null, long? offset = 0) => Instance.ZRevRangeByScoreAsync(key, max, min, limit, offset); + public static Task ZRevRangeByScoreAsync(string key, decimal max, decimal min, long? limit = null, long? offset = 0) => Instance.ZRevRangeByScoreAsync(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task ZRevRangeByScoreAsync(string key, double max, double min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreAsync(key, max, min, limit, offset); + public static Task ZRevRangeByScoreAsync(string key, decimal max, decimal min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreAsync(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员,分数从高到低排序 /// @@ -465,24 +465,24 @@ partial class RedisHelper /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task<(string member, double score)[]> ZRevRangeByScoreWithScoresAsync(string key, double max, double min, long? limit = null, long offset = 0) => + public static Task<(string member, decimal score)[]> ZRevRangeByScoreWithScoresAsync(string key, decimal max, decimal min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreWithScoresAsync(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 /// /// byte[] 或其他类型 /// 不含prefix前辍 - /// 分数最大值 double.MaxValue 10 - /// 分数最小值 double.MinValue 1 + /// 分数最大值 decimal.MaxValue 10 + /// 分数最小值 decimal.MinValue 1 /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task<(T member, double score)[]> ZRevRangeByScoreWithScoresAsync(string key, double max, double min, long? limit = null, long offset = 0) => + public static Task<(T member, decimal score)[]> ZRevRangeByScoreWithScoresAsync(string key, decimal max, decimal min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreWithScoresAsync(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 @@ -493,7 +493,7 @@ partial class RedisHelper /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task<(string member, double score)[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? limit = null, long offset = 0) => + public static Task<(string member, decimal score)[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreWithScoresAsync(key, max, min, limit, offset); /// /// 返回有序集中指定分数区间内的成员和分数,分数从高到低排序 @@ -505,7 +505,7 @@ partial class RedisHelper /// 返回多少成员 /// 返回条件偏移位置 /// - public static Task<(T member, double score)[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? limit = null, long offset = 0) => + public static Task<(T member, decimal score)[]> ZRevRangeByScoreWithScoresAsync(string key, string max, string min, long? limit = null, long offset = 0) => Instance.ZRevRangeByScoreWithScoresAsync(key, max, min, limit, offset); /// @@ -521,7 +521,7 @@ partial class RedisHelper /// 不含prefix前辍 /// 成员 /// - public static Task ZScoreAsync(string key, object member) => Instance.ZScoreAsync(key, member); + public static Task ZScoreAsync(string key, object member) => Instance.ZScoreAsync(key, member); /// /// 计算给定的一个或多个有序集的并集,将结果集存储在新的有序集合 destination 中 @@ -531,7 +531,7 @@ partial class RedisHelper /// Sum | Min | Max /// 一个或多个有序集合,不含prefix前辍 /// - public static Task ZUnionStoreAsync(string destination, double[] weights, RedisAggregate aggregate, params string[] keys) => Instance.ZUnionStoreAsync(destination, weights, aggregate, keys); + public static Task ZUnionStoreAsync(string destination, decimal[] weights, RedisAggregate aggregate, params string[] keys) => Instance.ZUnionStoreAsync(destination, weights, aggregate, keys); /// /// 迭代有序集合中的元素 @@ -541,7 +541,7 @@ partial class RedisHelper /// 模式 /// 数量 /// - public static Task> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) => + public static Task> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) => Instance.ZScanAsync(key, cursor, pattern, count); /// /// 迭代有序集合中的元素 @@ -552,7 +552,7 @@ partial class RedisHelper /// 模式 /// 数量 /// - public static Task> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) => + public static Task> ZScanAsync(string key, long cursor, string pattern = null, long? count = null) => Instance.ZScanAsync(key, cursor, pattern, count); /// @@ -995,7 +995,7 @@ public static Task ZLexCountAsync(string key, string min, string max) => /// 字段 /// 增量值(默认=1) /// - public static Task HIncrByFloatAsync(string key, string field, double value = 1) => Instance.HIncrByFloatAsync(key, field, value); + public static Task HIncrByFloatAsync(string key, string field, decimal value = 1) => Instance.HIncrByFloatAsync(key, field, value); /// /// 获取所有哈希表中的字段 /// @@ -1180,7 +1180,7 @@ public static Task ZLexCountAsync(string key, string min, string max) => /// 不含prefix前辍 /// 增量值(默认=1) /// - public static Task IncrByFloatAsync(string key, double value = 1) => Instance.IncrByFloatAsync(key, value); + public static Task IncrByFloatAsync(string key, decimal value = 1) => Instance.IncrByFloatAsync(key, value); /// /// 获取多个指定 key 的值(数组) /// @@ -1215,6 +1215,7 @@ public static Task ZLexCountAsync(string key, string min, string max) => /// Nx, Xx /// public static Task SetAsync(string key, object value, int expireSeconds = -1, RedisExistence? exists = null) => Instance.SetAsync(key, value, expireSeconds, exists); + public static Task SetAsync(string key, object value, TimeSpan expire, RedisExistence? exists = null) => Instance.SetAsync(key, value, expire, exists); /// /// 对 key 所储存的字符串值,设置或清除指定偏移量上的位(bit) /// @@ -1457,14 +1458,14 @@ public static Task SortAndStoreAsync(string key, string destination, long? /// 纬度 /// 成员 /// 是否成功 - public static Task GeoAddAsync(string key, double longitude, double latitude, object member) => Instance.GeoAddAsync(key, longitude, latitude, member); + public static Task GeoAddAsync(string key, decimal longitude, decimal latitude, object member) => Instance.GeoAddAsync(key, longitude, latitude, member); /// /// 将指定的地理空间位置(纬度、经度、成员)添加到指定的key中。这些数据将会存储到sorted set这样的目的是为了方便使用GEORADIUS或者GEORADIUSBYMEMBER命令对数据进行半径查询等操作。 /// /// 不含prefix前辍 /// 批量添加的值 /// 添加到sorted set元素的数目,但不包括已更新score的元素。 - public static Task GeoAddAsync(string key, params (double longitude, double latitude, object member)[] values) => Instance.GeoAddAsync(key, values); + public static Task GeoAddAsync(string key, params (decimal longitude, decimal latitude, object member)[] values) => Instance.GeoAddAsync(key, values); /// /// 返回两个给定位置之间的距离。如果两个位置之间的其中一个不存在, 那么命令返回空值。GEODIST 命令在计算距离时会假设地球为完美的球形, 在极限情况下, 这一假设最大会造成 0.5% 的误差。 /// @@ -1473,7 +1474,7 @@ public static Task SortAndStoreAsync(string key, string destination, long? /// 成员2 /// m 表示单位为米;km 表示单位为千米;mi 表示单位为英里;ft 表示单位为英尺; /// 计算出的距离会以双精度浮点数的形式被返回。 如果给定的位置元素不存在, 那么命令返回空值。 - public static Task GeoDistAsync(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) => Instance.GeoDistAsync(key, member1, member2, unit); + public static Task GeoDistAsync(string key, object member1, object member2, GeoUnit unit = GeoUnit.m) => Instance.GeoDistAsync(key, member1, member2, unit); /// /// 返回一个或多个位置元素的 Geohash 表示。通常使用表示位置的元素使用不同的技术,使用Geohash位置52点整数编码。由于编码和解码过程中所使用的初始最小和最大坐标不同,编码的编码也不同于标准。 /// @@ -1487,7 +1488,7 @@ public static Task SortAndStoreAsync(string key, string destination, long? /// 不含prefix前辍 /// 多个查询的成员 /// GEOPOS 命令返回一个数组, 数组中的每个项都由两个元素组成: 第一个元素为给定位置元素的经度, 而第二个元素则为给定位置元素的纬度。当给定的位置元素不存在时, 对应的数组项为空值。 - public static Task<(double longitude, double latitude)?[]> GeoPosAsync(string key, object[] members) => Instance.GeoPosAsync(key, members); + public static Task<(decimal longitude, decimal latitude)?[]> GeoPosAsync(string key, object[] members) => Instance.GeoPosAsync(key, members); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -1500,7 +1501,7 @@ public static Task SortAndStoreAsync(string key, string destination, long? /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task GeoRadiusAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task GeoRadiusAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusAsync(key, longitude, latitude, radius, unit, count, sorting); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -1513,7 +1514,7 @@ public static Task GeoRadiusAsync(string key, double longitude, double /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task GeoRadiusAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task GeoRadiusAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusAsync(key, longitude, latitude, radius, unit, count, sorting); /// @@ -1527,7 +1528,7 @@ public static Task GeoRadiusAsync(string key, double longitude, double l /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task<(string member, double dist)[]> GeoRadiusWithDistAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task<(string member, decimal dist)[]> GeoRadiusWithDistAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusWithDistAsync(key, longitude, latitude, radius, unit, count, sorting); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离)。 @@ -1540,7 +1541,7 @@ public static Task GeoRadiusAsync(string key, double longitude, double l /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task<(T member, double dist)[]> GeoRadiusWithDistAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task<(T member, decimal dist)[]> GeoRadiusWithDistAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusWithDistAsync(key, longitude, latitude, radius, unit, count, sorting); ///// @@ -1554,7 +1555,7 @@ public static Task GeoRadiusAsync(string key, double longitude, double l ///// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 ///// 排序 ///// - //private static Task<(string member, double longitude, double latitude)[]> GeoRadiusWithCoordAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + //private static Task<(string member, decimal longitude, decimal latitude)[]> GeoRadiusWithCoordAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => // Instance.GeoRadiusWithCoordAsync(key, longitude, latitude, radius, unit, count, sorting); ///// ///// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含经度、纬度)。 @@ -1567,7 +1568,7 @@ public static Task GeoRadiusAsync(string key, double longitude, double l ///// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 ///// 排序 ///// - //private static Task<(T member, double longitude, double latitude)[]> GeoRadiusWithCoordAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + //private static Task<(T member, decimal longitude, decimal latitude)[]> GeoRadiusWithCoordAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => // Instance.GeoRadiusWithCoordAsync(key, longitude, latitude, radius, unit, count, sorting); /// @@ -1581,7 +1582,7 @@ public static Task GeoRadiusAsync(string key, double longitude, double l /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task<(string member, double dist, double longitude, double latitude)[]> GeoRadiusWithDistAndCoordAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task<(string member, decimal dist, decimal longitude, decimal latitude)[]> GeoRadiusWithDistAndCoordAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusWithDistAndCoordAsync(key, longitude, latitude, radius, unit, count, sorting); /// /// 以给定的经纬度为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离、经度、纬度)。 @@ -1594,7 +1595,7 @@ public static Task GeoRadiusAsync(string key, double longitude, double l /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task<(T member, double dist, double longitude, double latitude)[]> GeoRadiusWithDistAndCoordAsync(string key, double longitude, double latitude, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task<(T member, decimal dist, decimal longitude, decimal latitude)[]> GeoRadiusWithDistAndCoordAsync(string key, decimal longitude, decimal latitude, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusWithDistAndCoordAsync(key, longitude, latitude, radius, unit, count, sorting); /// @@ -1607,7 +1608,7 @@ public static Task GeoRadiusAsync(string key, double longitude, double l /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task GeoRadiusByMemberAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task GeoRadiusByMemberAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberAsync(key, member, radius, unit, count, sorting); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素。 @@ -1619,7 +1620,7 @@ public static Task GeoRadiusByMemberAsync(string key, object member, d /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task GeoRadiusByMemberAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task GeoRadiusByMemberAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberAsync(key, member, radius, unit, count, sorting); /// @@ -1632,7 +1633,7 @@ public static Task GeoRadiusByMemberAsync(string key, object member, dou /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task<(string member, double dist)[]> GeoRadiusByMemberWithDistAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task<(string member, decimal dist)[]> GeoRadiusByMemberWithDistAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberWithDistAsync(key, member, radius, unit, count, sorting); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离)。 @@ -1644,7 +1645,7 @@ public static Task GeoRadiusByMemberAsync(string key, object member, dou /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task<(T member, double dist)[]> GeoRadiusByMemberWithDistAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task<(T member, decimal dist)[]> GeoRadiusByMemberWithDistAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberWithDistAsync(key, member, radius, unit, count, sorting); ///// @@ -1657,7 +1658,7 @@ public static Task GeoRadiusByMemberAsync(string key, object member, dou ///// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 ///// 排序 ///// - //private static Task<(string member, double longitude, double latitude)[]> GeoRadiusByMemberWithCoordAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + //private static Task<(string member, decimal longitude, decimal latitude)[]> GeoRadiusByMemberWithCoordAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => // Instance.GeoRadiusByMemberWithCoordAsync(key, member, radius, unit, count, sorting); ///// ///// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含经度、纬度)。 @@ -1669,7 +1670,7 @@ public static Task GeoRadiusByMemberAsync(string key, object member, dou ///// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 ///// 排序 ///// - //private static Task<(T member, double longitude, double latitude)[]> GeoRadiusByMemberWithCoordAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + //private static Task<(T member, decimal longitude, decimal latitude)[]> GeoRadiusByMemberWithCoordAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => // Instance.GeoRadiusByMemberWithCoordAsync(key, member, radius, unit, count, sorting); /// @@ -1682,7 +1683,7 @@ public static Task GeoRadiusByMemberAsync(string key, object member, dou /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task<(string member, double dist, double longitude, double latitude)[]> GeoRadiusByMemberWithDistAndCoordAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task<(string member, decimal dist, decimal longitude, decimal latitude)[]> GeoRadiusByMemberWithDistAndCoordAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberWithDistAndCoordAsync(key, member, radius, unit, count, sorting); /// /// 以给定的成员为中心, 返回键包含的位置元素当中, 与中心的距离不超过给定最大距离的所有位置元素(包含距离、经度、纬度)。 @@ -1694,7 +1695,7 @@ public static Task GeoRadiusByMemberAsync(string key, object member, dou /// 虽然用户可以使用 COUNT 选项去获取前 N 个匹配元素, 但是因为命令在内部可能会需要对所有被匹配的元素进行处理, 所以在对一个非常大的区域进行搜索时, 即使只使用 COUNT 选项去获取少量元素, 命令的执行速度也可能会非常慢。 但是从另一方面来说, 使用 COUNT 选项去减少需要返回的元素数量, 对于减少带宽来说仍然是非常有用的。 /// 排序 /// - public static Task<(T member, double dist, double longitude, double latitude)[]> GeoRadiusByMemberWithDistAndCoordAsync(string key, object member, double radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => + public static Task<(T member, decimal dist, decimal longitude, decimal latitude)[]> GeoRadiusByMemberWithDistAndCoordAsync(string key, object member, decimal radius, GeoUnit unit = GeoUnit.m, long? count = null, GeoOrderBy? sorting = null) => Instance.GeoRadiusByMemberWithDistAndCoordAsync(key, member, radius, unit, count, sorting); #endregion }