Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

update cache_fu to allow action TTL, other stuff

#15

hi

I've updated cache_fu to allow setting the ttl for action caching on a per action level. This is only enabled when fragment caching is turned on, since once you switch memcache fragments on you have to use memcache for actions also.

The syntax is as follows:

caches_action :index, :page => { :ttl => 5.minutes } # :index uses default ttl, like normal

Or:

caches_action :landing => { :ttl => 20.hours }, :show => { :ttl => 5.minutes }

We don't really need the nested hash, but that keeps it consistent with the rest of the cache_fu API.

This patch also has a couple other assorted things that I fixed as I went:

  • fragment caching will now fallback to the ttl in config first, then it falls back to 25 minutes -- before it would fall back to 25 minutes and ignore the setting in the config.
  • in the test helper, try adding vendor/rails to the load path if possible, so that tests will run against that if you are vendor'ing.
  • use $LOAD_PATH, not $:, more readable
  • rename a fragment cache spec that was a copy and paste error (had a duplicate spec name so probably wasn't running

Reported by Rob Sanheim · May 12th, 2007 @ 02:03 PM

State: resolved
Milestone: acts_as_cached 2
Assigned to: Chris Wanstrath Chris Wanstrath

Activity

  1. Rob Sanheim
    Rob Sanheim

    patie: http://pastie.caboo.se/60977

    One other thing: I had to add more stuff from the rails test process to properly test action caching...also had to throw in a route instance and a 2nd controller. I'm sure it could be cleaned up some...

    May 12th, 2007 @ 02:03 PM

  2. Chris Wanstrath
    Chris Wanstrath
    • State changed from new to resolved
    • Milestone set to acts_as_cached 2

    May 12th, 2007 @ 02:03 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.