Created
December 21, 2020 16:44
-
-
Save rgaufman/31872f10892c6bf6e9809466c6b5aac3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm trying to switch from :dalli_store to :mem_cache_store. | |
With :mem_cache_store, I get this: | |
``` | |
Rails.cache.fetch("zone#{zone.id}_latest_event") do | |
Event.where(zone: zone).desc(:starts_at).for_recording_create.limit(1).first | |
end | |
=> nil | |
Event.where(zone: zone).desc(:starts_at).for_recording_create.limit(1).first | |
=> #<Event _id: 5fe0cf57cf2048d63bb3c9f1... | |
``` | |
With :dalli_store, I get this: | |
``` | |
Rails.cache.fetch("zone#{zone.id}_latest_event") do | |
Event.where(zone: zone).desc(:starts_at).for_recording_create.limit(1).first | |
end | |
=> #<Event _id: 5fe0cf57cf2048d63bb3c9f1... | |
Event.where(zone: zone).desc(:starts_at).for_recording_create.limit(1).first | |
=> #<Event _id: 5fe0cf57cf2048d63bb3c9f1... | |
``` | |
It seems that :mem_cache_store is caching nil as a value, while :dalli_store is not? - How can I stop :mem_cache_store from doing this? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment