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

[close #33907] Error when using "recyclable" cache keys with a store that does not support it #33932

Merged
merged 2 commits into from Sep 21, 2018

Conversation

Projects
None yet
3 participants
@schneems
Member

schneems commented Sep 20, 2018

If you are using the "in cache versioning" also known as "recyclable cache keys" the cache store must be aware of this scheme, otherwise you will generate cache entries that never invalidate.

This PR adds a check to the initialization process to ensure that if recyclable cache keys are being used via

config.active_record.cache_versioning = true

Then the cache store needs to show that it supports this versioning scheme. Cache stores can let Rails know that they support this scheme by adding a method supports_in_cache_versioning? and returning true.

Show outdated Hide outdated activerecord/lib/active_record/railtie.rb Outdated
[close #33907] Error when using "recyclable" cache keys with a store …
…that does not support it

If you are using the "in cache versioning" also known as "recyclable cache keys" the cache store must be aware of this scheme, otherwise you will generate cache entries that never invalidate.

This PR adds a check to the initialization process to ensure that if recyclable cache keys are being used via 

```
config.active_record.cache_versioning = true
```

Then the cache store needs to show that it supports this versioning scheme. Cache stores can let Rails know that they support this scheme by adding a method `supports_in_cache_versioning?` and returning true.
Show outdated Hide outdated activerecord/lib/active_record/railtie.rb Outdated
Show outdated Hide outdated activerecord/lib/active_record/railtie.rb Outdated
Show outdated Hide outdated activesupport/lib/active_support/cache/file_store.rb Outdated
Show outdated Hide outdated railties/CHANGELOG.md Outdated
Switch to supports_cache_versioning? check to a class method
- Moving the `supports_cache_versioning?` check to a class method. 
- Shorten the method doc. 
- Expand on the error message.

@schneems schneems merged commit b122345 into rails:master Sep 21, 2018

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

rafaelfranca added a commit that referenced this pull request Sep 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment