This is just awesome. Wow.
On 5/25/06, Ezra Zygmuntowicz <ezmobius@gmail.com>
wrote:>
> Friends-
>
> 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:
>
> http://brainspl.at/articles/2006/05/25/backgroundrb-new-release
>
> 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)
>
> OR
> MiddleMan.cache_as :post_cache do
> Post.find(:all, :include => :comments)
> end
>
> 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
> MiddleMan[:post_cache]
>
> 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)
> end
>
>
> 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!
>
>
> Cheers-
> -Ezra
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>