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); }
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)); }
public Task Delete(string key) { var request = new MemcachedRequest(Enums.Opcode.Delete, new StringWritable(key), NextOpaque); return(CommandWithNoResult(request)); }
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)); }
private Task CommandWithNoResult(MemcachedRequest request) { return(ExecuteCommand <bool, NoResponseDeserializer>(request, new NoResponseDeserializer())); }