I am using Dancer2::Plugin::Redis plugin to handle the Redis connections.
In order to provide the required configuration parameters, the documentation gives the following sample.
plugins:
Redis:
# if you use TCP/IP:
server: "localhost:6379"
# if you use UNIX/Linux sockets:
sock: "/path/to/sock"
# (optional) Redis password used with auth:
password: "Very secure password 123!"
# (optional) Reconnect up to 60 seconds (reconnect) every 5000 milliseconds (every):
reconnect: 60
every: 5000
# (optional) Redis connection name (NOT the Redis database ID):
name: "my_connection_name"
# (optional) Function called on Redis connect:
on_connect: "MyDancer2App::redis_on_connect"
# (optional) Use serialization for storing values other than simple scalars with Redis:
How does the reconnect
and every
parameters work together?
Is it like connection will be alive for 60 seconds and it refreshes every 5 sec? If so, it does not make any sense.
From https://metacpan.org/pod/Redis#reconnect,-every
The
reconnect
option enables auto-reconnection mode. If we cannot connect to the Redis server, or if a network write fails, we enter retry mode. We will try a new connection everyevery
microseconds (1 ms by default), up-toreconnect
seconds.Be aware that read errors will always thrown an exception, and will not trigger a retry until the new command is sent.
If we cannot re-establish a connection after
reconnect
seconds, an exception will be thrown.