Cache Invalidation in Specific Scenarios

The following guidelines describe how to invalidate caches in specific scenarios:

Note:

The URLs provided here are examples only. Check the exact URL for your setup before you submit an invalidation request. For information about how to find the correct URL, see Find URLs for Cache Invalidation.

Updating Stylesheets

For best site performance, CSS stylesheets on Commerce websites are cached in the client-side browser for 7 days. You can submit a cache invalidation request to clear the CSS styles from the CDN cache, but this doesn't clear the browser cache. So, when using cache invalidation to refresh CSS styles, you must plan ahead to make sure both returning and new customers see the latest CSS changes.

For example, if you want to show a new color scheme on your website in two weeks, upload the new CSS 7 days before you need it live. Then, submit a cache invalidation request for the current CSS file's URL and any URLs that reference it.

To view updated CSS styles:

  1. Upload the new CSS file to the file cabinet.

  2. Use the Cache Invalidation by URL page to clear the cached CSS.

    1. In the Domain Name field, enter the website domain. For example: www.mywebstore.com.

    2. In the URL field, enter the CSS file's URL. For example:

      /c.7654321/shopflow-1-05-0/skins/standard/Styles-012345a6789.css.

    3. Click Save.

Changing Product Details

Code implementing Item Search API requests is cached for 5 minutes. CDN invalidation takes about 7 minutes, but you can use the Cache Invalidation by URL page to force an update.

  1. In the Domain Name field, enter the website domain. For example: www.mywebstore.com.

  2. In the URL field, enter the Item Search API request URL. For example:

    /api/items?id=199051&fieldset=search.

  3. Click Save.

Updating a Product Image

To update an image on your site, you don't need to use the Cache Invalidation by URL page. Instead, you can check the Generate URL Timestamp box on the file record in the Web Site Hosting Files Folder.

Generate URL TimeStamp checkbox

Checking this box forces the CDN to store a new version of your file. The file cabinet adds a URL timestamp based on the last date the file was changed. A new timestamp is created each time the file changes. The URL timestamp tells the CDN and browser cache that the content has changed. For example, a new timestamp is created each time you change an image used on a landing page or banner.

Best Practice: If you notice outdated images coming from the cache while you're developing your website, check the Generate URL Timestamp box on the file record. The search service reads the new URL, and the new version of the file gets stored in the CDN cache.

Note:

This feature only works for URLs returned by code that uses the Item Search API, such as product images.

Clearing Cached Site Management Tools Content

Site Management Tools (SMT) content is cached like any other content on your site. When you publish new content, SMT-related caches are cleared. Cache clearing occurs for both immediate and scheduled publication.

The cache clearing task is specific to the account’s site ID, so only the caches for the site where you published content are cleared. Caches for any other sites owned by the account aren't cleared.

The caches that are cleared include:

  • Media Cache

  • Ignite Response Cache

  • Hosted Page Util Cache

  • CDN Cache

Related Topics

General Notices