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

cache_nils is true by default #1006

Open
jshoung opened this issue Jul 2, 2024 · 1 comment
Open

cache_nils is true by default #1006

jshoung opened this issue Jul 2, 2024 · 1 comment

Comments

@jshoung
Copy link

jshoung commented Jul 2, 2024

@petergoldstein I'm not sure what I'm missing but the default behavior for caching nils we're experiencing in our Rails application is true even though the documentation says otherwise:
CleanShot 2024-07-02 at 14 16 22@2x

When I look at the code, it seems like the default is true as well:

CACHE_NILS = { cache_nils: true }.freeze

req_options = req_options.nil? ? CACHE_NILS : req_options.merge(CACHE_NILS) if cache_nils

@jshoung jshoung changed the title cache_nils is enabled by default cache_nils is true by default Jul 2, 2024
@olleolleolle
Copy link
Contributor

olleolleolle commented Aug 8, 2024

Ah, I think the code behaves like it should.

The suffix if controls the whole line 138. The whole line 138 does not get executed if the cache_nils method returns false.

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

No branches or pull requests

2 participants