Class RedisConnectOptions

java.lang.Object
io.vertx.redis.client.RedisConnectOptions
Direct Known Subclasses:
RedisClusterConnectOptions, RedisReplicationConnectOptions, RedisSentinelConnectOptions, RedisStandaloneConnectOptions

public abstract class RedisConnectOptions extends Object
  • Constructor Details

    • RedisConnectOptions

      public RedisConnectOptions()
    • RedisConnectOptions

      public RedisConnectOptions(RedisOptions options)
    • RedisConnectOptions

      public RedisConnectOptions(RedisConnectOptions other)
    • RedisConnectOptions

      public RedisConnectOptions(JsonObject json)
  • Method Details

    • 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 RedisConnectOptions 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.
    • 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 RedisConnectOptions 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
    • getPreferredProtocolVersion

      public ProtocolVersion getPreferredProtocolVersion()
      Returns the preferred protocol version to be used during protocol negotiation. When not set, defaults to RESP 3. When protocol negotiation is disabled, this setting has no effect.
      Returns:
      preferred protocol version
    • setPreferredProtocolVersion

      public RedisConnectOptions setPreferredProtocolVersion(ProtocolVersion preferredProtocolVersion)
      Sets the preferred protocol version to be used during protocol negotiation. When not set, defaults to RESP 3. When protocol negotiation is disabled, this setting has no effect.
      Parameters:
      preferredProtocolVersion - preferred protocol version
      Returns:
      fluent self
    • getUser

      public String getUser()
      Get the default username for Redis connections.
      Returns:
      username
    • setUser

      public RedisConnectOptions setUser(String user)
      Set the default username for Redis connections.
      Parameters:
      user - the default username
      Returns:
      fluent self
    • getPassword

      public String getPassword()
      Get the default password for Redis connections.
      Returns:
      password
    • setPassword

      public RedisConnectOptions setPassword(String password)
      Set the default password for Redis connections.
      Parameters:
      password - the default password
      Returns:
      fluent self
    • getEndpoint

      public String getEndpoint()
      Gets the redis endpoint to use
      Returns:
      the Redis connection string URI
    • addConnectionString

      public RedisConnectOptions 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:
    • setConnectionString

      public RedisConnectOptions 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:
    • 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.
    • setEndpoints

      public RedisConnectOptions 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.
    • 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 RedisConnectOptions 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.
    • toJson

      public JsonObject toJson()
      Converts this object to JSON notation.
      Returns:
      JSON