I am trying to use caches_action and the agile book says that it is keyed off the URL, however it does not seem to pick up the URL parameters. http://localhost:3000/controller/action/id?foo=bar and http://localhost:3000/controller/action/id?foo=foobar Returns the same page. Anyone looked into how to add URL parameters to the cached key? Also, where do those file get stored? Thanks Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060213/4f454143/attachment.html
Yeah Rails doesn''t cache the query string. In your case its caching http://localhost:3000/controller/action/ There''s an action cache You might want to look at this presentation http://scottstuff.net/presentations/rails-caching on Rails Caching to understand its weaknesses. Also look at http://scottstuff.net/blog/articles/2006/01/20/time-limited-caching-for-rails. Typo has code that you can grab that allows for caching based on parameters. ---------------------------------------------------------------------------------------------------- What''s an Intel chip doing in a Mac? A whole lor more that it''s ever done in a PC. My Digital Life - http://scottwalter.com/blog Pro:Blog - http://scottwalter.com/problog ----- Original Message ---- From: David Clements <digidigo@gmail.com> To: rails@lists.rubyonrails.org Sent: Monday, February 13, 2006 12:12:37 PM Subject: [Rails] caches_action does not go off the entire URL I am trying to use caches_action and the agile book says that it is keyed off the URL, however it does not seem to pick up the URL parameters. http://localhost:3000/controller/action/id?foo=bar and http://localhost:3000/controller/action/id?foo=foobar Returns the same page. Anyone looked into how to add URL parameters to the cached key? Also, where do those file get stored? Thanks Dave _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060213/7c6e8503/attachment.html
The only way I got it to cache parameters is by using fragement caching. <% cache :controller => ''search'', :action => ''results'', :id => ''1'', :param1 => ''p1'', :param2 => ''p2'' %> code........... html........... <% end %> If you use file store for fragment caching, you can define the cache location. Hope this helps, Mac> > Message: 4 > Date: Mon, 13 Feb 2006 11:12:37 -0700 > From: David Clements <digidigo@gmail.com> > Subject: [Rails] caches_action does not go off the entire URL > To: rails@lists.rubyonrails.org > Message-ID: > <ea9161c50602131012y3cef42cl65c85d1087cb2671@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > I am trying to use caches_action and the agile book says that it is keyed > off the URL, however it does not seem to pick up the URL parameters. > > http://localhost:3000/controller/action/id?foo=bar > and > http://localhost:3000/controller/action/id?foo=foobar > > Returns the same page. > > Anyone looked into how to add URL parameters to the cached key? Also, > where do those file get stored? > > Thanks > > Dave >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060213/081843fe/attachment.html
There is an action_cache plugin that extends the action_cache code to allow you to do this. There is an example of how to do this in the README. http://wiki.rubyonrails.org/rails/pages/Action+Cache+Update+Plugin _____ From: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of David Clements Sent: Monday, February 13, 2006 10:13 AM To: rails@lists.rubyonrails.org Subject: [Rails] caches_action does not go off the entire URL I am trying to use caches_action and the agile book says that it is keyed off the URL, however it does not seem to pick up the URL parameters. http://localhost:3000/controller/action/id?foo=bar and http://localhost:3000/controller/action/id?foo=foobar Returns the same page. Anyone looked into how to add URL parameters to the cached key? Also, where do those file get stored? Thanks Dave -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060213/1eb09e59/attachment-0001.html
Reasonably Related Threads
- caches_action :index for site root gets propagated to lower levels (how to stop?)
- caches_page :if not executing (but caches_action :if) does
- Re: Digest for rubyonrails-core@googlegroups.com - 4 Messages in 3 Topics
- How can I bypass caching for some users
- Caches_action/ before_filter problem .