mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-26 01:33:22 +00:00
Use time-based caching on rendered AMS data for shops
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user