Skip to content

Connection pool configuration

The following configuration parameters are available on the RedisConnectionPool:

meaning default
addr Redis server address
connectTimeoutMs connect timeout in ms 5 000
readTimeoutMs read timeout in ms 10 000
databaseIndex default database this pool should use 0
maxConnections max connections this pool should create before forcing threads to wait 100
keepAlive time interval (Duration) after which a connection should be tested before handing it out to a thread; null disables the check 30 seconds
tls TLS related config, see TLS
credentials RedisCredentials(username, password), see Authentication none

Authentication

If Redis is protected by a password (requirepass) or by ACL users, pass RedisCredentials.

val connPool = RedisConnectionPool(
    addr = InetSocketAddress("localhost", 6379),
    // username defaults to "default", which is the user of requirepass
    credentials = RedisCredentials(username = "app", password = "secret"),
)

A failed login throws RedisAuthenticationException.