---
title: "How Claude Code uses prompt caching"
url: "https://xlrocket.men/how-claude-code-uses-prompt-caching"
markdown_url: "https://xlrocket.men/how-claude-code-uses-prompt-caching.md"
format: "link"
published: "2026-10-10T12:17:37.000Z"
link_url: "https://code.claude.com/docs/en/prompt-caching"
site: "火箭君 MEN"
---

# [How Claude Code uses prompt caching](https://code.claude.com/docs/en/prompt-caching)

译：Claude Code Subagent 默认 5 分钟缓存，会啃额度

- Subagent / workflow 属「everything else」桶，订阅内也默认 5m TTL，重复前缀常冷启动
- 设 `subagentPromptCacheTtl: "1h"` 或 `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL=1h`（≥v2.1.242）
- 看 cache\_creation vs cache\_read：创建偏高再开 1h；一次性子代理别白付写缓存溢价
