MCPcopy
hub / github.com/django/django / load

Method load

django/contrib/sessions/backends/cached_db.py:34–51  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

32 return self.cache_key_prefix + await self._aget_or_create_session_key()
33
34 def load(self):
35 try:
36 data = self._cache.get(self.cache_key)
37 except Exception:
38 # Some backends (e.g. memcache) raise an exception on invalid
39 # cache keys. If this happens, reset the session. See #17810.
40 data = None
41
42 if data is None:
43 s = self._get_session_from_db()
44 if s:
45 data = self.decode(s.session_data)
46 self._cache.set(
47 self.cache_key, data, self.get_expiry_age(expiry=s.expire_date)
48 )
49 else:
50 data = {}
51 return data
52
53 async def aload(self):
54 try:

Callers

nothing calls this directly

Calls 5

_get_session_from_dbMethod · 0.95
get_expiry_ageMethod · 0.80
getMethod · 0.45
decodeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected