diff --git a/app/services/cache_service.rb b/app/services/cache_service.rb index a68f883d0c..79d81068eb 100644 --- a/app/services/cache_service.rb +++ b/app/services/cache_service.rb @@ -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 diff --git a/app/views/enterprises/shop.html.haml b/app/views/enterprises/shop.html.haml index 7f98960b33..b6bf91ed06 100644 --- a/app/views/enterprises/shop.html.haml +++ b/app/views/enterprises/shop.html.haml @@ -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' diff --git a/app/views/shops/index.html.haml b/app/views/shops/index.html.haml index d436b85e5e..0bf7709674 100644 --- a/app/views/shops/index.html.haml +++ b/app/views/shops/index.html.haml @@ -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