Caching / Edits

2 months ago

Edited line 30 :

:cache_html_directory => Merb.dir_for(:public),
:cache_html_directory => Merb.dir_for(:public) / "cache",

Edited line 59 :

cache_page :list # this will cache the action in public/cache/list.html # by default or to whatever you pointed :cache_html_directory # to in plugin configuration
cache_page :action_name # this will cache the action in public/cache/something.html

Edited line 65 :

# cache_pages :archives, [:list, 5]
# cache_pages :action_name, [:another_action, 5], :some_action

Edited line 67 :

cache_action :show, 10
cache_action :another_action, 10

Edited line 71 :

# cache_actions :archives, [:list, 5], :some_action
# cache_actions :action_name, [:another_action, 5], :some_action

Edited line 72 :

# example of persisted entities caching using some keys convention

Edited line 85 :

def create # do validation and creation... expire_page(:list)
def some_action_that_invalidates_cache expire_page(:action_name) expire_action(:another_action)

Edited line 91 :

def update # do update... expire_action(:action => "archives", :controller => "users") end def destroy # destroy object...
def delete

Edited line 93 :

# see fragment caching examples above expire("user_archives") # redirect
render

Edited line 112 :

<%- cache "online_users_count", 10 do %> <div>some expensive queries or calculations</div>
<%- cache "users_index", 10 do %> <div>some big template</div>

Edited line 122 :

<div>cache invalidated somewhere in controller when necessary</div>
<div>some big template</div>

3 months ago

Edited line 79 :

# you could have called cache_set with an expiration time as well:
# you could have calle cache_set with an expiration time as well:

4 months ago

Edited line 110 :

 
  <!-- this entry will expire in 10 minutes --> 
 
  # this entry will expire in 10 minutes 

Edited line 120 :

 
 

4 months ago

4 months ago

4 months ago

4 months ago

Edited line 28 :

 
 

Edited line 57 :

 
 

4 months ago

Edited line 4 :

Much of this info compiled from merb-cache rdoc—contribute!!

rdoc from which much of this is being ripped: http://merbivore.com/documentation/merb-more/0.9.2/merb-cache/index.html

Edited line 7 :

merb-cache currently supports:
Currently supports:

4 months ago

Edited line 1 :

merb-cache plugin is part of the merb-more package

merb-cache plugin is part of the //merb-more// package

Edited line 7 :

Currently supports:
  • page caching
  • action caching
  • fragment caching
  • object caching

Currently supports: * page caching * action caching * fragment caching * object caching

Edited line 14 :

Implemented cache stores:
  • memory
  • memcache
  • file
  • database (sequel, datamapper, activerecord)

Implemented cache stores: * memory * memcache * file * database (sequel, datamapper, activerecord)

Edited line 21 :

Example configuration

Example configuration

Edited line 22 :

Edited line 46 :

Example Code

Example Code

Edited line 47 :

controller

Edited line 98 :

views/users/index.html.erb

//views/users/index.html.erb//

Edited line 106 :

views/users/archive.html.erb

//views/users/archive.html.erb//

4 months ago