fix cache

This commit is contained in:
jxxghp
2025-08-20 21:11:10 +08:00
parent 1b2938cbc8
commit f07496a4a0
4 changed files with 40 additions and 32 deletions
+3 -2
View File
@@ -110,8 +110,9 @@ class RecommendChain(ChainBase, metaclass=Singleton):
if not cache_path.suffix:
cache_path = cache_path.with_suffix(".jpg")
# 获取缓存后端
cache_backend = get_file_cache_backend(base=settings.CACHE_PATH)
# 获取缓存后端,并设置缓存时间为全局配置的缓存天数
cache_backend = get_file_cache_backend(base=settings.CACHE_PATH,
ttl=settings.GLOBAL_IMAGE_CACHE_DAYS * 24 * 3600)
# 本地存在缓存图片,则直接跳过
if cache_backend.get(cache_path.as_posix(), region="images"):