From d2d5ca80907183f88a5e78aa28c085a746868d6d Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 13 十一月 2024 18:50:56 +0800 Subject: [PATCH] 扫入策略修改 --- utils/tool.py | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/utils/tool.py b/utils/tool.py index 207e003..e191df7 100644 --- a/utils/tool.py +++ b/utils/tool.py @@ -21,6 +21,22 @@ return wrapper +def singleton(cls): + """ + 鍗曚緥瑁呴グ鍣� + @param cls: + @return: + """ + instances = {} + + def get_instance(*args, **kwargs): + if cls not in instances: + instances[cls] = cls(*args, **kwargs) + return instances[cls] + + return get_instance + + def get_expire(): now = int(t.time()) end = int(t.time()) + 60 * 60 * 24 -- Gitblit v1.8.0