instance method
fragment_cache_key
Ruby on Rails 5.2.8.1
Since v5.2.8.1 Last seen in v5.2.8.1Signature
fragment_cache_key(key)
Given a key (as described in expire_fragment), returns a key suitable for use in reading, writing, or expiring a cached fragment. All keys begin with views/, followed by any controller-wide key prefix values, ending with the specified key value. The key is expanded using ActiveSupport::Cache.expand_cache_key.
Parameters
-
keyreq
Source
# File actionpack/lib/abstract_controller/caching/fragments.rb, line 69
def fragment_cache_key(key)
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Calling fragment_cache_key directly is deprecated and will be removed in Rails 6.0.
All fragment accessors now use the combined_fragment_cache_key method that retains the key as an array,
such that the caching stores can interrogate the parts for cache versions used in
recyclable cache keys.
MSG
head = self.class.fragment_cache_keys.map { |k| instance_exec(&k) }
tail = key.is_a?(Hash) ? url_for(key).split("://").last : key
ActiveSupport::Cache.expand_cache_key([*head, *tail], :views)
end
Defined in actionpack/lib/abstract_controller/caching/fragments.rb line 69
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in AbstractController::Caching::Fragments