1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/lib/active_support/cache
Sam Bostock e79364610c
Fallback to $MEMCACHE_SERVERS if no servers given
By default, Dalli has two fallbacks if no server addresses are given:

- $MEMCACHE_SERVERS
- "127.0.0.1:11211"

However, MemCacheStore does its own check for addresses, and falls back
to "localhost:11211" if none are present.

This can lead to bugs in migrations from the deprecated :dalli_store
(provided by the Dalli) to :mem_cache_store:

```diff
-config.cache_store = :dalli_store     # could be implicitly relying on $MEMCACHE_SERVERS
+config.cache_store = :mem_cache_store # ignores $MEMCACHE_SERVERS
```

By removing our own fallback and simply passing `nil` to Dalli::Client,
we get its fallback logic for free. Tests are added so we can detect if
this ever changes.
2020-10-20 23:50:52 -04:00
..
strategy Duplicate the cached value before writing it in the local cache 2019-10-29 17:04:45 +01:00
file_store.rb Make AS::Cache coder configurable 2020-10-14 12:12:36 +02:00
mem_cache_store.rb Fallback to $MEMCACHE_SERVERS if no servers given 2020-10-20 23:50:52 -04:00
memory_store.rb Make AS::Cache coder configurable 2020-10-14 12:12:36 +02:00
null_store.rb Introduce keyword arguments for some AS::Cache methods 2019-09-03 17:48:40 +09:00
redis_cache_store.rb Make AS::Cache coder configurable 2020-10-14 12:12:36 +02:00