Forum: Ruby on Rails caches_action does not go off the entire URL

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.
Bd6167863690cb320d65bb9204619817?d=identicon&s=25 David Clements (Guest)
on 2006-02-13 19:13
(Received via mailing list)
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
1b275ea705cc1671f13105d29684cbec?d=identicon&s=25 Scott Walter (sfwalter)
on 2006-02-13 20:39
(Received via mailing list)
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/tim....
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
3f900b38ec3b2c45427c354722fa4ce3?d=identicon&s=25 Tom Fakes (tomfakes)
on 2006-02-13 21:36
(Received via mailing list)
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+Cac...



  _____

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
A09d5b7e6f779c6c3afe0f42379c5a41?d=identicon&s=25 Edwin Rozario (edwinrozario)
on 2015-05-26 00:20
Hi David

  I have the same issue. It seems you have to use a Proc with the query
params.

Example here:
http://stackoverflow.com/questions/1988658/rails-a...

In your case you need to update params[:foo]. So a better Example is
this:
http://icelab.com.au/articles/rails-action-caching...

David Clements wrote in post #34371:
> 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
This topic is locked and can not be replied to.