添加colg金价工具

This commit is contained in:
2026-01-20 15:21:08 +08:00
parent b22f37f3e2
commit 9f0a12428e
7 changed files with 166 additions and 3 deletions
+4 -1
View File
@@ -2,7 +2,8 @@ import json
from api.core.Gzip import gzip_zip, gzip_unzip
from config.main import config
def get_redis_info(redis, key, fun,without_gzip=False):
def get_redis_info(redis, key, fun, expire = 0, without_gzip=False):
info = None
if redis and not config.DEBUG_MODE:
try:
@@ -19,4 +20,6 @@ def get_redis_info(redis, key, fun,without_gzip=False):
redis.set(key, json.dumps(info))
else:
redis.set(key, gzip_zip(json.dumps(info)))
if expire > 0:
redis.expire(key, expire)
return info