Browse Source

推送开关接口删除推送redis缓存

locky 11 months ago
parent
commit
79bb5735d7
2 changed files with 5 additions and 3 deletions
  1. 1 1
      Controller/DetectControllerV2.py
  2. 4 2
      Object/RedisObject.py

+ 1 - 1
Controller/DetectControllerV2.py

@@ -306,7 +306,7 @@ class DetectControllerViewV2(View):
 
     def do_delete_redis(self, uid, detect_interval=0):
         keyPattern = '{uid}*'.format(uid=uid)
-        redisObj = RedisObject()
+        redisObj = RedisObject(host=PUSH_REDIS_ADDRESS)
         keys = redisObj.get_keys(keyPattern)
         if keys:
             for key in keys:

+ 4 - 2
Object/RedisObject.py

@@ -1,13 +1,15 @@
 import redis
 from Ansjer.config import SERVER_HOST
+
+
 # 本地调试把注释打开
 # SERVER_HOST = '127.0.0.1'
 
 
 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)
 
     def set_data(self, key, val, expire=0):