|
@@ -1,6 +1,5 @@
|
|
import redis
|
|
import redis
|
|
-from redis.connection import SSLConnection
|
|
|
|
-from AnsjerPush.config import REDIS_ADDRESS, CONFIG_INFO, CONFIG_EUR
|
|
|
|
|
|
+from AnsjerPush.config import REDIS_ADDRESS
|
|
|
|
|
|
# 本地调试把注释打开
|
|
# 本地调试把注释打开
|
|
# REDIS_ADDRESS = '127.0.0.1'
|
|
# REDIS_ADDRESS = '127.0.0.1'
|
|
@@ -9,17 +8,8 @@ from AnsjerPush.config import REDIS_ADDRESS, CONFIG_INFO, CONFIG_EUR
|
|
class RedisObject:
|
|
class RedisObject:
|
|
|
|
|
|
def __init__(self, db=0):
|
|
def __init__(self, db=0):
|
|
- if CONFIG_INFO != CONFIG_EUR:
|
|
|
|
- pool = redis.ConnectionPool(host=REDIS_ADDRESS, port=6379, db=db)
|
|
|
|
- self.CONN = redis.Redis(connection_pool=pool)
|
|
|
|
- else:
|
|
|
|
- pool = redis.ConnectionPool(connection_class=SSLConnection, host=REDIS_ADDRESS, port=6379, db=db)
|
|
|
|
- self.CONN = redis.StrictRedis(
|
|
|
|
- connection_pool=pool,
|
|
|
|
- host=REDIS_ADDRESS,
|
|
|
|
- ssl=True,
|
|
|
|
- ssl_cert_reqs=None,
|
|
|
|
- )
|
|
|
|
|
|
+ pool = redis.ConnectionPool(host=REDIS_ADDRESS, port=6379, db=db)
|
|
|
|
+ self.CONN = redis.Redis(connection_pool=pool)
|
|
|
|
|
|
def set_data(self, key, val, expire=0):
|
|
def set_data(self, key, val, expire=0):
|
|
try:
|
|
try:
|