Extract method to get the stats key in stats

This way we remove a bit of duplication and it'll be easier to change
the `stats_cache` method.
This commit is contained in:
Javi Martín
2024-04-08 14:53:13 +02:00
parent f30fa29994
commit 653848fc4e
3 changed files with 8 additions and 4 deletions

View File

@@ -224,4 +224,8 @@ module Statisticable
I18n.t("stats.age_range", start: start, finish: finish)
end
end
def stats_cache(key, &)
Rails.cache.fetch(full_cache_key_for(key), &)
end
end