Reputation: 321
I am using "RedisClient" as shown below: However, the connection is not getting closed after connectTimeout. Kindly let me know.
RedisClient(host = host,
port = port,
password = Some(password),
connectTimeout = Some(timeout))
netstat -atn doesn't show any reduction in connection. They keep growing.
Upvotes: 3
Views: 10786
Reputation: 1045
The parameter connectTimeout is the timeout for attempting to connect Redis server instead of the close time of idle connections.
Redis is not able to configure timeout for a specified Redis connection.
But if you want to configure timeout for all Redis connections, you can configure it in Redis server ahead of time. Once it's configured, All the client connections will be closed after it is idle for the configured time.
Just run for once:
127.0.0.1:6379> CONFIG SET timeout 10
if the client is idle for more than 10s, the client connection will be closed.
Upvotes: 6