Package net.bitbylogic.rps
Class RedisManager
java.lang.Object
net.bitbylogic.rps.RedisManager
-
Constructor Summary
ConstructorsConstructorDescriptionRedisManager(@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 TypeMethodDescriptioncom.google.gson.GsongetGson()Retrieves the instance ofGsonused by theRedisManager.@NotNull RedisClientregisterClient(@NotNull String id) Registers a new RedisClient with the specified ID.
-
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 nullport- the port number for the Redis serverpassword- the password for the Redis server; can be null or empty if no authentication is requiredserverId- 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 nullserverId- the unique identifier for the server; must not be null
-
-
Method Details
-
registerClient
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 ofGsonused by theRedisManager.- Returns:
- the
Gsoninstance used for JSON serialization and deserialization.
-