Exemple #1
0
        public override void Execute(IMemcachedProvider cacheProvider)
        {
            switch (_opcode)
            {
            case Opcode.Increment:
            case Opcode.IncrementQ:
                _result = cacheProvider.Increment(_key, _delta, _initialValue, _expirationTimeInSeconds, _cas);
                break;

            case Opcode.Decrement:
            case Opcode.DecrementQ:
                _result = cacheProvider.Decrement(_key, Delta, _initialValue, _expirationTimeInSeconds, _cas);
                break;
            }
        }
Exemple #2
0
        public override void Execute(IMemcachedProvider cacheProvider)
        {
                switch (_opcode)
                {
                    case Opcode.Increment:
                    case Opcode.IncrementQ:
                        _result = cacheProvider.Increment(_key, _delta, _initialValue, _expirationTimeInSeconds, _cas);
                        break;

                    case Opcode.Decrement:
                    case Opcode.DecrementQ:
                        _result = cacheProvider.Decrement(_key, Delta, _initialValue, _expirationTimeInSeconds, _cas);
                        break;
                }
        }
Exemple #3
0
        private ulong?incrementDecrement(string cmd, string key, bool keyIsChecked, ulong value, uint hash)
        {
            if (!keyIsChecked)
            {
                checkKey(key);
            }
            if (memcachedProvider == null)
            {
                ConnectionError();
                return(null);
            }
            MutateOpResult opResult = new MutateOpResult();

            try
            {
                switch (cmd)
                {
                case "incr":
                    opResult = memcachedProvider.Increment(key, value, null, 0, 0);
                    break;

                case "decr":
                    opResult = memcachedProvider.Decrement(key, value, null, 0, 0);
                    break;
                }
                if (opResult.ReturnResult == Result.SUCCESS)
                {
                    return(opResult.MutateResult);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception e)
            {
                return(null);
            }
        }