io.vertx.redis.client

## Class RedisOptions

- java.lang.Object
- - io.vertx.redis.client.RedisOptions

-     public class RedisOptions
      extends Object

  Redis Client Configuration options.
  Author:
    Paulo Lopes

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_ENDPOINT` The default redis endpoint = `redis://localhost:6379`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RedisOptions()` Creates a default configuration object using redis server defaults
    `RedisOptions(JsonObject json)` Copy from JSON constructor.
    `RedisOptions(RedisOptions other)` Copy constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `RedisOptions` | `addConnectionString(String connectionString)` Adds a connection string (endpoint) to use while connecting to the redis server.
    `RedisOptions` | `addEndpoint(String connectionString)` Deprecated. see `setConnectionString(String connectionString)` for a better naming
    `String` | `getEndpoint()` Gets the redis endpoint to use
    `List<String>` | `getEndpoints()` Gets the list of redis endpoints to use (mostly used while connecting to a cluster)
    `String` | `getMasterName()` Get the master name (only considered in HA mode).
    `int` | `getMaxNestedArrays()` Tune how much nested arrays are allowed on a redis response.
    `int` | `getMaxPoolSize()` Tune the maximum size of the connection pool.
    `int` | `getMaxPoolWaiting()` Tune the maximum waiting requests for a connection from the pool.
    `int` | `getMaxWaitingHandlers()` The client will always work on pipeline mode, this means that messages can start queueing.
    `NetClientOptions` | `getNetClientOptions()` Get the net client options used to connect to the server.
    `String` | `getPassword()` Get the default password for cluster/sentinel connections, if not set it will try to extract it from the current default endpoint.
    `int` | `getPoolCleanerInterval()` Tune how often in milliseconds should the connection pool cleaner execute.
    `String` | `getPoolName()` Get the pool name to be used in this client.
    `int` | `getPoolRecycleTimeout()` Tune when a connection should be recycled in milliseconds.
    `RedisRole` | `getRole()` Get the role name (only considered in HA mode).
    `RedisClientType` | `getType()` Get the type of client to be created.
    `RedisReplicas` | `getUseReplicas()` Get whether or not to use replica nodes (only considered in Cluster mode).
    `boolean` | `isProtocolNegotiation()` Should the client perform `RESP` protocol negotiation during the connection handshake.
    `RedisOptions` | `setConnectionString(String connectionString)` Sets a single connection string (endpoint) to use while connecting to the redis server.
    `RedisOptions` | `setEndpoint(String connectionString)` Deprecated. see `setConnectionString(String connectionString)` for a better naming
    `RedisOptions` | `setEndpoints(List<String> endpoints)` Set the endpoints to use while connecting to the redis server.
    `RedisOptions` | `setMasterName(String masterName)` Set the master name (only considered in HA mode).
    `RedisOptions` | `setMaxNestedArrays(int maxNestedArrays)` Tune how much nested arrays are allowed on a redis response.
    `RedisOptions` | `setMaxPoolSize(int maxPoolSize)` Tune the maximum size of the connection pool.
    `RedisOptions` | `setMaxPoolWaiting(int maxPoolWaiting)` Tune the maximum waiting requests for a connection from the pool.
    `RedisOptions` | `setMaxWaitingHandlers(int maxWaitingHandlers)` The client will always work on pipeline mode, this means that messages can start queueing.
    `RedisOptions` | `setNetClientOptions(NetClientOptions netClientOptions)` Set the net client options to be used while connecting to the redis server.
    `RedisOptions` | `setPassword(String password)` Set the default password for cluster/sentinel connections.
    `RedisOptions` | `setPoolCleanerInterval(int poolCleanerInterval)` Tune how often in milliseconds should the connection pool cleaner execute.
    `RedisOptions` | `setPoolName(String poolName)` Set a user defined pool name (for metrics reporting).
    `RedisOptions` | `setPoolRecycleTimeout(int poolRecycleTimeout)` Tune when a connection should be recycled in milliseconds.
    `RedisOptions` | `setProtocolNegotiation(boolean protocolNegotiation)` Should the client perform `REST` protocol negotiation during the connection acquire.
    `RedisOptions` | `setRole(RedisRole role)` Set the role name (only considered in HA mode).
    `RedisOptions` | `setType(RedisClientType type)` Set the desired client type to be created.
    `RedisOptions` | `setUseReplicas(RedisReplicas useReplicas)` Set whether or not to use replica nodes (only considered in Cluster mode).
    `JsonObject` | `toJson()` Converts this object to JSON notation.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_ENDPOINT

          public static final String DEFAULT_ENDPOINT

      The default redis endpoint = `redis://localhost:6379`
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RedisOptions

          public RedisOptions()

      Creates a default configuration object using redis server defaults

    - #### RedisOptions

          public RedisOptions(RedisOptions other)

      Copy constructor.
      Parameters:
        `other` - the object to clone.

    - #### RedisOptions

          public RedisOptions(JsonObject json)

      Copy from JSON constructor.
      Parameters:
        `json` - source json

  - ### Method Detail

    - #### getType

          public RedisClientType getType()

      Get the type of client to be created.
      Returns:
        the desired client type.

    - #### setType

          public RedisOptions setType(RedisClientType type)

      Set the desired client type to be created.
      Parameters:
        `type` - the client type.
      Returns:
        fluent self.

    - #### getNetClientOptions

          public NetClientOptions getNetClientOptions()

      Get the net client options used to connect to the server.
      Returns:
        the net socket options.

    - #### setNetClientOptions

          public RedisOptions setNetClientOptions(NetClientOptions netClientOptions)

      Set the net client options to be used while connecting to the redis server. Use this to tune your connection.
      Parameters:
        `netClientOptions` - custom net client options.
      Returns:
        fluent self.

    - #### getEndpoints

          public List<String> getEndpoints()

      Gets the list of redis endpoints to use (mostly used while connecting to a cluster)
      Returns:
        list of socket addresses.

    - #### getEndpoint

          public String getEndpoint()

      Gets the redis endpoint to use
      Returns:
        the Redis connection string URI

    - #### setEndpoints

          public RedisOptions setEndpoints(List<String> endpoints)

      Set the endpoints to use while connecting to the redis server. Only the cluster mode will consider more than 1 element. If more are provided, they are not considered by the client when in single server mode.
      Parameters:
        `endpoints` - list of socket addresses.
      Returns:
        fluent self.

    - #### addEndpoint

          @Deprecated
          public RedisOptions addEndpoint(String connectionString)

      Deprecated. see `setConnectionString(String connectionString)` for a better naming
      Adds an endpoint to use while connecting to the redis server. Only the cluster mode will consider more than 1 element. If more are provided, they are not considered by the client when in single server mode.
      Parameters:
        `connectionString` - a string URI following the scheme: redis://[username:password@][host][:port][/database]
      Returns:
        fluent self.

    - #### setEndpoint

          @Deprecated
          public RedisOptions setEndpoint(String connectionString)

      Deprecated. see `setConnectionString(String connectionString)` for a better naming
      Sets a single connection string to use while connecting to the redis server. Will replace the previously configured connection strings.
      Parameters:
        `connectionString` - a string following the scheme: redis://[username:password@][host][:port][/[database]
      Returns:
        fluent self.

    - #### addConnectionString

          public RedisOptions addConnectionString(String connectionString)

      Adds a connection string (endpoint) to use while connecting to the redis server. Only the cluster mode will consider more than 1 element. If more are provided, they are not considered by the client when in single server mode.
      Parameters:
        `connectionString` - a string URI following the scheme: redis://[username:password@][host][:port][/database]
      Returns:
        fluent self.
      See Also:
        Redis scheme on www.iana.org

    - #### setConnectionString

          public RedisOptions setConnectionString(String connectionString)

      Sets a single connection string (endpoint) to use while connecting to the redis server. Will replace the previously configured connection strings.
      Parameters:
        `connectionString` - a string following the scheme: redis://[username:password@][host][:port][/[database].
      Returns:
        fluent self.
      See Also:
        Redis scheme on www.iana.org

    - #### getMaxWaitingHandlers

          public int getMaxWaitingHandlers()

      The client will always work on pipeline mode, this means that messages can start queueing. You can control how much backlog you're willing to accept. This methods returns how much handlers is the client willing to queue.
      Returns:
        max allowed queued waiting handlers.

    - #### setMaxWaitingHandlers

          public RedisOptions setMaxWaitingHandlers(int maxWaitingHandlers)

      The client will always work on pipeline mode, this means that messages can start queueing. You can control how much backlog you're willing to accept. This methods sets how much handlers is the client willing to queue.
      Parameters:
        `maxWaitingHandlers` - max allowed queued waiting handlers.
      Returns:
        fluent self.

    - #### getMasterName

          public String getMasterName()

      Get the master name (only considered in HA mode).
      Returns:
        the master name.

    - #### setMasterName

          public RedisOptions setMasterName(String masterName)

      Set the master name (only considered in HA mode).
      Parameters:
        `masterName` - the master name.
      Returns:
        fluent self.

    - #### getRole

          public RedisRole getRole()

      Get the role name (only considered in HA mode).
      Returns:
        the master name.

    - #### setRole

          public RedisOptions setRole(RedisRole role)

      Set the role name (only considered in HA mode).
      Parameters:
        `role` - the master name.
      Returns:
        fluent self.

    - #### getUseReplicas

          public RedisReplicas getUseReplicas()

      Get whether or not to use replica nodes (only considered in Cluster mode).
      Returns:
        the cluster replica node use mode.

    - #### setUseReplicas

          public RedisOptions setUseReplicas(RedisReplicas useReplicas)

      Set whether or not to use replica nodes (only considered in Cluster mode).
      Parameters:
        `useReplicas` - the cluster replica use mode.
      Returns:
        fluent self.

    - #### getMaxNestedArrays

          public int getMaxNestedArrays()

      Tune how much nested arrays are allowed on a redis response. This affects the parser performance.
      Returns:
        the configured max nested arrays allowance.

    - #### setMaxNestedArrays

          public RedisOptions setMaxNestedArrays(int maxNestedArrays)

      Tune how much nested arrays are allowed on a redis response. This affects the parser performance.
      Parameters:
        `maxNestedArrays` - the configured max nested arrays allowance.
      Returns:
        fluent self.

    - #### getPoolCleanerInterval

          public int getPoolCleanerInterval()

      Tune how often in milliseconds should the connection pool cleaner execute.
      Returns:
        the cleaning internal

    - #### setPoolCleanerInterval

          public RedisOptions setPoolCleanerInterval(int poolCleanerInterval)

      Tune how often in milliseconds should the connection pool cleaner execute. For each connection in the pool, connections marked as invalid will be forcibly closed. A connection is marked invalid if it enters a exception or fatal state.
      Parameters:
        `poolCleanerInterval` - the interval in milliseconds (-1 for never)
      Returns:
        fluent self.

    - #### getMaxPoolSize

          public int getMaxPoolSize()

      Tune the maximum size of the connection pool.
      Returns:
        the size.

    - #### setMaxPoolSize

          public RedisOptions setMaxPoolSize(int maxPoolSize)

      Tune the maximum size of the connection pool. When working with cluster or sentinel this value should be atleast the total number of cluster member (or number of sentinels + 1)
      Parameters:
        `maxPoolSize` - the max pool size.
      Returns:
        fluent self.

    - #### getMaxPoolWaiting

          public int getMaxPoolWaiting()

      Tune the maximum waiting requests for a connection from the pool.
      Returns:
        the maximum waiting requests.

    - #### setMaxPoolWaiting

          public RedisOptions setMaxPoolWaiting(int maxPoolWaiting)

      Tune the maximum waiting requests for a connection from the pool.
      Parameters:
        `maxPoolWaiting` - max waiting requests
      Returns:
        fluent self.

    - #### getPoolRecycleTimeout

          public int getPoolRecycleTimeout()

      Tune when a connection should be recycled in milliseconds.
      Returns:
        the timeout for recycling.

    - #### setPoolRecycleTimeout

          public RedisOptions setPoolRecycleTimeout(int poolRecycleTimeout)

      Tune when a connection should be recycled in milliseconds.
      Parameters:
        `poolRecycleTimeout` - the timeout for recycling.
      Returns:
        fluent self.

    - #### getPassword

          public String getPassword()

      Get the default password for cluster/sentinel connections, if not set it will try to extract it from the current default endpoint.
      Returns:
        password

    - #### setPassword

          public RedisOptions setPassword(String password)

      Set the default password for cluster/sentinel connections.
      Parameters:
        `password` - the default password
      Returns:
        fluent self

    - #### isProtocolNegotiation

          public boolean isProtocolNegotiation()

      Should the client perform `RESP` protocol negotiation during the connection handshake. By default this is `true`, but there are situations when using broken servers it may be useful to skip this and always fallback to `RESP2` without using the `HELLO` command.
      Returns:
        true to perform negotiation.

    - #### setProtocolNegotiation

          public RedisOptions setProtocolNegotiation(boolean protocolNegotiation)

      Should the client perform `REST` protocol negotiation during the connection acquire. By default this is `true`, but there are situations when using broken servers it may be useful to skip this and always fallback to `RESP2` without using the `HELLO` command.
      Parameters:
        `protocolNegotiation` - false to disable `HELLO` (not recommended) unless reasons...
      Returns:
        fluent self

    - #### setPoolName

          public RedisOptions setPoolName(String poolName)

      Set a user defined pool name (for metrics reporting).
      Parameters:
        `poolName` - the user desired pool name.
      Returns:
        fluent self

    - #### getPoolName

          public String getPoolName()

      Get the pool name to be used in this client. The default name is a random UUID.
      Returns:
        pool name.

    - #### toJson

          public JsonObject toJson()

      Converts this object to JSON notation.
      Returns:
        JSON

Copyright © 2022 Eclipse. All rights reserved.