class JbuilderTemplate

def cache_if!(condition, *args, &block)

end
json.extract! @person, :name, :age
json.cache_if! !admin?, @person, expires_in: 10.minutes do

Example:

the same way.
signature as the `cache` helper method in `ActionView::Helpers::CacheHelper` and so can be used in
Conditionally caches the json depending in the condition given as first parameter. Has the same
def cache_if!(condition, *args, &block)
  condition ? cache!(*args, &block) : yield
end