instance method fragment_cache_key

Ruby on Rails 5.1.7

Since v5.0.7.2 Last seen in v5.2.8.1

Available in: v5.0.7.2 v5.1.7 v5.2.8.1

Signature

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

key req
Source
# File actionpack/lib/abstract_controller/caching/fragments.rb, line 64
      def fragment_cache_key(key)
        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 64 · View on GitHub · Improve this page · Find usages on GitHub

Defined in AbstractController::Caching::Fragments

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close