{"version":"2.1.242","anchor":"prompt-cache-lifetime-is-now-configurable","canonical_anchor":"prompt-cache-lifetime-is-now-configurable","heading":"Prompt cache lifetime is now configurable","tier":"use","area":"Performance","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.242\/e\/prompt-cache-lifetime-is-now-configurable","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.242","markdown":"### Prompt cache lifetime is now configurable\n\nYou can pin the prompt cache to five minutes or an hour, separately for subagents.\n\n**What**\n\nTwo new settings, `promptCacheTtl` and `subagentPromptCacheTtl`, pin the prompt cache to `\"5m\"` or `\"1h\"`. The first covers the main conversation (interactive, `-p` and SDK turns and the helpers that run inline with it), the second covers subagents, workflows and background requests. `CLAUDE_CODE_PROMPT_CACHE_TTL` and `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL` override the settings. No experiment gate; available to everyone on this build.\n\n**Details**\n\n- Unset means automatic: 1 hour on a Claude subscription within usage limits, 5 minutes on an API key, Bedrock, Vertex or Foundry for the main conversation; 5 minutes for subagents unless `ENABLE_PROMPT_CACHING_1H=1`.\n- Resolution order is `FORCE_PROMPT_CACHING_5M`, then the environment variable, then the setting, then the 1h environment flags.\n- Both environment names were added to the allowlist, and request telemetry gained `prompt_cache_ttl` and `prompt_cache_ttl_reason`.\n\n**Usage**\n\n`# in settings.json { \"promptCacheTtl\": \"1h\", \"subagentPromptCacheTtl\": \"5m\" } # or per run CLAUDE_CODE_PROMPT_CACHE_TTL=1h claude` **Evidence** `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`, `Prompt cache TTL for the main conversation (interactive, -p and SDK turns, plus the helpers that run inline with it)`, `Prompt cache TTL for the main conversation (interactive, -p and SDK turns, plus the helpers that run inline with it): \"5m\" or \"1h\".`\n\n- Area: Performance\n- Names: `promptCacheTtl`, `subagentPromptCacheTtl`, `CLAUDE_CODE_PROMPT_CACHE_TTL`, `CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL`\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 3\/5"}