Topic: Dynamic Cache Directory

I have a multisite app which uses request.domain to fetch appropriate content. It all works beautifully, except now I need to use page caching and the Rails cache is built around the idea of a single site. You can override the default like so:

config.action_controller.page_cache_directory = "#{Rails.public_path}/custom_site"

But that's not much help considering that I need multiple directories. Ideally my public folder would look like:


With each of those folders holding the relevant cache files for the corresponding site.

I've searched thoroughly through Rails API and dug around for plugins but so far haven't come across a solution

Any ideas?

Re: Dynamic Cache Directory

I don't have an answer to your specific issues but is this about caching assets? If so I have an alternative approach around using asset_host and serving your assets from multiple external cloud servers if it is of any use to you.

Also found this which might be helpfull … e-caching/

What you want and what you need are too often not the same thing!
When your head is hurting from trying to solve a problem, stop standing on it. When you are the right way up you will see the problem differently and you just might find the solution.
(Quote by me 15th July 2009)