# ENABLE_PROMPT_CACHING_1H

> Set to 1, it keeps the prompt cache for an hour.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** ENABLE_PROMPT_CACHING_1H_BEDROCK

## Think of it like

It is like you pay a bit more to keep your seat for an hour.

## Definition

ENABLE_PROMPT_CACHING_1H set to 1 asks for a saved prompt to last one hour, not the usual five minutes. It is for API key and cloud users. Subscription users get the hour on the main chat by default. Writing to the one-hour cache costs more, so it pays off only if you come back within the hour.

## Example

Lucy reads code for 20 minutes between prompts. With the five-minute cache, each prompt paid for a fresh start. With the hour, it does not.

## Example code

```bash
export ENABLE_PROMPT_CACHING_1H=1
claude
```

Keep the cache warm through long breaks.

## Why it matters

Long gaps between prompts are normal in real work. A longer cache can save a lot there.

## Common mistake

Turning it on for quick back-and-forth work. You then pay the higher write price for nothing.

## Three principles

- **One hour.** Not five minutes.
- **Costs more to write.** Pays off on long gaps.
- **TTL variables win.** Over this one.

## Related terms

- [CLAUDE_CODE_PROMPT_CACHE_TTL](https://learn.benibix.com/term/ai/claude-code-prompt-cache-ttl-variable)
- [FORCE_PROMPT_CACHING_5M](https://learn.benibix.com/term/ai/force-prompt-caching-5m-variable)
- [Prompt Caching](https://learn.benibix.com/term/ai/prompt-caching)

## Told apart from

- [ENABLE_PROMPT_CACHING_1H vs CLAUDE_CODE_PROMPT_CACHE_TTL](https://learn.benibix.com/compare/enable-prompt-caching-1h-variable-vs-claude-code-prompt-cache-ttl-variable): People think ENABLE_PROMPT_CACHING_1H is the way to set how long the cache lasts. It is one switch for everything. CLAUDE_CODE_PROMPT_CACHE_TTL sets the main chat alone, and its SUBAGENT twin sets the helpers. Both win over the switch. So set the switch for a quick change, and the two TTL variables when the main chat and helpers need different times.

![The 5-minute force wins, then the TTL variables, then the 1-hour switch, then the default.](https://learn.benibix.com/diagrams/env-cache-ttl.svg)

---

Source: https://learn.benibix.com/term/ai/enable-prompt-caching-1h-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
