On 10/30/06, Rick Olson <technoweenie@gmail.com>
wrote:>
> Currently, page caching caches any request w/ a status code < 400. Is
> there a reason for this?
>
> #6514 changes it to only cache 200 requests, and includes some actual
> page caching tests. Thoughts?
>
> http://dev.rubyonrails.org/ticket/6514
I did something fairly similar on my one site that uses page caching
extensively:
after_filter :cache_all_pages
def cache_all_pages
cache_page if request.get? &&
response.headers[''Status''] == "200
OK" && request.env[''REQUEST_URI''] !~ /\?/
end
Your checking for a 200 status is better (since it uses to_i), but you
should only cache get requests (not sure how your code handles head
requests), and requests with URL parameters shouldn''t be cached.
Jeremy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---