Example #1
0
        private byte[] HandleMutate(string commandName, string[] commandParams)
        {
            var key  = _helpers.ToKey(commandParams[0]);
            var incr = ulong.Parse(commandParams[1]);

            byte[] resultData;
            bool   result = _cache.Mutate(key, incr, out resultData, commandName == "incr");

            return(result && resultData != null
                       ? resultData.Concat(_endOfLine).ToArray()
                       : Encoding.ASCII.GetBytes("NOT_FOUND\r\n"));
        }