instance method cached

Ruby on Rails 6.1.7.10

Since v3.0.20 Last seen in v6.1.7.10 Private

Available in: v3.0.20 v5.2.8.1 v6.0.6 v6.1.7.10

Signature

cached(key, path_info, details, locals)

Handles templates caching. If a key is given and caching is on always check the cache before hitting the resolver. Otherwise, it always hits the resolver but if the key is present, check if the resolver is fresher before returning it.

Parameters

key req
path_info req
details req
locals req
Source
# File actionview/lib/action_view/template/resolver.rb, line 181
    def cached(key, path_info, details, locals)
      name, prefix, partial = path_info

      if key
        @cache.cache(key, name, prefix, partial, locals) do
          yield
        end
      else
        yield
      end
    end

Defined in actionview/lib/action_view/template/resolver.rb line 181 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionView::Resolver

Type at least 2 characters to search.

↑↓ navigate · open · esc close