# Cache Invalidation — Redis Fundamentals: Caching, Data Structures and Persistence

Source: https://www.skillbyai.com/en/redis/redis-cache-invalidation

> Keep cached data fresh by combining TTL expiry with explicit key deletion after writes.

## Two strategies

Let a TTL expire it passively, or **actively delete** the key the moment the underlying data changes — the second is fresher but needs discipline everywhere data is written.

## Delete on write

After updating the source of truth, remove the stale cache entry — the next read will repopulate it.

```bash
# after UPDATE products SET price = 799 WHERE id = 501
DEL product:501
```
