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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to