From 4d321ae069fce2c0f6f7884bec8fa6c4ec534d1a Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期四, 03 八月 2023 18:25:33 +0800
Subject: [PATCH] redis连接池归还

---
 code_attribute/code_data_util.py |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/code_attribute/code_data_util.py b/code_attribute/code_data_util.py
index a67a03e..931f0fd 100644
--- a/code_attribute/code_data_util.py
+++ b/code_attribute/code_data_util.py
@@ -31,15 +31,13 @@
 class ZYLTGBUtil:
     @classmethod
     def save(cls, code, val, unit):
-        redis = _redisManager.getRedis()
-        RedisUtils.setex(redis,"zyltgb-{}".format(code), tool.get_expire(),
-                    round(float(val) * 100000000) if int(unit) == 0 else round(
-                        float(val) * 10000))
+        RedisUtils.setex(_redisManager.getRedis(), "zyltgb-{}".format(code), tool.get_expire(),
+                         round(float(val) * 100000000) if int(unit) == 0 else round(
+                             float(val) * 10000))
 
     @classmethod
     def get(cls, code):
-        redis = _redisManager.getRedis()
-        val = RedisUtils.get(redis, "zyltgb-{}".format(code))
+        val = RedisUtils.get(_redisManager.getRedis(), "zyltgb-{}".format(code))
         if val is not None:
             return int(val)
         return None
@@ -67,7 +65,4 @@
 
 
 if __name__ == "__main__":
-    redis = _redisManager.getRedis()
-    keys = RedisUtils.keys(redis, "zyltgb-*")
-    for key in keys:
-        RedisUtils.delete(redis, key)
+    pass

--
Gitblit v1.8.0