Пример #1
0
 public RedisCommandQueue(IRedisNode node, bool transactional)
 {
     _transactional = transactional;
     _node = node;
     _sendQueue = new Queue<RedisCommand>();
     _receiveQueue = new Queue<RedisCommand>();
     _commandBuffer = new CommandBuffer();
 }
Пример #2
0
        public static void WriteAsync(this PooledSocket socket, RedisCommand command, Action<RedisCommand> callback)
        {
            var buffer = new CommandBuffer();
            buffer.Append(command);

            var state = new ClientAsyncWriteState
            {
                Buffer = buffer.Data,
                CallbackArg = command,
                WorkSocket = socket.Socket
            };

            if (callback != null)
            {
                state.CommandSent += (args, cmd) => callback(cmd);
            }
            socket.Socket.BeginSend(buffer.Data, 0, buffer.Size, SocketFlags.None,
                new AsyncCallback(EndWriteCmdAsynch), state);
        }