Sha256: 66ca0aa2fc720b3f7d2a511de3a79317f47f342842d57cbb9f269be597aeb5bd
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
module Spree module Api module V2 class BaseSerializer include JSONAPI::Serializer # to learn more about caching, please refer to: # https://github.com/jsonapi-serializer/jsonapi-serializer#caching # https://guides.rubyonrails.org/caching_with_rails.html#low-level-caching cache_options(store: Rails.cache, namespace: 'jsonapi-serializer', expires_in: Spree::Api::Config[:api_v2_serializers_cache_ttl]) def self.record_cache_options(options, fieldset, include_list, params) opts = options.dup params_cache_key = params.map do |param| next if param.nil? || param.last.nil? if param.last.respond_to?(:cache_key_with_version) param.last.cache_key_with_version else param.last.to_s.downcase end end.compact.reject(&:blank?).join('-') opts[:namespace] += "-#{params_cache_key}" super(opts, fieldset, include_list, params) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems