Radiant currently caches only the page urls, without the params after
the ?
Am I the only one who thinks this is bad?
For example my products page listing works by
/products?offset=1200&limit=10
and I must turn off caching to make this work. Why not just let the
cache
work on the full uri? People do flip on a catalog back and forth, so I
did
benefit from changing this. If I had truly dynamic content, I'd turn off
the caching.
This in an extension did the trick:
class SiteController < ApplicationController
def show_page
response.headers.delete('Cache-Control')
uri = request.request_uri.to_s[1..-1]
url = params[:url].to_s
if live? and (@cache.response_cached?(uri))
@cache.update_response(uri, response)
@performed_render = true
else
show_uncached_page(url, uri)
end
end
private
def show_uncached_page(url, uri)
@page = find_page(url)
unless @page.nil?
@page.request=request
@page.process(request, response)
@cache.cache_response(uri, response) if live? and @page.cache? #and
not request.post?
@performed_render = true
else
render :template => 'site/not_found', :status => 404
end
rescue Page::MissingRootPageError
redirect_to welcome_url
end
end
It also seems to be a good idea not to put post request's response into
a cache.
A post supposed to change data, and the outcome of that should not be
cached - I should not say OK if you just signed up as root...
What do you think what will this change break?
Laszlo
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant