def __init__(self, ruleset_name, database = {'host': 'localhost', 'port': 6379, 'password':None}, state_cache_size = 1024): self._ruleset_name = ruleset_name self._handle = rules.create_client(state_cache_size, ruleset_name) if isinstance(database, basestring): rules.bind_ruleset(None, 0, database, self._handle) else: rules.bind_ruleset(database['password'], database['port'], database['host'], self._handle)
def __init__(self, ruleset_name, database={ 'host': 'localhost', 'port': 6379, 'password': None }, state_cache_size=1024): self._ruleset_name = ruleset_name self._handle = rules.create_client(state_cache_size, ruleset_name) if isinstance(database, basestring): rules.bind_ruleset(None, 0, database, self._handle) else: rules.bind_ruleset(database['password'], database['port'], database['host'], self._handle)
def __init__(self, ruleset_name, database = None, state_cache_size = 1024): if not database: database = {'host': 'localhost', 'port': 6379, 'password':None, 'db': 0} self._ruleset_name = ruleset_name self._handle = rules.create_client(state_cache_size, ruleset_name) if isinstance(database, str): rules.bind_ruleset(0, 0, database, None, self._handle) else: if not 'password' in database: database['password'] = None if not 'db' in database: database['db'] = 0 rules.bind_ruleset(database['port'], database['db'], database['host'], database['password'], self._handle)
def __init__(self, ruleset_name, database = None, state_cache_size = 1024): if not database: database = {'host': os.environ['REDIS_HOST'], 'port': os.environ['REDIS_NOAUTH_PORT'], 'password': None, 'db': 0} self._ruleset_name = ruleset_name self._handle = rules.create_client(state_cache_size, ruleset_name) if isinstance(database, str): rules.bind_ruleset(0, 0, database, None, self._handle) else: if not 'password' in database: database['password'] = None if not 'db' in database: database['db'] = 0 rules.bind_ruleset(database['port'], database['db'], database['host'], database['password'], self._handle)
def __init__(self, ruleset_name, database=None, state_cache_size=1024): if not database: database = { 'host': os.environ['REDIS_HOST'], 'port': os.environ['REDIS_NOAUTH_PORT'], 'password': None, 'db': 0 } self._ruleset_name = ruleset_name self._handle = rules.create_client(state_cache_size, ruleset_name) if isinstance(database, str): rules.bind_ruleset(0, 0, database, None, self._handle) else: if not 'password' in database: database['password'] = None if not 'db' in database: database['db'] = 0 rules.bind_ruleset(database['port'], database['db'], database['host'], database['password'], self._handle)