Module: Ramaze::Helper::Cache::SingletonMethods

Defined in:
lib/ramaze/helper/cache.rb

Instance Method Summary collapse

Instance Method Details

#cache_action(hash, &block) ⇒ Object

This method allows you to cache whole actions.

Examples:

Basic usage


class Foo < Ramaze::Controller
  helper :cache
  cache_action :method => :bar

  def bar
    rand
  end
end


109
110
111
112
113
# File 'lib/ramaze/helper/cache.rb', line 109

def cache_action(hash, &block)
  hash[:key] = block if block_given?
  hash[:method] = hash[:method].to_s
  trait[:cache_action] << hash
end