Ejemplo n.º 1
0
        public static KeyValuePair <RequestHeader, IEnumerable <byte[]> > DeleteRequest(string key)
        {
            var keyValue = Encoding.ASCII.GetBytes(key);
            var request  = new RequestHeader()
            {
                OpCode      = Command.delete,
                DataType    = 0,
                Magic       = Magic.Request,
                ExtraLength = 0,
                KeyLength   = (ushort)keyValue.Length,
                TotalBody   = keyValue.Length
            };

            var @enumerable = new[] { request.ToByte(), keyValue };

            return(new KeyValuePair <RequestHeader, IEnumerable <byte[]> >(request, @enumerable));
        }
Ejemplo n.º 2
0
        public static KeyValuePair <RequestHeader, IEnumerable <byte[]> > GetRequest(string key)
        {
            var keyValue = Encoding.ASCII.GetBytes(key);
            var request  = new RequestHeader()
            {
                Magic       = Magic.Request,
                OpCode      = Command.get,
                KeyLength   = (ushort)keyValue.Length,
                ExtraLength = 0,
                DataType    = 0,
                VbucketId   = 0,
                TotalBody   = keyValue.Length,
                Opaque      = 0,
                CAS         = 0,
            };

            var @reqs = request.ToByte();

            RequestReverse(reqs);
            var @enumerable = new[] { @reqs, keyValue };

            return(new KeyValuePair <RequestHeader, IEnumerable <byte[]> >(request, @enumerable));
        }