コード例 #1
0
        private Task <T> ExecuteCommand <T, TD>(MemcachedRequest request, TD deserializer) where TD : IResponseDeserializer <T>
        {
            var response = new AsyncResponse <T, TD>(deserializer);

            _messageProtocol.Enqueue(request, response);
            return(response.Task);
        }
コード例 #2
0
        public Task Replace(IMemoryWritable key, IMemoryWritable value, TimeSpan?expireIn)
        {
            var request = new MemcachedRequest(Enums.Opcode.Replace, key, NextOpaque, value, TypeCode.Object, expireIn);

            return(CommandWithNoResult(request));
        }
コード例 #3
0
        public Task Delete(string key)
        {
            var request = new MemcachedRequest(Enums.Opcode.Delete, new StringWritable(key), NextOpaque);

            return(CommandWithNoResult(request));
        }
コード例 #4
0
        public Task Add(string key, byte[] value, TimeSpan?expireIn)
        {
            var request = new MemcachedRequest(Enums.Opcode.Add, new StringWritable(key), NextOpaque, new ByteArrayWritable(value), TypeCode.Object, expireIn);

            return(CommandWithNoResult(request));
        }
コード例 #5
0
 private Task CommandWithNoResult(MemcachedRequest request)
 {
     return(ExecuteCommand <bool, NoResponseDeserializer>(request, new NoResponseDeserializer()));
 }