instance method combined_fragment_cache_key

Ruby on Rails 7.2.3

Since v5.2.8.1

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

combined_fragment_cache_key(key)

Given a key (as described in expire_fragment), returns a key array suitable for use in reading, writing, or expiring a cached fragment. All keys begin with :views, followed by ENV["RAILS_CACHE_ID"] or ENV["RAILS_APP_VERSION"] if set, followed by any controller-wide key prefix values, ending with the specified key value.

Parameters

key req
Source
# File actionpack/lib/abstract_controller/caching/fragments.rb, line 68
      def combined_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

        cache_key = [:views, ENV["RAILS_CACHE_ID"] || ENV["RAILS_APP_VERSION"], head, tail]
        cache_key.flatten!(1)
        cache_key.compact!
        cache_key
      end

Defined in actionpack/lib/abstract_controller/caching/fragments.rb line 68 · View on GitHub · Improve this page · Find usages on GitHub

Defined in AbstractController::Caching::Fragments

Type at least 2 characters to search.

↑↓ navigate · open · esc close