I''ve got a controller method that I''d like to cache ... the problem is I only want to cache the XML output of a method. (This is for a number of reasons, including the fact that the feed of this action gets hit fairly often, but the html result does no and also contains other, user-specific info in the layout.) In other words, I''m wondering how to do the following: ---- class MyController < ApplicationContorller caches_action :index, :only_format => :xml def index @items = Item.find( :all ) respond_to |format| do format.html # This should not be action cached format.xml # This should be action cached end end end ---- Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I suspect you''ll want to go beyond the pre-wired caching and use something like memcache where you''ll have a lot more control over what gets cached. On Jan 28, 4:52 pm, Lance Ditkins <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''ve got a controller method that I''d like to cache ... the problem is I > only want to cache the XML output of a method. (This is for a number of > reasons, including the fact that the feed of this action gets hit fairly > often, but the html result does no and also contains other, > user-specific info in the layout.) > > In other words, I''m wondering how to do the following: > > ---- > > class MyController < ApplicationContorller > > caches_action :index, :only_format => :xml > > def index > > @items = Item.find( :all ) > respond_to |format| do > format.html # This should not be action cached > format.xml # This should be action cached > end > > end > > end > > ---- > > Thanks! > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
AndyV wrote:> I suspect you''ll want to go beyond the pre-wired caching and use > something like memcache where you''ll have a lot more control over what > gets cached. > > On Jan 28, 4:52 pm, Lance Ditkins <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Thanks for the reply ... but what effect would the fragment storage mechanism have on this functionality? AFAIK, file fragment storage has just as many options for namespace tinkering etc that memcache does. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---