-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
MemoryStore#fetch with 7.1 defaults can't set expires_at
via block opts
#49796
Comments
expires_at
expires_at
via block opts
If no one minds, I'll check it out |
I don't find this issue is related to The problem is in this merge when we delete expires_at from hash here we delete it from call_options, which is different object from options (which still contains expires_at), so, merge leads to this behaviour I'll work on fix |
Well, turns out the actual problem is a bit more serious (but easy to fix) method |
…rwriten [Fix #49796] Prevent global cache options being overwritten
Steps to reproduce
In a Rails app, use the following config:
Now, use
Rails.cache.fetch
passing a block and try to setoptions.expires_at
. AnArgumentError
is raised:Additionally, the cache store's options are mutated with the
expries_at
option set in the blockExpected behavior
Cache is written with the given
expires_at
value.Actual behavior
An
ArgumentError
is raised saying that we're trying to set two options.Rails.cache
options are mutated with the options from the block.System configuration
Rails version: main
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: