Purge images from the cache

If you modify an image file, you should purge it from the cache. This ensures that Image and Video Manager generates fresh derivatives using the new version of the image.

Image and Video Manager supports these purging methods:

  • Fast Purge (by URL, CP Code, ARL, or Cache Tag)
  • Enhanced Content Control Utility by directory or extension

Images can be cached in several places. Before purging, complete the following:

  • Remove the out-of-date images from the origin server
  • Clear your browser cache and history
  • Clear the images from any middle proxy caches in your local environment

Example:

Image cache key:

L1/L/4321/123456/30d/www.example.com/Resources/example/banner/1_store_1_90.jpg?323 cid=___IM_FILE_NAME=.auto.1.5000.chrome&IM_API_TOKEN=www.example.com-10506295&IM_COMB_ON=true

In order to properly purge this image, you would need to purge:

http://www.example.com/Resources/example/banner/1_store_1_90.jpg?323

"?323" is not part of the flexible portion.

📘

Preserve-query-args

preserve-query-args is enabled in the product. This means that query parameters are included in the URL part of the cache key, not the flexible portion.

🚧

Purge by CP codes

When purging by CP codes, you must submit the purge for pristine images before purging the derivative images.

Use the Content Control Utility to purge images

In most cases, you can use the Content Control Utility's Fast Purge feature. Alternatively, you can automate cache purging requests with the Enhanced Content Control utility API.

With either tool, choose the option to purge by URL, and submit the list of URLs for all changed images. Typically, you should purge the cache with "Invalidate" rather than "Remove". For more information see the Purge Cache documentation.

If your configuration includes the Origin Base Path behavior in any Image and Video Manager rules, see Special Considerations for Origin Base Path.

Special Considerations for Origin Base Path

When applied to Image and Video Manager requests, the Origin Base Path behavior creates different cache keys for derivative and pristine images.

To purge both versions, submit a second URL with a query string parameter that disables Image and Video Manager (?imbypass=true).

In this example, versions of product123.jpg and product456.jpg are now available on your origin. The Image and Video Manager rule that processes these image requests contains the Origin Base Path behavior.

Submit a purge request containing the following URLs:

https://www.example.com/images/product123.jpg?imbypass=true
https://www.example.com/images/product456.jpg?imbypass=true
https://www.example.com/images/product123.jpg
https://www.example.com/images/product456.jpg

Purging the first two URLs clears the old pristine images from the cache. Purging the second two URLs clears the derivative images.

🚧

To purge both versions, the pristine images purge must be submitted before purging the derivative images.