MCPcopy
hub / github.com/django/django / has_key

Method has_key

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

Return True if the key is in the cache and has not expired.

(self, key, version=None)

Source from the content-addressed store, hash-verified

255 return val
256
257 def has_key(self, key, version=None):
258 """
259 Return True if the key is in the cache and has not expired.
260 """
261 return (
262 self.get(key, self._missing_key, version=version) is not self._missing_key
263 )
264
265 async def ahas_key(self, key, version=None):
266 if self.has_key.__func__ is not BaseCache.has_key:

Callers 13

__contains__Method · 0.95
test_has_keyMethod · 0.45
test_expirationMethod · 0.45
test_prefixMethod · 0.45
test_has_keyMethod · 0.45
test_expirationMethod · 0.45
test_touchMethod · 0.45
_perform_cull_testMethod · 0.45

Calls 1

getMethod · 0.95

Tested by 12

test_has_keyMethod · 0.36
test_expirationMethod · 0.36
test_prefixMethod · 0.36
test_has_keyMethod · 0.36
test_expirationMethod · 0.36
test_touchMethod · 0.36
_perform_cull_testMethod · 0.36
test_test_cookieMethod · 0.36