Skip to content

Allow addresses to support nil values#41381

Merged
rafaelfranca merged 1 commit into
rails:mainfrom
movermeyer:allow_for_nil_addresses_from_dalli_store
Feb 9, 2021
Merged

Allow addresses to support nil values#41381
rafaelfranca merged 1 commit into
rails:mainfrom
movermeyer:allow_for_nil_addresses_from_dalli_store

Conversation

@movermeyer

Copy link
Copy Markdown
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.
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.

2 participants