|
@@ -1,13 +1,15 @@
|
|
import redis
|
|
import redis
|
|
from Ansjer.config import SERVER_HOST
|
|
from Ansjer.config import SERVER_HOST
|
|
|
|
+
|
|
|
|
+
|
|
# 本地调试把注释打开
|
|
# 本地调试把注释打开
|
|
# SERVER_HOST = '127.0.0.1'
|
|
# SERVER_HOST = '127.0.0.1'
|
|
|
|
|
|
|
|
|
|
class RedisObject:
|
|
class RedisObject:
|
|
|
|
|
|
- def __init__(self, db=0):
|
|
|
|
- self.POOL = redis.ConnectionPool(host=SERVER_HOST, port=6379, db=db)
|
|
|
|
|
|
+ def __init__(self, db=0, host=SERVER_HOST):
|
|
|
|
+ self.POOL = redis.ConnectionPool(host=host, port=6379, db=db)
|
|
self.CONN = redis.Redis(connection_pool=self.POOL)
|
|
self.CONN = redis.Redis(connection_pool=self.POOL)
|
|
|
|
|
|
def set_data(self, key, val, expire=0):
|
|
def set_data(self, key, val, expire=0):
|