lib/jbuilder/jbuilder_template.rb
def cache!(key=nil, options={})
    if @context.controller.perform_caching
      value = ::Rails.cache.fetch(_cache_key(key, options), options) do
        _scope { yield self }
      end

      merge! value
    else
      yield
    end
  end
# Caches the json constructed within the block passed. Has the same signature as the `cache` helper
# method in `ActionView::Helpers::CacheHelper` and so can be used in the same way.
#
# Example:
#
#   json.cache! ['v1', @person], expires_in: 10.minutes do
#     json.extract! @person, :name, :age
#   end
Caches the json constructed within the block passed. Has the same signature as the `cache` helper
method in `ActionView::Helpers::CacheHelper` and so can be used in the same way.




Caches the json constructed within the block passed . Has the same signature as the ` cache ` helper method in ` ActionView :: Helpers :: CacheHelper ` and so can be used in the same way .
def cache!(key=nil, options={})
    if @context.controller.perform_caching
      value = ::Rails.cache.fetch(_cache_key(key, options), options) do
        _scope { yield self }
      end
      merge! value
    else
      yield
    end
  end
def cache! ( key = nil , options = { } ) if @context . controller . perform_caching value = :: Rails . cache . fetch ( _cache_key ( key , options ) , options ) do _scope { yield self } end merge! value else yield end end
Caches the json constructed within the block passed.
Caches the json constructed within the block passed .
key
options