def exists(self, session_key): """ Check if session exists. """ return bool( hsdb.get(TABLE_NAME, ('session_key', ), session_key, shard_seed=make_seed(session_key)))
def load(self): row = hsdb.get(TABLE_NAME, ('session_key', 'session_data', 'expire_date'), self.session_key, shard_seed=make_seed(self.session_key)) if row and datetime.now() <= datetime.strptime(row['expire_date'], '%Y-%m-%d %H:%M:%S'): return self.decode(force_unicode(row['session_data'])) else: self.create() return {}
def exists(self, session_key): """ Check if session exists. """ return bool(hsdb.get(TABLE_NAME, ('session_key', ), session_key, shard_seed=make_seed(session_key)))