def __init__(self, transport, config): super(DeliverShortMessageProcessor, self).__init__(transport, config) self.transport = transport self.redis = transport.redis self.config = self.CONFIG_CLASS(config, static=True) self.session_manager = SessionManager( self.redis, max_session_length=self.config.max_session_length)
def get_session_manager(self, config): return SessionManager( self.get_redis(config).sub_manager('session'), max_session_length=config.max_session_length)
def _setup_redis(self, redis): self.redis = redis self.session_manager = SessionManager(self.redis, self.expire_routing_timeout)
def setUp(self): self.persistence_helper = self.add_helper(PersistenceHelper()) self.manager = yield self.persistence_helper.get_redis_manager() yield self.manager._purge_all() # Just in case self.sm = SessionManager(self.manager) self.add_cleanup(self.sm.stop)
def session_manager(self, config): key_prefix = ':'.join((self.worker_name, config.router.key)) redis = self.redis.sub_manager(key_prefix) return SessionManager(redis, max_session_length=config.session_expiry)