mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Do not calculate cache_key unless caching
This commit is contained in:
parent
81a13c4b32
commit
c9b0e4e6ae
@ -226,8 +226,9 @@ module ActiveModel
|
||||
end
|
||||
end
|
||||
|
||||
def fetch(adapter_instance, cache_options = serializer_class._cache_options, key = cache_key(adapter_instance))
|
||||
def fetch(adapter_instance, cache_options = serializer_class._cache_options, key = nil)
|
||||
if serializer_class.cache_store
|
||||
key ||= cache_key(adapter_instance)
|
||||
serializer_class.cache_store.fetch(key, cache_options) do
|
||||
yield
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user