protected override bool ExecuteAction() { ITranscoder transcode = new DefaultTranscoder(); CacheItem item = transcode.Serialize(this.value); String command = String.Format("set {0} 0 0 {1}",this.Key,item.Data.Count - item.Data.Offset); ArraySegment<byte> commandByte = PooledSocket.GetCommandBuffer(command); this.Socket.Write(new ArraySegment<byte>[]{commandByte,item.Data,new ArraySegment<byte>(new byte[2] { (byte)'\r', (byte)'\n' })}); return "STORED".Equals(this.Socket.ReadResponse(),StringComparison.Ordinal); }
protected override bool ExecuteAction() { PooledSocket socket = this.Socket; socket.SendCommand("get " + this.Key); GetResponse r = GetHelper.ReadItem(socket); if (r != null) { ITranscoder trandcoder = new DefaultTranscoder(); this._result = trandcoder.Deserialize(r.Item); GetHelper.FinishCurrent(this.Socket); } return true; }