mirror of https://github.com/rails/rails
Update ActiveSupport::Cache::RedisCacheStore documentation
For more info: * https://github.com/rails/rails/issues/46149 * https://github.com/rails/rails/pull/46204
This commit is contained in:
parent
60d05cda7f
commit
d4025ab1fe
|
@ -507,9 +507,8 @@ is often faster than waiting more than a second to retrieve it. Both read and
|
||||||
write timeouts default to 1 second, but may be set lower if your network is
|
write timeouts default to 1 second, but may be set lower if your network is
|
||||||
consistently low-latency.
|
consistently low-latency.
|
||||||
|
|
||||||
By default, the cache store will not attempt to reconnect to Redis if the
|
By default, the cache store will attempt to reconnect to Redis once if the
|
||||||
connection fails during a request. If you experience frequent disconnects you
|
connection fails during a request.
|
||||||
may wish to enable reconnect attempts.
|
|
||||||
|
|
||||||
Cache reads and writes never raise exceptions; they just return `nil` instead,
|
Cache reads and writes never raise exceptions; they just return `nil` instead,
|
||||||
behaving as if there was nothing in the cache. To gauge whether your cache is
|
behaving as if there was nothing in the cache. To gauge whether your cache is
|
||||||
|
@ -537,10 +536,10 @@ A more complex, production Redis cache store may look something like this:
|
||||||
cache_servers = %w(redis://cache-01:6379/0 redis://cache-02:6379/0)
|
cache_servers = %w(redis://cache-01:6379/0 redis://cache-02:6379/0)
|
||||||
config.cache_store = :redis_cache_store, { url: cache_servers,
|
config.cache_store = :redis_cache_store, { url: cache_servers,
|
||||||
|
|
||||||
connect_timeout: 30, # Defaults to 20 seconds
|
connect_timeout: 30, # Defaults to 1 second
|
||||||
read_timeout: 0.2, # Defaults to 1 second
|
read_timeout: 0.2, # Defaults to 1 second
|
||||||
write_timeout: 0.2, # Defaults to 1 second
|
write_timeout: 0.2, # Defaults to 1 second
|
||||||
reconnect_attempts: 1, # Defaults to 0
|
reconnect_attempts: 2, # Defaults to 1
|
||||||
|
|
||||||
error_handler: -> (method:, returning:, exception:) {
|
error_handler: -> (method:, returning:, exception:) {
|
||||||
# Report errors to Sentry as warnings
|
# Report errors to Sentry as warnings
|
||||||
|
|
Loading…
Reference in New Issue