mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Do not calculate cache_key unless caching
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user