Ticket #10646: memcache_incr_decr_require_key.patch

File memcache_incr_decr_require_key.patch, 667 bytes (added by dauerbaustelle, 16 years ago)
  • django/core/cache/backends/memcached.py

     
    4545    def close(self, **kwargs):
    4646        self._cache.disconnect_all()
    4747
     48    def require_key(self, key):
     49        if key not in self:
     50            raise ValueError("Key '%s' not found!")
     51
    4852    def incr(self, key, delta=1):
     53        self.require_key(key)
    4954        return self._cache.incr(key, delta)
    5055
    5156    def decr(self, key, delta=1):
     57        self.require_key(key)
    5258        return self._cache.decr(key, delta)
Back to Top