mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Use ActionCaching in OrderCyclesController (taxons and properties)
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
module Api
|
||||
class OrderCyclesController < Api::BaseController
|
||||
include EnterprisesHelper
|
||||
respond_to :json
|
||||
include ApiActionCaching
|
||||
|
||||
skip_authorization_check
|
||||
|
||||
caches_action :taxons, :properties, expires_in: CacheService::FILTERS_EXPIRY
|
||||
|
||||
def products
|
||||
products = ProductsRenderer.new(
|
||||
distributor,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class CacheService
|
||||
FILTERS_EXPIRY = 30.seconds.freeze
|
||||
|
||||
def self.cache(cache_key, options = {})
|
||||
Rails.cache.fetch cache_key.to_s, options do
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user