"""语义缓存(T-P6 落地;本文件先立签名)。 规格(§6):L1 精确 + L2 字符 2/3-gram 倒排(启动自 sqlite 重建), 加权 Jaccard(3-gram 权 2)+ 共享 gram>=3 门限 + 阈值 0.92, TTL + LRU(max_entries),L2 命中 promote_frequency 次晋升 L1。 """ from __future__ import annotations from typing import Any, Dict, Optional class SemanticCache: """两级语义缓存(T-P6 实现)。""" def lookup(self, bucket: str, doc_version: int, norm_hash: str, norm_text: str, now: float) -> Optional[Dict[str, Any]]: raise NotImplementedError("T-P6") def put(self, bucket: str, doc_version: int, norm_hash: str, norm_text: str, answer: str, model: str, now: float) -> None: raise NotImplementedError("T-P6") def stats(self) -> Dict[str, Any]: raise NotImplementedError("T-P6")