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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document :mem_cache_store $MEMCACHE_SERVERS incompatibility #764

Conversation

sambostock
Copy link
Contributor

This adds a warning to History.md and 3.0-Upgrade.md to help prevent mistakes when migrating from :dalli_store to :mem_cache_store.

:dalli_store falls back to $MEMCACHE_SERVERS if no addresses are given, whereas :mem_cache_store goes straight to localhost:11211.

This is not immediately obvious, especially to users not providing any custom options, and makes it easy to accidentally effectively disable caching entirely (if localhost:11211 is not a memcached server).

Note that rails/rails#40420 would add support for $MEMCACHE_SERVERS. Nonetheless, I think it would make sense to get this documentation out ASAP to prevent accidents. If the PR is accepted, it would make sense to follow up with a message mentioning specific Rails versions, once it has made it into a release.

`:dalli_store` falls back to `$MEMCACHE_SERVERS` if no addresses are
given, whereas (prior to Rails 6.1) `:mem_cache_store` goes straight to
`localhost:11211`.

This is not immediately obvious, especially to users not providing any
custom options, and makes it easy to accidentally effectively disable
caching entirely (if `localhost:11211` is not a memcached server).

Note that rails/rails#40420 added support for
`$MEMCACHE_SERVERS`, and is slated for release as part of Rails 6.1.

[ci skip]
@sambostock sambostock force-pushed the document-mem_cache_store-incompatibility branch from c978c67 to 918787a Compare October 21, 2020 16:01
@sambostock
Copy link
Contributor Author

Well, that was fast. rails/rails#40420 has been merged already, and should be included as part of the Rails 6.1 release. I've updated the docs accordingly.

@sambostock
Copy link
Contributor Author

@petergoldstein what do you think of this change?

@sambostock
Copy link
Contributor Author

Maybe I should have pinged @mperham instead?

@mperham
Copy link
Collaborator

mperham commented Oct 29, 2020 via email

@sambostock
Copy link
Contributor Author

Thanks for the context @mperham.

While the behaviour isn't documented in :dalli_store, it doesn't log deprecation warnings either, so (having little Memcached experience) it wasn't something I thought of as unusual.

My concern is that making this change can break things without warning

-config.cache_store = :dalli_store
+config.cache_store = :mem_cache_store

I was hoping to prevent others from encountering the same issue by calling it out in the migration guide.

@mperham mperham closed this Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants