Example #1
0
        public double Decrement(string keySuffix, double value = 1, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.StringDecrement(Key, value, (sr.CommandFlags)commandFlags));
        }
Example #2
0
        public bool Add(string keySuffix, string value, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.HyperLogLogAdd(Key, value, (sr.CommandFlags)commandFlags));
        }
Example #3
0
        public double IncrementLimitByMin(string keySuffix, double value, double min, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(double.Parse((string)command.ScriptEvaluate(Script.StringIncrementFloatLimitByMin, new[] { Key }, new RedisValue[] { value, min }, (sr.CommandFlags)commandFlags)));
        }
Example #4
0
        public string GetSet(string keySuffix, string value, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.StringGetSet(Key, value, (sr.CommandFlags)commandFlags));
        }
Example #5
0
        public long Remove(string keySuffix, string value, long count = 0, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.ListRemove(Key, value, count, (sr.CommandFlags)commandFlags));
        }
Example #6
0
        public string RightPopLeftPush(string keySuffix, string destination, CommandFlags flags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.ListRightPopLeftPush(Key, destination, (sr.CommandFlags)flags));
        }
Example #7
0
        public long RemoveRangeByRank(string keySuffix, long start, long stop, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.SortedSetRemoveRangeByRank(Key, start, stop, (sr.CommandFlags)commandFlags));
        }
Example #8
0
        public long InsertBefore(string keySuffix, string pivot, string value, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.ListInsertBefore(Key, pivot, value, (sr.CommandFlags)commandFlags));
        }
Example #9
0
        public long?Rank(string keySuffix, string member, Order order = Order.Ascending, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(false, Key);

            return(command.SortedSetRank(Key, member, (sr.Order)order, (sr.CommandFlags)commandFlags));
        }
Example #10
0
        public bool Remove(string keySuffix, string member, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.SortedSetRemove(Key, member, (sr.CommandFlags)commandFlags));
        }
Example #11
0
        public bool Add(string keySuffix, string value, double score, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.SortedSetAdd(Key, value, score, (sr.CommandFlags)commandFlags));
        }
Example #12
0
        public double Increment(string keySuffix, string field, double value, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.HashIncrement(Key, field, value, (sr.CommandFlags)commandFlags));
        }
Example #13
0
        public string Get(string keySuffix, string field, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(false, Key);

            return(command.HashGet(Key, field, (sr.CommandFlags)commandFlags));
        }
Example #14
0
        public double IncrementLimitByMin(string keySuffix, string field, double value, double max, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return((double)command.ScriptEvaluate(Script.HashIncrementFloatLimitByMin, new[] { Key, (RedisKey)field }, new RedisValue[] { value, max }, (sr.CommandFlags)commandFlags));
        }
Example #15
0
        public long RemoveRangeByScore(string keySuffix, string min, string max, Exclude exclude = Exclude.None, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.SortedSetRemoveRangeByValue(Key, min, max, (sr.Exclude)exclude, (sr.CommandFlags)commandFlags));
        }
Example #16
0
        public void Trim(string keySuffix, long start, long stop, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            command.ListTrim(Key, start, stop, (sr.CommandFlags)commandFlags);
        }
Example #17
0
        public IEnumerable <SortedSetEntry> Scan(string keySuffix, RedisValue pattern = default(RedisValue), int pageSize = 10, long cursor = 0, int pageOffset = 0, CommandFlags flags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(false, Key);

            return(command.SortedSetScan(Key, pattern, pageSize, cursor, pageOffset, (sr.CommandFlags)flags));
        }
Example #18
0
        public long LeftPush(string keySuffix, string value, When when = When.Always, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.ListLeftPush(Key, value, (sr.When)when, (sr.CommandFlags)commandFlags));
        }
Example #19
0
        public double IncrementLimitByMin(string keySuffix, string member, double value, double min, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return((double)command.ScriptEvaluate(Script.SortedSetIncrementLimitByMin, new[] { Key }, new RedisValue[] { member, value, min }, (sr.CommandFlags)commandFlags));
        }
Example #20
0
        public string RightPop(string keySuffix, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.ListRightPop(Key, (sr.CommandFlags)commandFlags));
        }
Example #21
0
        public double Increment(string keySuffix, string member, double value, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.SortedSetIncrement(Key, member, value, (sr.CommandFlags)commandFlags));
        }
Example #22
0
        public long IncrementLimitByMin(string keySuffix, long value, long min, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return((long)command.ScriptEvaluate(Script.StringIncrementLimitByMin, new[] { Key }, new RedisValue[] { value, min }, (sr.CommandFlags)commandFlags));
        }
Example #23
0
        public long Length(string keySuffix, double min = double.NegativeInfinity, double max = double.PositiveInfinity, Exclude exclude = Exclude.None, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.SortedSetLength(Key, min, max, (sr.Exclude)exclude, (sr.CommandFlags)commandFlags));
        }
Example #24
0
        public long BitPosition(string keySuffix, bool bit, long start = 0, long end = -1, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(false, Key);

            return(command.StringBitPosition(Key, bit, start, end, (sr.CommandFlags)commandFlags));
        }
Example #25
0
        public Tuple <string, double, double>[] RangeByRankWithScoresAndRank(string keySuffix, long start = 0, long stop = -1, Order order = Order.Ascending, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(false, Key);

            SortedSetEntry[] rs;
            long             startIndex = 0;

            if (start >= 0)
            {
                rs         = command.SortedSetRangeByRankWithScores(Key, start, stop, (sr.Order)order, (sr.CommandFlags)commandFlags);
                startIndex = start;
            }
            else
            {
                var length = command.SortedSetLength(Key, flags: (sr.CommandFlags)commandFlags);
                rs         = command.SortedSetRangeByRankWithScores(Key, start, stop, (sr.Order)order, (sr.CommandFlags)commandFlags);
                startIndex = length + start;
            }

            var result = new List <Tuple <string, double, double> >();
            var i      = 0;

            foreach (var entry in rs)
            {
                result.Add(new Tuple <string, double, double>(entry.Element, entry.Score, startIndex + i));
                i++;
            }
            return(result.ToArray());
        }
Example #26
0
        public bool Set(string keySuffix, string value, TimeSpan?expiry = null, When when = When.Always, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.StringSet(Key, value, expiry, (sr.When)when, (sr.CommandFlags)commandFlags));
        }
Example #27
0
        public string GetByIndex(string keySuffix, long index, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.ListGetByIndex(Key, index, (sr.CommandFlags)commandFlags));
        }
Example #28
0
        public bool SetBit(string keySuffix, long offset, bool bit, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.StringSetBit(Key, offset, bit, (sr.CommandFlags)commandFlags));
        }
Example #29
0
        public void SetByIndex(string keySuffix, int index, string value, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            command.ListSetByIndex(Key, index, value, (sr.CommandFlags)commandFlags);
        }
Example #30
0
        public long Length(string keySuffix, CommandFlags commandFlags = CommandFlags.None)
        {
            InitRedisKey(keySuffix);
            var command = RedisGroup.GetCommand(true, Key);

            return(command.HyperLogLogLength(Key, (sr.CommandFlags)commandFlags));
        }
 internal RedisStructure(RedisGroup connectionGroup, RedisKey key)
     : this(connectionGroup.GetSettings(key), key)
 {
 }