# PCACHE.FLUSH

> Remove every entry from a prompt cache namespace but keep the namespace.

URL: https://docs.hotkv.com/commands/pcache-flush/

```
PCACHE.FLUSH namespace
```

- Group: Prompt cache
- Complexity: O(N) where N is the number of entries
- HotKV Cloud: Performance and Scale plans
- On-Premise: requires the prompt-cache license feature

The prompt cache is an exact-match cache for LLM prompt and response pairs, organised in named namespaces. `PCACHE.FLUSH` empties a namespace. The namespace keeps its
settings, so you can store new entries straight away. To remove the
namespace itself, use [PCACHE.DROP](https://docs.hotkv.com/commands/pcache-drop/index.md).

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Integer: the number of entries removed (`0` for an unknown namespace) | Same |

Errors:

- `ERR wrong number of arguments for 'pcache.flush' command` if the argument count is wrong.
- `NOLICENSE prompt-cache requires a HotKV license. Contact sales@hotkv.com` if your license does not include the `prompt-cache` feature.

## Examples

```
127.0.0.1:6379> PCACHE.FLUSH llm_prompts
(integer) 42
127.0.0.1:6379> PCACHE.FLUSH llm_prompts
(integer) 0
```

## Compatibility

HotKV-only command. Redis and Valkey have no equivalent.

## See also

[PCACHE.CREATE](https://docs.hotkv.com/commands/pcache-create/index.md), [PCACHE.SET](https://docs.hotkv.com/commands/pcache-set/index.md), [PCACHE.GET](https://docs.hotkv.com/commands/pcache-get/index.md), [PCACHE.GETEX](https://docs.hotkv.com/commands/pcache-getex/index.md), [PCACHE.DEL](https://docs.hotkv.com/commands/pcache-del/index.md), [PCACHE.STATS](https://docs.hotkv.com/commands/pcache-stats/index.md), [PCACHE.DROP](https://docs.hotkv.com/commands/pcache-drop/index.md), [PCACHE.LIST](https://docs.hotkv.com/commands/pcache-list/index.md), [PCACHE.CONFIG](https://docs.hotkv.com/commands/pcache-config/index.md), [AI features guide](https://docs.hotkv.com/ai-features/index.md)