feat(cache): set default skip_empty to False

This commit is contained in:
InfinityPacer
2025-01-18 02:44:56 +08:00
parent d9508533e1
commit ad0241b7f1
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -249,7 +249,7 @@ def get_cache_backend(maxsize: int = 1000, ttl: int = 1800) -> CacheBackend:
def cached(region: str = DEFAULT_CACHE_REGION, maxsize: int = 1000, ttl: int = 1800, def cached(region: str = DEFAULT_CACHE_REGION, maxsize: int = 1000, ttl: int = 1800,
skip_none: bool = True, skip_empty: bool = True): skip_none: bool = True, skip_empty: bool = False):
""" """
自定义缓存装饰器,支持为每个 key 动态传递 maxsize 和 ttl 自定义缓存装饰器,支持为每个 key 动态传递 maxsize 和 ttl
@@ -257,7 +257,7 @@ def cached(region: str = DEFAULT_CACHE_REGION, maxsize: int = 1000, ttl: int = 1
:param maxsize: 缓存的最大条目数,默认值为 1000 :param maxsize: 缓存的最大条目数,默认值为 1000
:param ttl: 缓存的存活时间,单位秒,默认值为 1800 :param ttl: 缓存的存活时间,单位秒,默认值为 1800
:param skip_none: 跳过 None 缓存,默认为 True :param skip_none: 跳过 None 缓存,默认为 True
:param skip_empty: 跳过空值缓存(如 [], {}, "", set()),默认为 True :param skip_empty: 跳过空值缓存(如 [], {}, "", set()),默认为 False
:return: 装饰器函数 :return: 装饰器函数
""" """
+1 -1
View File
@@ -38,7 +38,7 @@ class PluginHelper(metaclass=Singleton):
if self.install_report(): if self.install_report():
self.systemconfig.set(SystemConfigKey.PluginInstallReport, "1") self.systemconfig.set(SystemConfigKey.PluginInstallReport, "1")
@cached(maxsize=1000, ttl=1800, skip_empty=False) @cached(maxsize=1000, ttl=1800)
def get_plugins(self, repo_url: str, package_version: str = None) -> Optional[Dict[str, dict]]: def get_plugins(self, repo_url: str, package_version: str = None) -> Optional[Dict[str, dict]]:
""" """
获取Github所有最新插件列表 获取Github所有最新插件列表