Forum: Ruby on Rails [ANN] New BackgrounDRb release

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ezra Z. (Guest)
on 2006-05-25 22:38
(Received via mailing list)

	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:

	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!

Brian H. (Guest)
on 2006-05-25 23:06
(Received via mailing list)
This is just awesome. Wow.
This topic is locked and can not be replied to.