Module Ramaze::Helper::Cache
In: lib/ramaze/helper/cache.rb

Caching of simple objects and whole action responses.

Methods

Classes and Modules

Module Ramaze::Helper::Cache::SingletonMethods

Public Class methods

Setup needed traits, add the singleton methods and add the caches used by this helper.

@param [Class] into Class that this Module is included into @author manveru

Public Instance methods

This method is used to access Ramaze::Cache.cache_helper_value. It provides an easy way to cache long-running computations, gathering external resources like RSS feeds or DB queries that are the same for every user of an application. This method changes behaviour if a block is passed, which can be used to do lazy computation of the cached value conveniently when using a custom TTL or longer expressions that don‘t fit on one line with ||=.

@example to get the cache object directly

  count = cache_value[:count] ||= Article.count

@example with block

  count = cache_value(:count){ Article.count }
  count = cache_value(:count, :ttl => 60){ Article.count }

@return [Object] The cache wrapper assigned for :cache_helper_value @see Innate::Cache @author manveru

@param [Action] action The currently wrapped action @yield The next block in wrap_action_call @return [String] the response body @see Innate::Node#wrap_action_call @author manveru

[Validate]