#12982: Add get_or_set method to cache API -------------------------------------+------------------------------------- Reporter: Alex | Owner: snow0x2d0 Type: New feature | Status: new Component: Core (Cache system) | Version: master Severity: Normal | Resolution: Keywords: cache | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by mumino):
* cc: mumino (added) Comment: I made a patch based on snow0x2d0's patch. my proposal is a little different signature for get_or_set: {{{ cached_data, is_set = cache.get_or_set(key, default, timeout=None, version=None) }}} maybe we shouldn't force second parameter be callable. I prefer {{{ cache.get_or_set(score, 0} }}} to {{{ cache.get_or_set(score, lambda: 0} }}} -- Ticket URL: <https://code.djangoproject.com/ticket/12982#comment:15> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.