Re: trying to get a cache per request
Why not just stick it on the request object?
def myview(request):
request.mycache=MyCacheClass()
then it's available everywhere the request object is. If you are
wanting something that can be used in a template tag without
explicitly passing the request object (or your cache object) in, you
probably want thread locals and a middleware to reset after each
time. I've had to do this a couple of times, and regretted in in all
but one (a template loader - we serve many sites from one fastcgi
instance and that was the only way I could think to map templates for
different sites).
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home