def _use_cached_session(self):
""" Attempt to set the session id from a memcache entry and return success status """
if not self.cache:
return False
expiration = self.cache.get("KEY", namespace="QUEUE_NAME")
if expiration and expiration > datetime.datetime.utcnow():
self.session_id = self.cache.get("KEY", namespace="QUEUE_NAME")
if self.session_id:
return True
return False
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter