Forum: Ruby on Rails Page Caching extending it?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
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
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>
C34a9bf9340a0ad51dc43d0644d01088?d=identicon&s=25 Luke C. (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
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
242714f4ce799584fca8e72f226eb0fc?d=identicon&s=25 Radhames B. (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?
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
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
C34a9bf9340a0ad51dc43d0644d01088?d=identicon&s=25 Luke C. (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
5a85dea2b6a7a685acb779763ec5b57e?d=identicon&s=25 Ar C. (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
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 :)
This topic is locked and can not be replied to.