How to clear the Varnish cache
Varnish 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 and run:
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).
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
- Exclude pages from the Varnish cache
- What is Varnish?
- Clear the Redis cache
- Why is my site slow?
- TurboStack CLI -
tscli varnish clearandtscli varnish reload