Forum: Ruby on Rails Page Caching extending it?

B2099e6049b78ac28d07e5d8f0a01300?d=identicon&s=25 rails.nerd@gmail.com (Guest)
on 2011-02-17 13:59
(Received via mailing list)
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 :)

thanks
B2099e6049b78ac28d07e5d8f0a01300?d=identicon&s=25 rails.nerd@gmail.com (Guest)
on 2011-02-17 22:32
(Received via mailing list)
Any clues anyone?

On Feb 17, 11:57pm, "rails.n...@gmail.com" <rails.n...@gmail.com>
1566d4066e11205ec3e3aaeeaf89348b?d=identicon&s=25 Luke Cowell (lcowell)
on 2011-02-18 03:26
(Received via mailing list)
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
B2099e6049b78ac28d07e5d8f0a01300?d=identicon&s=25 rails.nerd@gmail.com (Guest)
on 2011-02-18 07:55
(Received via mailing list)
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
684b64cf1db4f88d642531024278ec40?d=identicon&s=25 Radhames Brito (rbritom)
on 2011-02-18 13:37
(Received via mailing list)
is it a version manager your want, something that lets you go back to a
previous page version?
B2099e6049b78ac28d07e5d8f0a01300?d=identicon&s=25 rails.nerd@gmail.com (Guest)
on 2011-02-18 15:47
(Received via mailing list)
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
B2099e6049b78ac28d07e5d8f0a01300?d=identicon&s=25 rails.nerd@gmail.com (Guest)
on 2011-02-18 16:43
(Received via mailing list)
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
1566d4066e11205ec3e3aaeeaf89348b?d=identicon&s=25 Luke Cowell (lcowell)
on 2011-02-18 17:23
(Received via mailing list)
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
D188e591eac11021329b8821a5f954c7?d=identicon&s=25 Ar Chron (railsdog)
on 2011-02-18 18:31
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
B2099e6049b78ac28d07e5d8f0a01300?d=identicon&s=25 rails.nerd@gmail.com (Guest)
on 2011-02-20 10:13
(Received via mailing list)
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://devcenter.heroku.com/articles/http-caching

That goes against expectation... hope it's an error :)
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.