mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-25 08:33:53 +08:00
update:feat: 为声纹识别添加缓存机制
This commit is contained in:
@@ -18,6 +18,7 @@ class CacheType(Enum):
|
||||
IP_INFO = "ip_info"
|
||||
CONFIG = "config"
|
||||
DEVICE_PROMPT = "device_prompt"
|
||||
VOICEPRINT_HEALTH = "voiceprint_health" # 声纹识别健康检查
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -54,5 +55,8 @@ class CacheConfig:
|
||||
CacheType.DEVICE_PROMPT: cls(
|
||||
strategy=CacheStrategy.TTL, ttl=None, max_size=1000 # 手动失效
|
||||
),
|
||||
CacheType.VOICEPRINT_HEALTH: cls(
|
||||
strategy=CacheStrategy.TTL, ttl=600, max_size=100 # 10分钟过期
|
||||
),
|
||||
}
|
||||
return configs.get(cache_type, cls())
|
||||
|
||||
Reference in New Issue
Block a user