io.vertx.redis.client

## Interface RedisConnection

- All Superinterfaces:
    ReadStream<Response>, StreamBase

      public interface RedisConnection
      extends ReadStream<Response>

  A simple Redis client.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `Future<List<Response>>` | `batch(List<Request> commands)` Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.
    `default RedisConnection` | `batch(List<Request> commands, Handler<AsyncResult<List<Response>>> onSend)` Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.
    `void` | `close()` Closes the connection or returns to the pool.
    `RedisConnection` | `endHandler(Handler<Void> endHandler)` Set an end handler.
    `RedisConnection` | `exceptionHandler(Handler<Throwable> handler)` Set an exception handler on the read stream.
    `RedisConnection` | `fetch(long amount)` Fetch the specified `amount` of elements.
    `RedisConnection` | `handler(Handler<Response> handler)` Set a data handler.
    `RedisConnection` | `pause()` Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.
    `boolean` | `pendingQueueFull()` Flag to notify if the pending message queue (commands in transit) is full.
    `RedisConnection` | `resume()` Resume reading, and sets the buffer in `flowing` mode.
    `Future<Response>` | `send(Request command)` Send the given command to the redis server or cluster.
    `default RedisConnection` | `send(Request command, Handler<AsyncResult<Response>> onSend)` Send the given command to the redis server or cluster.

    - ### Methods inherited from interface io.vertx.core.streams.ReadStream

      `pipe, pipeTo, pipeTo`

- - ### Method Detail

    - #### exceptionHandler

          RedisConnection exceptionHandler(Handler<Throwable> handler)

      Set an exception handler on the read stream.
      Specified by:
        `exceptionHandler` in interface `ReadStream<Response>`
      Specified by:
        `exceptionHandler` in interface `StreamBase`
      Parameters:
        `handler` - the exception handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### handler

          RedisConnection handler(Handler<Response> handler)

      Set a data handler. As data is read, the handler will be called with the data.
      Specified by:
        `handler` in interface `ReadStream<Response>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### pause

          RedisConnection pause()

      Pause the `ReadStream`, it sets the buffer in `fetch` mode and clears the actual demand.

      While it's paused, no data will be sent to the data `handler`.

      Specified by:
        `pause` in interface `ReadStream<Response>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### resume

          RedisConnection resume()

      Resume reading, and sets the buffer in `flowing` mode.

      If the `ReadStream` has been paused, reading will recommence on it.
      Specified by:
        `resume` in interface `ReadStream<Response>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### fetch

          RedisConnection fetch(long amount)

      Fetch the specified `amount` of elements. If the `ReadStream` has been paused, reading will recommence with the specified `amount` of items, otherwise the specified `amount` will be added to the current stream demand.
      Specified by:
        `fetch` in interface `ReadStream<Response>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### endHandler

          RedisConnection endHandler(Handler<Void> endHandler)

      Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.
      Specified by:
        `endHandler` in interface `ReadStream<Response>`
      Returns:
        a reference to this, so the API can be used fluently

    - #### send

          default RedisConnection send(Request command,
                                       Handler<AsyncResult<Response>> onSend)

      Send the given command to the redis server or cluster.
      Parameters:
        `command` - the command to send
        `onSend` - the asynchronous result handler.
      Returns:
        fluent self.

    - #### send

          Future<Response> send(Request command)

      Send the given command to the redis server or cluster.
      Parameters:
        `command` - the command to send
      Returns:
        a future with the result of the operation

    - #### batch

          default RedisConnection batch(List<Request> commands,
                                        Handler<AsyncResult<List<Response>>> onSend)

      Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.
      Parameters:
        `commands` - list of command to send
        `onSend` - the asynchronous result handler.
      Returns:
        fluent self.

    - #### batch

          Future<List<Response>> batch(List<Request> commands)

      Sends a list of commands in a single IO operation, this prevents any inter twinning to happen from other client users.
      Parameters:
        `commands` - list of command to send
      Returns:
        a future with the result of the operation

    - #### close

          void close()

      Closes the connection or returns to the pool.

    - #### pendingQueueFull

          boolean pendingQueueFull()

      Flag to notify if the pending message queue (commands in transit) is full. When the pending message queue is full and a new send command is issued it will result in a exception to be thrown. Checking this flag before sending can allow the application to wait before sending the next message.
      Returns:
        true is queue is full.

Copyright © 2021 Eclipse. All rights reserved.