jbuilder icon indicating copy to clipboard operation
jbuilder copied to clipboard

cache! force option ignored?

Open bobdutch opened this issue 7 years ago • 1 comments

In versions 2.5.0 and older you could do

json.cache! "key_name", expires_in: 10.minutes, force: force? do where force? is a method that returns a boolean. If force was true then rails would generate and write the cache. This is broken when I upgrade to 2.6 and greater.

I tried using cache_if! as a workaround but it doesn't expire the cache. Is this a bug or an intentional change?

bobdutch avatar Jan 25 '18 22:01 bobdutch

Here is the merge that broke it https://github.com/rails/jbuilder/commit/65dfb3305b1c1ebae550c420a6ab6bd0e21271ec It went from using cache.fetch (which takes the force option) to using cache.read and cache.write

bobdutch avatar Jan 25 '18 22:01 bobdutch