Hi all,

When running a small, low traffic site on slow cloud servers (eg 
DigitalOcean), it'd be useful to be able to cache pages, not because the 
site might be taken down from too many request, but to improve 
responsiveness. A non-trivial page that might take a few hundredth of a 
second to server on a local desktop might take over a second on a slow 
server, but that times goes back down to less than a hundredth of a second 
when cached. Ideally, I'd want to pre-generate most of the popular pages on 
a site but not send a large max-age, so that if the content does change, 
the new pages can be regenerated and stale content would not be served.

At the moment, the Django cache framework ties up how long it thinks the 
cached values are valid with what it sends the client with max-age (eg if 
you set CACHE_MIDDLEWARE_SECONDS to 600, it'll send a max-age of 600, and 
set the validity of the server-side content valid for 600 seconds). It 
ignores the CACHES[cache]['TIMEOUT'] and goes by CACHE_MIDDLEWARE_SECONDS, 
or its per-view parameter equivalent. I think it would be useful to be able 
to separate the two, keeping server-stored caches valid for a long time (or 
indefinitely until they are forcefully invalidated), while sending a small 
max-age (or none at all). A CACHE_MIDDLEWARE_CLIENT_SECONDS setting would 
seem appropriate, or maybe a setting to tell it to respect 
CACHES[name]['TIMEOUT'] for server-side validity checking.

I can prepare a patch if the idea seems worthwhile to others.

ale


-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/1fdc7472-18c8-495b-b590-0136eebd0255%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to