#13283: CACHE_MIDDLEWARE_ANONYMOUS_ONLY kills anonymous caching efficiency
-----------------------------------+----------------------------------------
          Reporter:  carljm        |         Owner:  nobody                     
 
            Status:  new           |     Milestone:                             
 
         Component:  Cache system  |       Version:  SVN                        
 
        Resolution:                |      Keywords:  session accessed vary 
cookie
             Stage:  Accepted      |     Has_patch:  1                          
 
        Needs_docs:  0             |   Needs_tests:  0                          
 
Needs_better_patch:  1             |  
-----------------------------------+----------------------------------------
Comment (by carljm):

 Replying to [comment:12 natrius]:
 > I've written a patch that only avoids caching the response when it has
 the "Vary: Cookie" header already set.

 Very cool - that's an ingenious solution, taking advantage of the fact
 that for any authenticated request where request.user was accessed, the
 Vary: Cookie header will already have been set; so if it hasn't been set,
 we can go ahead and cache the response. (It's possible for a request from
 an authenticated user to be cached under this patch, but only if
 request.user was never accessed; which means for caching purposes the
 request may as well have been unauthenticated; the response is not user-
 variable.)

 I'd like to see a test case added covering the scenario in question:
 demonstrating that the cache middleware no longer adds Vary: Cookie to an
 unauthenticated request with CACHE_MIDDLEWARE_ANONYMOUS_ONLY set to True.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13283#comment:13>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to