Page cache and query string

I’ve read about the problems of using page cache when there’s a query
string, i.e. /article/list?page=1 will cache /article/list.html, then
/article/list?page=5 will retrieve /article/list.html regardless of
query string.

I’m using a workaround, it looks almost obvious but since I haven’t
found it mentioned anywhere I’m afraid there’s some equally obvious
drawback that I’m missing. If that’s the case, could anyone familiar
with caching in Rails please point it out?

Basically I’m having the web server rewrite URLs of the form
Custom Application Development Software for Business - Salesforce.com to
Custom Application Development Software for Business - Salesforce.com. Then in config/routes.rb there
is:

map.connect(‘foo/bar/query/:query_string’,
:controller => ‘foo’,
:action => ‘bar’)

In foo_controller.rb:

class FooController < ApplicationController
caches_page :bar
before_filter :merge_query_string

def bar
  render :text => "You asked for #{params.inspect}"
end

private

def merge_query_string
  params[:query_string] or return

  params.
    update(CGIMethods.parse_query_parameters(params[:query_string])).
    delete(:query_string)
end

end

When a request comes for /foo/bar?a=b, it is cached as
/foo/bar/query/a=b, and when it comes for /foo/bar?a=x, it is cached
separately as /foo/bar/query/a=x. Apparently it’s working. Where’s
the catch?

Thanks for any insight.
Massimiliano