12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import redis
- class DbRedis:
- __connection = None
- __douyin_connection = None
- @staticmethod
- def connect():
- if DbRedis.__connection is None:
- host = 'r-2ze28bdb7389a8a4614.redis.rds.aliyuncs.com'
- port = 6379
- password = 'Zhuaduoduo2017'
- DbRedis.__connection = redis.StrictRedis(
- host=host,
- port=port,
- password=password,
- decode_responses=True
- )
- return DbRedis.__connection
- @staticmethod
- def douyin_connect():
- if DbRedis.__douyin_connection is None:
- host = 'r-2zej6rl3534gcwmgbv.redis.rds.aliyuncs.com'
- port = 6379
- password = 'wxw6661!'
- DbRedis.__douyin_connection = redis.StrictRedis(
- host=host,
- port=port,
- password=password,
- decode_responses=True
- )
- return DbRedis.__douyin_connection
- @staticmethod
- def outer_net_connect():
- if DbRedis.__connection is None:
- host = 'r-2ze28bdb7389a8a4pd.redis.rds.aliyuncs.com'
- port = 6379
- password = 'Zhuaduoduo2017'
- DbRedis.__connection = redis.StrictRedis(
- host=host,
- port=port,
- password=password,
- decode_responses=True
- )
- return DbRedis.__connection
|