#12982: Pony: cache.get_or_set() ----------------------------+----------------------------------------------- Reporter: Alex | Owner: nobody Status: new | Milestone: 1.3 Component: Core framework | Version: SVN Keywords: cache | Stage: Unreviewed Has_patch: 0 | ----------------------------+----------------------------------------------- Add a {{{ cache.get_or_set() }}} method to Django's cache abstraction, this takes the same arguments as {{{ get() }}} except the 2nd argument is a callable, simple implementation looks like:
{{{ def get_or_set(self, key, func, **kwargs): val = self.get(key) if val is None: val = func() self.set(key, val) return val }}} -- Ticket URL: <http://code.djangoproject.com/ticket/12982> 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 django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.