On Mon, Dec 21, 2009 at 12:52:24PM -0200, Victor Loureiro Lima wrote:

> Well, template caching invalidates view cache right? Plus, my understanding
> of the template cache is that
> it will hit my view, do all the DB stuff, but skip the template processing
> which takes a while to finish, is my understanding right?
>

re "all the DB stuff": Depends what your view code is doing, but bear in mind 
QuerySets are lazy,  so it may allow skipping the heavy bit where a QuerySet 
is actually forced to produce any results and thus be more of a win than you
might think.

> In your opinion, what would be the correct approach? Cache the views objects
> instead of the view it self, and cache
> some of the templating? That would avoid the vary_on_cookie and would had a
> more granular effect on the system.
> 

I'm not sure, remember I haven't really used such fine-grained caching, but
I think the _template_ level caching should still operate for logged-in
users when CACHE_MIDDLEWARE_ANONYMOUS_ONLY is true, since the
CACHE_MIDDLEWARE_ANONYMOUS_ONLY settings is controlling, well, the
middleware (request-response wrapping) caching.

So you could use fine-grained template fragment caching for logged-in users, 
and 
CACHE_MIDDLEWARE_ANONYMOUS_ONLY would still coarse-grain cache the 
non-logged-in ones
(regardless of existing session cookie as it's using 
request.user.is_authenticated() )

--

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