init redis client :param host: redis host :param port: redis port :param password: redis password :param connection_string: redis connection_string
(self, host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWORD, db=REDIS_DB,
connection_string=REDIS_CONNECTION_STRING, **kwargs)
| 19 | """ |
| 20 | |
| 21 | def __init__(self, host=REDIS_HOST, port=REDIS_PORT, password=REDIS_PASSWORD, db=REDIS_DB, |
| 22 | connection_string=REDIS_CONNECTION_STRING, **kwargs): |
| 23 | """ |
| 24 | init redis client |
| 25 | :param host: redis host |
| 26 | :param port: redis port |
| 27 | :param password: redis password |
| 28 | :param connection_string: redis connection_string |
| 29 | """ |
| 30 | # if set connection_string, just use it |
| 31 | if connection_string: |
| 32 | self.db = redis.StrictRedis.from_url(connection_string, decode_responses=True, **kwargs) |
| 33 | else: |
| 34 | self.db = redis.StrictRedis( |
| 35 | host=host, port=port, password=password, db=db, decode_responses=True, **kwargs) |
| 36 | |
| 37 | def add(self, proxy: Proxy, score=PROXY_SCORE_INIT, redis_key=REDIS_KEY) -> int: |
| 38 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected