Class RedisConnectionImpl
java.lang.Object
fr.codinbox.connector.commons.redis.RedisConnectionImpl
- All Implemented Interfaces:
RedisConnection
Implementation of
RedisConnection that loads Redisson configuration
from a YAML file and manages the Redisson client lifecycle.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the underlying Redisson client.voidinit()Initializes the Redis connection by loading configuration and creating the Redisson client.booleanReturns whether this connection is configured to cause server shutdown on initialization failure.voidshutdown()Shuts down the Redisson client and releases all associated resources.
-
Constructor Details
-
RedisConnectionImpl
public RedisConnectionImpl(@NotNull @NotNull Logger logger, @NotNull @NotNull String id, @NotNull @NotNull String configFilePath) Creates a new Redis connection instance.- Parameters:
logger- the logger for diagnostic messagesid- the connection identifierconfigFilePath- the path to the YAML configuration file (.ymlor.yaml)
-
-
Method Details
-
init
Description copied from interface:RedisConnectionInitializes the Redis connection by loading configuration and creating the Redisson client.- Specified by:
initin interfaceRedisConnection- Throws:
ConnectionInitException- if the configuration file is invalid or the connection fails
-
shutdown
public void shutdown()Description copied from interface:RedisConnectionShuts down the Redisson client and releases all associated resources.- Specified by:
shutdownin interfaceRedisConnection
-
getClient
Description copied from interface:RedisConnectionReturns the underlying Redisson client.- Specified by:
getClientin interfaceRedisConnection- Returns:
- the
RedissonClientinstance
-
isExitOnFailure
public boolean isExitOnFailure()Description copied from interface:RedisConnectionReturns whether this connection is configured to cause server shutdown on initialization failure.- Specified by:
isExitOnFailurein interfaceRedisConnection- Returns:
trueif the server should exit when this connection fails to initialize
-