Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use $MEMCACHE_SERVERS as MemCacheStore fallback #40420

Merged
merged 4 commits into from Oct 21, 2020

Commits on Oct 21, 2020

  1. Refactor MemCacheStoreTest

    - Remove unused instance variable
    - Add client test helper
    sambostock committed Oct 21, 2020
    Copy the full SHA
    9445748 View commit details
    Browse the repository at this point in the history
  2. Add tests for :mem_cache_store initialization

    This documents existing behavior ahead of changes.
    sambostock committed Oct 21, 2020
    Copy the full SHA
    f50be30 View commit details
    Browse the repository at this point in the history
  3. 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.
    sambostock committed Oct 21, 2020
    Copy the full SHA
    e793646 View commit details
    Browse the repository at this point in the history
  4. Remove redundant arguments in store test helper

    The store now uses $MEMCACHE_SERVERS and 127.0.0.1:11211 as fallbacks,
    so there is no need to specify them them again.
    sambostock committed Oct 21, 2020
    Copy the full SHA
    85cde3c View commit details
    Browse the repository at this point in the history