import { Element } from 'hast'; import { BlockInfo, BlockType } from './types'; /** * 块缓存管理器 * 用于缓存已稳定块的 HAST 节点,避免重复解析 */ export declare class BlockCache { /** 按位置索引的缓存 */ private cache; /** 缓存命中次数 */ private hits; /** 缓存未命中次数 */ private misses; /** * 生成块的 key * 仅使用 index,确保流式输入和状态变化时组件实例保持稳定 * memo 的比较函数会决定是否跳过重渲染 */ generateKey(index: number, _source: string, _stable: boolean): string; /** * 尝试从缓存获取块的 HAST */ get(index: number, source: string): Element | null; /** * 缓存块的 HAST */ set(index: number, source: string, hast: Element): void; /** * 检查是否有缓存 */ has(index: number, source: string): boolean; /** * 清除指定索引之后的所有缓存 */ invalidateFrom(index: number): void; /** * 清空所有缓存 */ clear(): void; /** * 获取缓存统计 */ getStats(): { hits: number; misses: number; }; /** * 创建带 key 的块信息 */ createBlockInfo(index: number, source: string, type: BlockType, stable: boolean, hast: Element | null): BlockInfo; } //# sourceMappingURL=block-cache.d.ts.map