#29867: Allow cache.get_or_set() to cache a None result
-------------------------------------+------------------------------------
     Reporter:  Phill Tornroth       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Cache system)  |                  Version:  2.1
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+------------------------------------

Comment (by Phill Tornroth):

 Okay, I put up a pull request here:
 https://github.com/django/django/pull/10558

 This would be a breaking change (though I'd imagine dependent code would
 be rare, and it's much more likely this would improve existing code that
 isn't aware it's not benefiting from caching in these cases). Anyone who
 was depending on re-calling a callable default that returns None would
 need to change their expectation. I'm struggling to imagine what those
 cases look like, but in those cases I image they'd be best served by not
 using `get_or_set` and instead inspecting the results of `has_key` or
 `get` directly and then do something special when `None` is the cached
 value.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29867#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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.5bc0bb43e2aa3831b3e4eea2da2706fc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to