# How to clear the Varnish cache

[Varnish](what-is.md) serves a full-page cache of rendered HTML. Clear it when visitors could be
seeing stale pages - for example right after a deploy or a content change that the application did not
purge on its own.

## Clear the cache with the TurboStack CLI

Connect over [SSH](../../platform/hosts/ssh.md) and run:

```bash
tscli varnish clear
```

This empties the **entire** full-page cache for the host. The next requests are served from your
application until the cache refills, so expect a short performance dip.

> [!NOTE]
> `tscli varnish clear` empties the cache; `tscli varnish reload` is different - it validates and
> reloads the Varnish Configuration Language (VCL) after you change a rule (see
> [Exclude pages from the cache](exclude-pages-from-cache.md)).

## Prefer your application's own purge

A full clear is a blunt instrument. Applications that integrate with Varnish (for example Magento)
purge only the pages that changed when you update content, which is far less disruptive than emptying
everything. Use `tscli varnish clear` when you need a clean slate, or when the application cannot
purge on its own.

## After clearing

The first hits are slower while Varnish rebuilds the cache. Warm the important pages by visiting them,
or let your sitemap or a crawler do it, before judging performance.

## Related

- [Configure Varnish](configure.md)
- [Exclude pages from the Varnish cache](exclude-pages-from-cache.md)
- [What is Varnish?](what-is.md)
- [Clear the Redis cache](../redis/clear-the-cache.md)
- [Why is my site slow?](../../troubleshooting/site-slow.md)
- [TurboStack CLI](../../api/cli.md) - `tscli varnish clear` and `tscli varnish reload`
