mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
Extract timed enterprise AMS fragment caching options to service
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user