Extract timed enterprise AMS fragment caching options to service

This commit is contained in:
Matt-Yorkley
2020-04-30 10:05:46 +02:00
parent 2876b98155
commit 2292cbaae4
3 changed files with 16 additions and 2 deletions

View File

@@ -36,5 +36,19 @@ class CacheService
def self.ams_all_properties_key
"inject-all-properties-#{CacheService.latest_timestamp_by_class(Spree::Property)}"
end
def self.ams_shops
[
"shops/index/inject_enterprises",
{ expires_in: SHOPS_EXPIRY }
]
end
def self.ams_shop(enterprise)
[
"enterprises/shop/inject_enterprise_shopfront-#{enterprise.id}",
{ expires_in: SHOPS_EXPIRY }
]
end
end
end

View File

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

View File

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