Skip to content

Cache Invalidation

smoxy caches content at the edge to reduce load on your origin server. When content changes, you need to invalidate the cached version so visitors see the update. smoxy provides several methods to do this — from clearing a single URL to flushing entire tag groups.

All invalidation requests use the HTTP BAN method and require the cache token configured in your site's Basic Configuration.

INFO

Cloudflare users: Cloudflare may block BAN/PURGE requests. See Cloudflare Setup for the recommended workaround.


Methods

Flush URL

Clears the cache for a specific URL.

bash
curl -X BAN -H "secret: <token>" -H "url: /" https://www.example.com/

You can also pass the URL as the request target:

bash
curl -X BAN -H "secret: <token>" https://www.example.com/products/my-product

Flush Tags

Clears all cached content tagged with one or more cache tags. Tags are set on your origin's responses using the x-cache-tags header (see Advanced Caching for tag configuration).

Flush a single tag:

bash
curl -X BAN -H "secret: <token>" -H "tags: smartphones" https://www.example.com/

Flush multiple tags at once (comma-separated):

bash
curl -X BAN -H "secret: <token>" -H "tags: smartphones,accessories" https://www.example.com/

When to use tags: Tags are the most efficient way to invalidate groups of related content. For example, if your shop tags product pages with their category name, you can flush all "Samsung" products with a single request instead of purging each URL individually.

Common tagging strategies:

StrategyTag ExampleUse Case
By categorysmartphones, laptopsNew products added to a category
By brandsamsung, appleBrand-wide price update
By product IDproduct-123Single product changed
By page typelisting, detail, homeTemplate or layout change

Flush File

Clears a specific cached file by its cache hash. This is useful when you know the exact cache entry to invalidate.

bash
curl -X BAN -H "secret: <token>" -H "cache-file: 469640790ad5bda4d1cc6a19f6770214.html" https://www.example.com/

INFO

Tip: The cache file hash is returned as a response header when Debug Headers are enabled.

Flush All

Clears the entire cache for the site. Use this as a last resort — it forces every request to be fetched fresh from your origin until the cache warms up again.

bash
curl -X BAN -H "secret: <token>" -H "type: flushall" https://www.example.com/

Choosing the Right Method

MethodScopeSpeedOrigin Load
Flush URLSingle URLInstantMinimal
Flush TagsGroup of related pagesInstantModerate
Flush FileSingle cache entryInstantMinimal
Flush AllEntire site cacheInstantHigh (cache cold start)

Start with the most targeted method. Use Flush URL for single pages, Flush Tags for groups, and Flush All only when necessary.


Quick Actions

You can also clear cache without writing code using the Dashboard quick actions:

  • Clear Entire Cache — same as Flush All
  • Clear Cache by URL — same as Flush URL
  • Clear Cache by Tag — same as Flush Tags