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

Allow addresses to support nil values #41381

Merged
merged 1 commit into from Feb 9, 2021
Merged

Allow addresses to support nil values #41381

merged 1 commit into from Feb 9, 2021

Conversation

movermeyer
Copy link
Contributor

Summary

Users of :dalli_store may have been passing an explicit nil parameter for the servers:

config.cache_store = :dalli_cache, nil, { expires_in: 2.hour, compress: true }

If they simply changed :dalli_cache and :mem_cache_store, the existing code passes addresses = [nil] to Dalli (instead of nil), which cause exceptions when people try to access the cache:

> Rails.cache.fetch('foo')
NoMethodError: undefined method `match' for nil:NilClass

This change allows users to continue passing the explicit nil, making migrations from :dalli_store to :mem_cache_store simpler.

@movermeyer movermeyer marked this pull request as ready for review February 9, 2021 14:33
Users of `:dalli_store` may have been passing an explicit `nil` parameter for the servers:

```ruby
config.cache_store = :dalli_cache, nil, { expires_in: 2.hour, compress: true }
```

If they simply changed `:dalli_cache` and `:mem_cache_store`, the existing code passes `addresses = [nil]` to Dalli (instead of `nil`), which cause exceptions when people try to access the cache:

```
> Rails.cache.fetch('foo')
NoMethodError: undefined method `match' for nil:NilClass
```

This change allows users to continue passing the explicit `nil`, making migrations from `:dalli_store` to `:mem_cache_store` simpler.
@rafaelfranca rafaelfranca merged commit 06e8d5c into rails:main Feb 9, 2021
1 check passed
rafaelfranca added a commit that referenced this pull request Feb 9, 2021
…m_dalli_store

Allow addresses to support `nil` values
brendon pushed a commit to brendon/rails that referenced this pull request Jun 17, 2021
…s_from_dalli_store

Allow addresses to support `nil` values
brendon pushed a commit to brendon/rails that referenced this pull request Jun 17, 2021
…s_from_dalli_store

Allow addresses to support `nil` values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants