Use time-based caching on rendered AMS data for shops

This commit is contained in:
Matt-Yorkley
2020-04-22 14:52:55 +02:00
parent 545ca85644
commit 2876b98155
3 changed files with 5 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
class CacheService
HOME_STATS_EXPIRY = 1.day.freeze
FILTERS_EXPIRY = 30.seconds.freeze
SHOPS_EXPIRY = 15.seconds.freeze
def self.cache(cache_key, options = {})
Rails.cache.fetch cache_key.to_s, options do

View File

@@ -6,7 +6,8 @@
= current_distributor.logo.url
- content_for :injection_data do
= inject_enterprise_shopfront(@enterprise)
- cache "enterprises/shop/inject_enterprise_shopfront-#{@enterprise.id}", expires_in: CacheService::SHOPS_EXPIRY do
= inject_enterprise_shopfront(@enterprise)
%shop.darkswarm
- if @shopfront_layout == 'embedded'

View File

@@ -2,7 +2,8 @@
= t :shops_title
- content_for :injection_data do
= inject_enterprises(@enterprises)
- cache "shops/index/inject_enterprises", expires_in: CacheService::SHOPS_EXPIRY do
= inject_enterprises(@enterprises)
#panes
#shops.pane