Record Class RedisCredentials

java.lang.Object
java.lang.Record
com.ohalee.database.redis.RedisCredentials
Record Components:
host - The hostname of the Redis server.
port - The port of the Redis server.
username - The username for authentication (optional).
password - The password for authentication (optional).
database - The database index to use.
minimumPoolSize - The minimum number of idle connections in the pool.
maximumPoolSize - The maximum number of connections in the pool.
All Implemented Interfaces:
com.ohalee.database.api.DatabaseCredentials

public record RedisCredentials(String host, int port, String username, String password, int database, String clientName, int minimumPoolSize, int maximumPoolSize) extends Record implements com.ohalee.database.api.DatabaseCredentials
Credentials for connecting to a Redis database.
  • Constructor Details

    • RedisCredentials

      public RedisCredentials(String host, int port, String username, String password, int database, String clientName, int minimumPoolSize, int maximumPoolSize)
      Creates an instance of a RedisCredentials record class.
      Parameters:
      host - the value for the host record component
      port - the value for the port record component
      username - the value for the username record component
      password - the value for the password record component
      database - the value for the database record component
      clientName - the value for the clientName record component
      minimumPoolSize - the value for the minimumPoolSize record component
      maximumPoolSize - the value for the maximumPoolSize record component
  • Method Details

    • from

      public static RedisCredentials from(String host, int port)
      Creates credentials with the default port (6379), default pool settings (min 5, max 10), and database 0.
      Parameters:
      host - The hostname.
      Returns:
      The Redis credentials.
    • from

      public static RedisCredentials from(String host, String password)
      Creates credentials with the default port (6379), default pool settings (min 5, max 10), and database 0.
      Parameters:
      host - The hostname.
      password - The password.
      Returns:
      The Redis credentials.
    • from

      public static RedisCredentials from(String host, int port, String password)
      Creates credentials with default pool settings (min 5, max 10) and database 0.
      Parameters:
      host - The hostname.
      port - The port.
      password - The password.
      Returns:
      The Redis credentials.
    • from

      public static RedisCredentials from(String host, int port, String username, String password)
      Creates credentials with default pool settings (min 5, max 10).
      Parameters:
      host - The hostname.
      port - The port.
      username - The username.
      password - The password.
      Returns:
      The Redis credentials.
    • from

      public static RedisCredentials from(String host, int port, String username, String password, int database)
      Creates credentials with default pool settings (min 5, max 10).
      Parameters:
      host - The hostname.
      port - The port.
      username - The username.
      password - The password.
      database - The database index.
      Returns:
      The Redis credentials.
    • from

      public static RedisCredentials from(String host, int port, String username, String password, int database, int minimumPoolSize, int maximumPoolSize)
      Creates credentials with specified pool settings.
      Parameters:
      host - The hostname.
      port - The port.
      username - The username.
      password - The password.
      database - The database index.
      minimumPoolSize - The minimum pool size.
      maximumPoolSize - The maximum pool size.
      Returns:
      The Redis credentials.
    • from

      public static RedisCredentials from(String host, int port, String username, String password, int database, String clientName, int minimumPoolSize, int maximumPoolSize)
      Creates credentials with specified pool settings.
      Parameters:
      host - The hostname.
      port - The port.
      username - The username.
      password - The password.
      database - The database index.
      clientName - The client name.
      minimumPoolSize - The minimum pool size.
      maximumPoolSize - The maximum pool size.
      Returns:
      The Redis credentials.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • host

      public String host()
      Returns the value of the host record component.
      Returns:
      the value of the host record component
    • port

      public int port()
      Returns the value of the port record component.
      Returns:
      the value of the port record component
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • password

      public String password()
      Returns the value of the password record component.
      Returns:
      the value of the password record component
    • database

      public int database()
      Returns the value of the database record component.
      Returns:
      the value of the database record component
    • clientName

      public String clientName()
      Returns the value of the clientName record component.
      Returns:
      the value of the clientName record component
    • minimumPoolSize

      public int minimumPoolSize()
      Returns the value of the minimumPoolSize record component.
      Returns:
      the value of the minimumPoolSize record component
    • maximumPoolSize

      public int maximumPoolSize()
      Returns the value of the maximumPoolSize record component.
      Returns:
      the value of the maximumPoolSize record component