Page Caching... extending it???

Hey there

Is it possible to intercept Action Cache to force it to use a specified filename to save to.... or to load a specified cached file that is different to the current one expected for the URL?

I guess this is some sort of "extending" of action cache.... but I cannot find much in google :slight_smile:

thanks

Any clues anyone?

Interesting idea, but I'd ask the question, why would you want to do this? Is there a real-world performance bottleneck your trying to fix that wouldn't be addressed with the standard page, action or fragment caching ?

Luke

I need multiple cached versions of one page (/url) ..... tracked in memcache..... and I want to directly dump a page cache based on a condition

Yes I know there are better ways to do this in rails..... but I have bad architecture to work with

So a light wrapper around Action Cache would be super awesome! .... I just can't see anyone doing this

is it a version manager your want, something that lets you go back to a previous page version?

Not a version manager

Its more about selecting content for different circumstances

Being able to cache different versions for a page/url and select it in logic contained in a Action Cache wrapper seems the most appropriate

I'm just wondering if anyone knows of example of extending Action Cache in a similar way, I'm not sure where to begin

I guess this could also be done by implementing some sort of Fragment Cache... wrapping a whole page

Just not sure where to begin... I don't want to reinvent rails caching... just want to tweak it with a simple conditional + have control on the file cache storage

Could you just do something like this:

<% cache(:action => "list", :controller => "blah", :style => "new") do %> # code that renders in either mode conditionally <% end %>

You could also look at using something like cells, which has caching built in and might be flexible enough to cache and render 2 different views under the same action (depending on the circumstances).

Luke

rails.nerd@gmail.com wrote in post #982493:

I guess this could also be done by implementing some sort of Fragment Cache... wrapping a whole page

Just not sure where to begin... I don't want to reinvent rails caching... just want to tweak it with a simple conditional + have control on the file cache storage

+1 to fragment caching, as it is an easy-peasy solution to implement

Thanks for the replies guys.

I think I might be on the right track now

The documentation says: "Pressing shift-reload in the browser will cue the browser and Varnish to regenerate the page, regardless of the cache state." HTTP Caching | Heroku Dev Center

That goes against expectation... hope it's an error :slight_smile: