Files
nexus/wiki/concepts/Local-Caching.md
2026-04-23 00:02:55 +08:00

29 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "Local Caching"
type: concept
tags: []
sources: [arxiv-paper-reader]
last_updated: 2026-04-17
---
## Concept Definition
**本地缓存Local Caching** 是指将 API 调用结果或解析结果持久化到本地文件系统,使重复访问无需重新请求或重新处理,直接从本地读取即可获得毫秒级响应。
## How It Works
1. 首次请求API 调用 → 结果处理 → 写入本地缓存文件(含 hash 标识)
2. 后续请求:计算请求 hash → 命中缓存 → 直接返回本地文件内容
3. 缓存失效:由 TTL、源文件修改时间或手动清理触发
## Use Cases
- [[arXiv-Paper-Reader]]:论文解析结果本地缓存,重复阅读即时响应
- [[Semantic-Memory-Search]]:向量嵌入缓存,避免重复计算
- [[YouTube-Content-Pipeline]]:视频目录 90 天缓存,避免重复抓取
## Trade-offs
- **优点**:零成本、即时响应、保护 API 限额
- **缺点**:占用磁盘空间、需管理缓存失效策略
## Related Concepts
- [[Content Hashing]]:用于缓存键生成的哈希机制
- [[File Watcher]]:检测源文件变更触发缓存失效