Example #1
0
 internal RedisPipeline(Stream destination, RedisEncoding encoding, RedisReader reader)
 {
     _reader      = reader;
     _destination = destination;
     _buffer      = new MemoryStream();
     _writer      = new RedisWriter(encoding);
     _parsers     = new Queue <Func <object> >();
 }
Example #2
0
 public RedisConnector(string host, int port, int concurrency, int bufferSize)
 {
     _concurrency       = concurrency;
     _bufferSize        = bufferSize;
     _endpoint          = new DnsEndPoint(host, port);
     _encoding          = new RedisEncoding();
     _asyncTransferPool = new Lazy <SocketAsyncPool>(SocketAsyncPoolFactory);
     _asyncReadQueue    = new Lazy <ConcurrentQueue <IRedisAsyncCommandToken> >(AsyncQueueFactory);
     _asyncWriteQueue   = new Lazy <ConcurrentQueue <IRedisAsyncCommandToken> >(AsyncQueueFactory);
     _readLock          = new object();
     _writeLock         = new object();
     _writer            = new RedisWriter(_encoding);
     _asyncConnectArgs  = new Lazy <SocketAsyncEventArgs>(SocketAsyncConnectFactory);
 }
Example #3
0
 public RedisConnector(string host, int port, int concurrency, int bufferSize)
 {
     _concurrency  = concurrency;
     _bufferSize   = bufferSize;
     _endpoint     = new DnsEndPoint(host, port);
     _encoding     = new RedisEncoding();
     _transferPool = new Lazy <SocketAsyncPool>(SocketAsyncPoolFactory);
     _readQueue    = new ConcurrentQueue <IRedisAsyncCommandToken>();
     _writeQueue   = new ConcurrentQueue <IRedisAsyncCommandToken>();
     _readLock     = new object();
     _writeLock    = new object();
     _writer       = new RedisWriter(_encoding);
     _connectArgs  = new SocketAsyncEventArgs {
         RemoteEndPoint = _endpoint
     };
     _connectArgs.Completed += OnSocketCompleted;
 }
Example #4
0
        public MockConnector(string host, int port, params byte[][] mockResponses)
        {
            _host      = host;
            _port      = port;
            _encoding  = new RedisEncoding();
            _written   = new MemoryStream();
            _responses = new MemoryStream();
            _writer    = new RedisWriter(_encoding);
            _reader    = new RedisReader(_encoding, _responses);
            _messages  = new ConcurrentQueue <Tuple <long, int> >();
            _pipeline  = new RedisPipeline(_written, _encoding, _reader);

            for (int i = 0; i < mockResponses.Length; i++)
            {
                _responses.Write(mockResponses[i], 0, mockResponses[i].Length);
            }

            _responses.Position = 0;
        }
Example #5
0
 public RedisWriter(RedisEncoding encoding)
 {
     _encoding = encoding;
 }