Exemplo n.º 1
0
 /// <summary>
 /// Stream a BULK reply from the server
 /// </summary>
 /// <typeparam name="T">Response type</typeparam>
 /// <param name="destination">Destination stream</param>
 /// <param name="bufferSize">Size of buffer used to write server response</param>
 /// <param name="func">Client command to execute (BULK reply only)</param>
 public void StreamTo <T>(Stream destination, int bufferSize, Func <IRedisClient, T> func)
 {
     _streaming = true;
     func(this);
     _streaming = false;
     _connector.Read(destination, bufferSize);
 }
Exemplo n.º 2
0
 protected void Listen(Func <RedisReader, TResponse> func)
 {
     Listening = true;
     do
     {
         try
         {
             TResponse value = _connection.Read(func);
             OnParsed(value);
         }
         catch (IOException)
         {
             if (_connection.IsConnected)
             {
                 throw;
             }
             break;
         }
     } while (Continue());
     Listening = false;
 }