feat(cache): remove maxsize from recommend_cache

This commit is contained in:
InfinityPacer
2025-01-19 01:24:56 +08:00
parent a5c5f7c718
commit 9f22ce5cc0
2 changed files with 22 additions and 14 deletions

View File

@@ -70,7 +70,15 @@ class CacheBackend(ABC):
class CacheToolsBackend(CacheBackend):
"""
基于 `cachetools.TTLCache` 实现的缓存后端,支持动态 TTL 和 Maxsize
基于 `cachetools.TTLCache` 实现的缓存后端
特性:
- 支持动态设置缓存的 TTLTime To Live存活时间和最大条目数Maxsize
- 缓存实例按区域region划分不同 region 拥有独立的缓存实例
- 同一 region 共享相同的 TTL 和 Maxsize设置时只能作用于整个 region
限制:
- 不支持按 `key` 独立隔离 TTL 和 Maxsize仅支持作用于 region 级别
"""
def __init__(self, maxsize: int = 1000, ttl: int = 1800):