[ANN] New BackgrounDRb release


There is a new release of BackgrounDRb. This time it is a full

fledged rails plugin with generators and rake tasks thanks to Saimon
Moore. Thanks Saimon!

You can read all about it here on my blog:

Ruby on Rails Blog / What is Ruby on Rails for?

The newest feature besides the much cleaner way to install and

control the drb server is caching. You can now use BackgrounDRb as a
full fledged in memory cache for any type of object that can be
Marshal’ed. Here’s a peek:

To cache an object you can do it two ways.

@posts = Post.find(:all, :include => :comments)
MiddleMan.cache_as(:post_cache, @posts)

MiddleMan.cache_as :post_cache do
Post.find(:all, :include => :comments)
And to retrieve the cache you can either just grab it and if there is
nothing there it will return nil. Or you can supply a block that the
contents of will get placed in the cache if the cache is empty. This
is for fallback in case the cache is empty

This will return nil if the cache is empty:

MiddleMan.cache_get :post_cache
Or the shorthand cache_get

This will refill the cache with the contents of the block if the
cache is empty. Otherwise it will just return whats in the cache:

MiddleMan.cache_get :post_cache do
Post.find(:all, :include => :comments)

Hope people get some good use out of this plugin. I know it's

working great for me. I would love to hear about how people are using
this in their apps so tell me about it!


This is just awesome. Wow.