Beispiel #1
0
        /// <summary>
        /// SORT : https://redis.io/commands/sort
        /// </summary>
        public Task <long> SortAndStore(RedisSortedSet <T> destination, long skip = 0, long take = -1, Order order = Order.Ascending, SortType sortType = SortType.Numeric, /*RedisValue by = default, RedisValue[] get = null,*/ CommandFlags flags = CommandFlags.None)
        {
            //--- I don't know if serialization is necessary or not, so I will fix the default value.
            RedisValue by = default;

            RedisValue[] get = default;
            return(this.Connection.Database.SortAndStoreAsync(destination.Key, this.Key, skip, take, order, sortType, by, get, flags));
        }
Beispiel #2
0
        /// <summary>
        /// ZUNIONSTORE : https://redis.io/commands/zunionstore
        /// ZINTERSTORE : https://redis.io/commands/zinterstore
        /// </summary>
        public Task <long> CombineAndStore(SetOperation operation, RedisSortedSet <T> destination, IReadOnlyCollection <RedisSortedSet <T> > others, double[] weights = default, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None)
        {
            if (others == null)
            {
                throw new ArgumentNullException(nameof(others));
            }
            if (others.Count == 0)
            {
                throw new ArgumentNullException("others length is 0.");
            }

            var keys = others.Select(x => x.Key).Concat(new [] { this.Key }).ToArray();

            return(this.Connection.Database.SortedSetCombineAndStoreAsync(operation, destination.Key, keys, weights, aggregate, flags));
        }
Beispiel #3
0
 /// <summary>
 /// ZUNIONSTORE : https://redis.io/commands/zunionstore
 /// ZINTERSTORE : https://redis.io/commands/zinterstore
 /// </summary>
 public Task <long> CombineAndStore(SetOperation operation, RedisSortedSet <T> destination, RedisSortedSet <T> other, Aggregate aggregate = Aggregate.Sum, CommandFlags flags = CommandFlags.None)
 => this.Connection.Database.SortedSetCombineAndStoreAsync(operation, destination.Key, this.Key, other.Key, aggregate, flags);