acts_as_cached 2.0 needs your help!

Skip to first unread message

Chris Wanstrath

Jan 28, 2007, 9:48:57 PM1/28/07
Hey cachers,

I spent my Saturday re-writing the internals of acts_as_cached. The
first version, the one we're all using in production, uses $globals
for config state, has some questionable tests, has a big-ass untested
init.rb file, and is hard as hell to read. I don't really even
understand it anymore -- there is a lot of metaprogramming going on.

The new version, the one I'm writing to you about, is much better.
The API stays the same, but the insides are more efficient, better
written, easier to understand, and easier to extend. It should be a
drop-in replacement aside from the fact that it requires (as far as I
know) 1.2+.

The new version is fully spec'd using test/spec and mocha, written
using BDD. Hopefully this means you all will be able to play around
with the internals and submit cool functionality (along with nice,
Englishy tests/specs). Good examples are the Disabled and
Benchmarking modules -- they leave the core of the plugin mostly alone
while adding in new functionality, Rails-style.

Okay, so I need your help. When you've time, please try out the new
version and let me know how it fares. Run the tests, run your app,
etc. It works in my apps but I'm not you.

You can get it here:

Yeah, that's a temporary name until it's ready. I'm ripping off
technoweenie here.

You can run the tests with `rake test` from the plugin's directory.
You can run tests against a localhost:11211 memcache daemon with `rake
test_with_memcache` if you'd like. I had to isolate the tests because
some actions, like enabling Benchmarking, can't be reversed. You

There are no comments, no README file, and no documentation yet.
Sorry about that. On the plus side, I'm in the process of building a
mini-site ( which will basically be everything I
know about memcache, all the ways I use acts_as_cached, and all the
ways you can use it. Extensive API docs + tips'n'tricks beyond my

Oh, one last thing: skip_cache_gets can only be accessed from
ActsAsCached now. So, in your before filter:

before_filter :skip_gets

def skip_gets
returning true do
ActsAsCached.skip_cache_gets = !!params[:skip_gets]

Previously you could call this method from any Ruby object, but that
makes no sense. Think about it.

Cool, thanks. Let me know what happens. If all goes well this will
replace acts_as_cached within a few weeks.

Chris Wanstrath

Henry Ning

Jan 28, 2007, 9:50:40 PM1/28/07
can !?
Reply all
Reply to author
0 new messages