Class | Merb::Cache |
In: |
lib/merb-cache/cache-action.rb
lib/merb-cache/cache-page.rb lib/merb-cache/merb-cache.rb |
Parent: | Object |
DEFAULT_CONFIG | = | { :cache_html_directory => Merb.dir_for(:public) / "cache", #:store => "database", #:table_name => "merb_cache", #:disable => "development", # disable merb-cache in development #:disable => true, # disable merb-cache in all environments :store => "file", :cache_directory => Merb.root_path("tmp/cache"), #:store => "memcache", #:host => "127.0.0.1:11211", #:namespace => "merb_cache", #:track_keys => true, #:store => "memory", # store could be: file, memcache, memory, database, dummy, ... } |
config | [R] | |
store | [R] |
Compute a cache key and yield it to the given block It is used by the expire_page, expire_action and expire methods.
options<String, Hash>: | The key or the Hash that will be used to build the key |
controller<String>: | The name of the controller |
controller_based<Boolean>: | only used by action and page caching |
:key<String>: | The complete or partial key that will be computed. |
:action<String>: | The action name that will be used to compute the key |
:controller<String>: | The controller name that will be part of the key |
:params<Array[String]>: | The params will be joined together (with ’/’) and added to the key |
:match<Boolean, String>: | true, it will try to match multiple cache entries string, shortcut for {:key => "mykey", :match => true} |
expire(:key => "root_key", :params => [session[:me], params[:id]]) expire(:match => "root_key") expire_action(:action => 'list') expire_page(:action => 'show', :controller => 'news')
The result of the given block
Compute a cache key based on the given parameters Only used by the cached_page?, cached_action?, cached?, cache, cache_get and cache_set methods
options<String, Hash>: | The key or the Hash that will be used to build the key |
controller<String>: | The name of the controller |
controller_based<Boolean>: | only used by action and page caching |
:key<String>: | The complete or partial key that will be computed. |
:action<String>: | The action name that will be used to compute the key |
:controller<String>: | The controller name that will be part of the key |
:params<Array[String]>: | The params will be joined together (with ’/’) and added to the key |
cache_set("my_key", @data) cache_get(:key => "root_key", :params => [session[:me], params[:id]])
The computed key