1
0
Fork 0
forked from OpenNeo/impress

Extend OWLS caching from 15 minutes to 1 day

Poking at the site, I didn't love that clicking any of the NC items on
the homepage took a few seconds to load cuz of the OWLS request taking
a couple seconds.

If the request were faster to load I might decide otherwise, but for
now, let's just keep that cache long.

Another approach we could take would be to ask for an endpoint that
returns all the values at once, so we could cache and update them all
together, instead of having it all split into separate cache keys!
This commit is contained in:
Emi Matchu 2024-01-15 06:19:34 -08:00
parent e337767954
commit 6d343989de

View file

@ -8,7 +8,7 @@ module OwlsValueGuide
def self.find_by_name(item_name) def self.find_by_name(item_name)
# Load the itemdata, pulling from the Rails cache if possible. # Load the itemdata, pulling from the Rails cache if possible.
cache_key = "OwlsValueGuide/itemdata/#{item_name}" cache_key = "OwlsValueGuide/itemdata/#{item_name}"
data = Rails.cache.fetch(cache_key, expires_in: 15.minutes) do data = Rails.cache.fetch(cache_key, expires_in: 1.day) do
load_itemdata(item_name) load_itemdata(item_name)
end end