MCPcopy
hub / github.com/django/django / incr_version

Method incr_version

django/core/cache/backends/base.py:370–384  ·  view source on GitHub ↗

Add delta to the cache version for the supplied key. Return the new version.

(self, key, delta=1, version=None)

Source from the content-addressed store, hash-verified

368 return await sync_to_async(self.clear, thread_sensitive=True)()
369
370 def incr_version(self, key, delta=1, version=None):
371 """
372 Add delta to the cache version for the supplied key. Return the new
373 version.
374 """
375 if version is None:
376 version = self.version
377
378 value = self.get(key, self._missing_key, version=version)
379 if value is self._missing_key:
380 raise ValueError("Key '%s' not found" % key)
381
382 self.set(key, value, version=version + delta)
383 self.delete(key, version=version)
384 return version + delta
385
386 async def aincr_version(self, key, delta=1, version=None):
387 """See incr_version()."""

Callers 3

decr_versionMethod · 0.95
test_incr_versionMethod · 0.80
test_incr_versionMethod · 0.80

Calls 3

getMethod · 0.95
setMethod · 0.95
deleteMethod · 0.95

Tested by 2

test_incr_versionMethod · 0.64
test_incr_versionMethod · 0.64