markbates / mack-more

All the extra stuff you could want for the Mack Framework.

This URL has Read+Write access

markbates (author)
Mon Oct 06 11:19:35 -0700 2008
commit  6a58d6a30390690c950c9b7adeaeeef7194f9716
tree    3ee98e1d71fd13e751125c716829acb6ebdacbd5
parent  2b553b896ca7f97b3653f6336b0fcb218084aaa5
mack-more / mack-caching
name age message
..
file README Loading commit data...
file Rakefile
directory lib/
directory spec/
mack-caching/README
== Page Caching

Using page caching with Mack, is incredibly easy. The first thing you 
need to do is turn it on. In the configatron/*.rb file of your chosing
place the following configuration setting:

  use_page_caching: true
  
That will now enable your application to use the page caching system.
A restart of your application is required for this to take effect.

Now that your application is using page caching, provided by the 
Cachetastic gem, you need to tell it which controllers/actions you want
to cache.

To cache all the actions in your controller you would do something like
the following:

  class UsersController
    include Mack::Controller
    
    cache_pages
    
    # ...
    #  actions omitted
    # ...
    
  end
  
The cache_pages method takes similar inputs to before/after filters. If
you want to be more specific you can use either the :only or :except flags.

  cache_pages :only => [:index, :show]

or

  cache_pages :except => [:delete, :edit, :update]