Dancer2::Plugin::Redis 中 'retry' 和 'every' 配置参数的意义是什么
what is the significance of 'retry' and 'every' config parameters in Dancer2::Plugin::Redis
我正在使用 Dancer2::Plugin::Redis 插件来处理 Redis 连接。
为了提供需要的配置参数,文档给出了如下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:
reconnect
和 every
参数如何协同工作?
连接是否会持续 60 秒并且每 5 秒刷新一次?如果是这样,那没有任何意义。
来自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 every every
microseconds (1
ms by default), up-to reconnect
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.
我正在使用 Dancer2::Plugin::Redis 插件来处理 Redis 连接。
为了提供需要的配置参数,文档给出了如下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:
reconnect
和 every
参数如何协同工作?
连接是否会持续 60 秒并且每 5 秒刷新一次?如果是这样,那没有任何意义。
来自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.