[Django] #30765: cache_control() "max_age" overrides cache_page() "timeout"

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #30765: cache_control() "max_age" overrides cache_page() "timeout"

Django
#30765: cache_control() "max_age" overrides cache_page() "timeout"
-------------------------------------+-------------------------------------
               Reporter:  Danny      |          Owner:  nobody
  Flack                              |
                   Type:  Bug        |         Status:  new
              Component:  Core       |        Version:  2.2
  (Cache system)                     |       Keywords:  cache_control
               Severity:  Normal     |  cache_page UpdateCacheMiddleware
           Triage Stage:             |  CacheMiddleware
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 If you decorate a view with **both** `cache_control(max_age=3600)` and
 `cache_page(timeout=3600*24)`, the server side cache uses the `max_age`
 value instead of the `timeout` value.

 The comments in `UpdateCacheMiddleware.process_response()` indicate it's
 trying to set the timeout by first looking for the `max-age` header before
 reverting to the **default** cache_timeout :

 **Try to get the timeout from the "max-age" section of the "Cache-
 Control" header before reverting to using the default cache_timeout
 length.**

 However, `cache_page(timeout=3600*24)` is explicitly setting the
 `cache_timeout` so that is what should be used.

 In summary, if a user wants the client-side cache to be shorter-lived than
 the server-side cache, it is currently not possible using these two
 decorators.

--
Ticket URL: <https://code.djangoproject.com/ticket/30765>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.af00eaff3eabc6d1bdbec5ddd0bc2d30%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30765: cache_control() "max_age" overrides cache_page() "timeout"

Django
#30765: cache_control() "max_age" overrides cache_page() "timeout"
-------------------------------------+-------------------------------------
     Reporter:  Danny Flack          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:  cache_control        |             Triage Stage:  Accepted
  cache_page UpdateCacheMiddleware   |
  CacheMiddleware                    |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

 * stage:  Unreviewed => Accepted


Comment:

 OK, yes, this seems legitimate.

 Current behaviour was deliberately introduced in #5813
 (f2f6e70b08b1142055e33e75f58cfe7fbb5d868f).

 (Looking at
 [https://code.djangoproject.com/query?status=!closed&component=Core+(Cache+system)
 tickets for Core+(Cache+system)] there are a few on similar, though not
 exactly, topics.)

--
Ticket URL: <https://code.djangoproject.com/ticket/30765#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.6cdbfc4ebc559a960282a161960f52a2%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30765: cache_control() "max_age" overrides cache_page() "timeout"

Django
In reply to this post by Django
#30765: cache_control() "max_age" overrides cache_page() "timeout"
-------------------------------------+-------------------------------------
     Reporter:  Danny Flack          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:  cache_control        |             Triage Stage:  Accepted
  cache_page UpdateCacheMiddleware   |
  CacheMiddleware                    |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Danny Flack):

 I have an idea of how to solve this but I assume the core developers have
 a better understanding of why it was done this way in the first place, and
 what else it'll affect.  Is it worth me submitting a patch? Please let me
 know how I can help.

--
Ticket URL: <https://code.djangoproject.com/ticket/30765#comment:2>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.c00c24633eed5b45e0a3a5d59f3e6add%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30765: cache_control() "max_age" overrides cache_page() "timeout"

Django
In reply to this post by Django
#30765: cache_control() "max_age" overrides cache_page() "timeout"
-------------------------------------+-------------------------------------
     Reporter:  Danny Flack          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:  cache_control        |             Triage Stage:  Accepted
  cache_page UpdateCacheMiddleware   |
  CacheMiddleware                    |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

 Hi Danny.

 Perhaps a post to the DevelopersMailingList, explaining as clearly as
 possible what's going on, and your idea, would be the best way to go.
 That way, you're likely to get the feedback you need.

 Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/30765#comment:3>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.2accf649700f6bda413a511d07840abe%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30765: cache_control() "max_age" overrides cache_page() "timeout"

Django
In reply to this post by Django
#30765: cache_control() "max_age" overrides cache_page() "timeout"
-------------------------------------+-------------------------------------
     Reporter:  Danny Flack          |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:  cache_control        |             Triage Stage:  Accepted
  cache_page UpdateCacheMiddleware   |
  CacheMiddleware                    |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Danny Flack):

 Thanks.  I posted a new topic on that list.
 https://groups.google.com/forum/#!topic/django-developers/BwTZFMpqd6U

--
Ticket URL: <https://code.djangoproject.com/ticket/30765#comment:4>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.89e6f55a4354dd292d3ae8ee1c54482e%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30765: cache_control() "max_age" overrides cache_page() "timeout"

Django
In reply to this post by Django
#30765: cache_control() "max_age" overrides cache_page() "timeout"
-------------------------------------+-------------------------------------
     Reporter:  Danny Flack          |                    Owner:  Flavio
                                     |  Curella
         Type:  Bug                  |                   Status:  assigned
    Component:  Core (Cache system)  |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:  cache_control        |             Triage Stage:  Accepted
  cache_page UpdateCacheMiddleware   |
  CacheMiddleware                    |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Flavio Curella):

 * owner:  nobody => Flavio Curella
 * status:  new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/30765#comment:5>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.3a83340669a0603325741cbe66eb627f%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30765: cache_control() "max_age" overrides cache_page() "timeout"

Django
In reply to this post by Django
#30765: cache_control() "max_age" overrides cache_page() "timeout"
-------------------------------------+-------------------------------------
     Reporter:  Danny Flack          |                    Owner:  Flavio
                                     |  Curella
         Type:  Bug                  |                   Status:  assigned
    Component:  Core (Cache system)  |                  Version:  2.2
     Severity:  Normal               |               Resolution:
     Keywords:  cache_control        |             Triage Stage:  Accepted
  cache_page UpdateCacheMiddleware   |
  CacheMiddleware                    |
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Flavio Curella):

 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/11823 PR on github]

--
Ticket URL: <https://code.djangoproject.com/ticket/30765#comment:6>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.44ecb8262c809b69792e96dbedf69dff%40djangoproject.com.