I want to be able to cache a page only when a user is not logged in, I''ve implemented this technique http://www.ethelred.org/articles/2006/10/22/conditional-use-of-page-cache-in-rails to only send a request to rails when a user is logged in and display a cached page when the user is not logged in. The problem is that when a logged in user views a page that is to be cached rails then caches the page with the content that is displayed to a logged in user, this will then be displayed when a user who is not logged in views the page. So what I would like to be able to do is to only page cache a page when a user is not logged in. Does anyone have any ideas about how I could do this? Cheers Teesea --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
hi teesea, i just wanted to know whether you are getting this problem only when cache pages. I mean if you remove your cache logic will everything works fine?. i guess may be you will be doing a authorization check before serving any pages to a user(if not is it ok??) and when will this cached pages expire.? On Aug 14, 10:34 pm, teesea <t.co...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I want to be able to cache a page only when a user is not logged in, > > I''ve implemented this technique > > http://www.ethelred.org/articles/2006/10/22/conditional-use-of-page-c... > > to only send a request to rails when a user is logged in and display a > cached page when the user is not logged in. The problem is that when a > logged in user views a page that is to be cached rails then caches the > page with the content that is displayed to a logged in user, this will > then be displayed when a user who is not logged in views the page. So > what I would like to be able to do is to only page cache a page when a > user is not logged in. > > Does anyone have any ideas about how I could do this? > > Cheers > > Teesea--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 8/14/07, teesea <t.combe-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I want to be able to cache a page only when a user is not logged in, > > I''ve implemented this technique > > http://www.ethelred.org/articles/2006/10/22/conditional-use-of-page-cache-in-rails > > to only send a request to rails when a user is logged in and display a > cached page when the user is not logged in. The problem is that when a > logged in user views a page that is to be cached rails then caches the > page with the content that is displayed to a logged in user, this will > then be displayed when a user who is not logged in views the page. So > what I would like to be able to do is to only page cache a page when a > user is not logged in. > > Does anyone have any ideas about how I could do this?You should use action caching for this. It lets you run any authorization before filters before checking for the cache. It''s not as fast as page caching, but authenticated pages need to hit rails to run the authorization code. There are other solutions like using nginx SSI includes: http://theexciter.com/articles/dynamic-page-caching-with-nginx-ssi -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
Thanks for the responses I''ll have a look at action caching and see how that works out On Aug 15, 10:18 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 8/14/07,teesea<t.co...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I want to be able to cache a page only when a user is not logged in, > > > I''ve implemented this technique > > >http://www.ethelred.org/articles/2006/10/22/conditional-use-of-page-c... > > > to only send a request to rails when a user is logged in and display a > > cached page when the user is not logged in. The problem is that when a > > logged in user views a page that is to be cached rails then caches the > > page with the content that is displayed to a logged in user, this will > > then be displayed when a user who is not logged in views the page. So > > what I would like to be able to do is to only page cache a page when a > > user is not logged in. > > > Does anyone have any ideas about how I could do this? > > You should use action caching for this. It lets you run any > authorization before filters before checking for the cache. It''s not > as fast as page caching, but authenticated pages need to hit rails to > run the authorization code. > > There are other solutions like using nginx SSI includes:http://theexciter.com/articles/dynamic-page-caching-with-nginx-ssi > > -- > Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---