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

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
Time-limited caching for Rails :: scottstuff.net.
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 C. [email protected]
To: [email protected]
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

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: [email protected]
[mailto:[email protected]] On Behalf Of David C.
Sent: Monday, February 13, 2006 10:13 AM
To: [email protected]
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

Hi David

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

Example here:

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

David C. 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