Exemplo n.º 1
0
        public void HandleRequest(IRequestContext context)
        {
            var commandParams = context.Parameters.ToArray();

            var key       = _helpers.ToKey(commandParams[0]);
            var flags     = _helpers.ToFlags(commandParams[1]);
            var exptime   = _helpers.ToExpiry(commandParams[2]);
            var casUnique = ulong.Parse(commandParams[4]);
            var result    = _cache.Cas(key, flags, exptime, casUnique, context.DataBlock)
                             ? Encoding.ASCII.GetBytes("STORED\r\n")
                             : Encoding.ASCII.GetBytes("EXISTS\r\n");

            context.ResponseStream.WriteAsync(result, 0, result.Length);
        }