Class RedisManager

java.lang.Object
net.bitbylogic.rps.RedisManager

public class RedisManager extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    RedisManager(@NotNull String host, int port, @Nullable String password, @NotNull String serverId)
    Constructs a new RedisManager instance with the specified host, port, password, and server ID.
    RedisManager(@NotNull org.redisson.config.Config redisConfig, @NotNull String serverId)
    Creates a new instance of the RedisManager class, initializing the RedissonClient instance with the given configuration.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.gson.Gson
    Retrieves the instance of Gson used by the RedisManager.
    @NotNull RedisClient
    registerClient(@NotNull String id)
    Registers a new RedisClient with the specified ID.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RedisManager

      public RedisManager(@NotNull @NotNull String host, int port, @Nullable @Nullable String password, @NotNull @NotNull String serverId)
      Constructs a new RedisManager instance with the specified host, port, password, and server ID. Initializes the RedissonClient with a single server configuration.
      Parameters:
      host - the hostname or IP address of the Redis server; must not be null
      port - the port number for the Redis server
      password - the password for the Redis server; can be null or empty if no authentication is required
      serverId - the unique identifier for the server; must not be null
    • RedisManager

      public RedisManager(@NotNull @NotNull org.redisson.config.Config redisConfig, @NotNull @NotNull String serverId)
      Creates a new instance of the RedisManager class, initializing the RedissonClient instance with the given configuration.
      Parameters:
      redisConfig - the configuration object for the Redis connection; must not be null
      serverId - the unique identifier for the server; must not be null
  • Method Details

    • registerClient

      @CheckReturnValue @NotNull public @NotNull RedisClient registerClient(@NotNull @NotNull String id)
      Registers a new RedisClient with the specified ID. If a client with the same ID already exists, it returns the existing client instead of creating a new one.
      Parameters:
      id - the unique identifier for the RedisClient to register; must not be null
      Returns:
      the newly registered RedisClient instance, or the existing RedisClient instance if a client with the same ID is already registered
    • getGson

      public com.google.gson.Gson getGson()
      Retrieves the instance of Gson used by the RedisManager.
      Returns:
      the Gson instance used for JSON serialization and deserialization.