Introducing Edgio Applications v7Find out what's new.

Purging Cached Content

Purge cached content to force the CDN to request a new version of that content from an origin server or Cloud Functions. This ensures that the latest version of that content is delivered to your clients.
Purging does not delete content from the origin server. A file management tool (e.g., SFTP or rsync) may be used to delete content from an origin server.
Purge by relative path, surrogate key, or all cached content using the:
By default, deploying to Edgio preserves an environment’s cached content. Learn more.

Relative Path

You may specify a relative path that identifies the set of cached respones that will be purged. This relative path starts directly after the hostname.
Use an * to represent zero or more characters.
This example assumes that you need to purge the following content:
Purge the above URL by specifying the following relative path:
Alternatively, you can use an * to recursively purge a directory. The following relative path pattern recursively purges all content from the /sports directory including marchtournament.html:

Surrogate Key

You may purge cached content by surrogate key (aka cache tag). A surrogate key is a label that you may apply to cached responses. Purging by surrogate key allows you to purge related content across your entire site.
Improve performance and reduce the load on your web servers by only purging targetted content through the use of surrogate keys.

Tagging Cached Content

Apply a surrogate key by setting the Surrogate-Key response header.
Syntax: Surrogate-Key: <TAG1> <TAG2> <TAG3>
For example, the following response header applies three surrogate keys to the cached response. Purging any of those three surrogate keys will purge all cached responses tagged with that surrogate key.
Surrogate-Key: sports basketball march-tournament

Edgio Console

Use the Edgio Console to purge cached content within a specific environment.
To purge content
  1. Load the Caching page.
    1. From the Edgio Console, select the desired private space or organization.
    2. Select the desired property.
    3. From the left-hand pane, select the desired environment from under the Environments section.
    4. From the left-hand pane, select Caching.
  2. From the Cache Purge History section, click Purge the Cache.
  3. Purge:
    • All Cached Content: Select Purge all entries.
    • By Path: Select Purge by path. Specify each desired relative path on a separate line.
    • By Surrogate Key: Select Purge by surrogate key. Specify each desired surrogate key on a separate line.
  4. Click Purge Cache.
  5. When prompted, click Purge to confirm that your content will be purged.

Edgio CLI

Purge cached content through the Edgio CLI by passing the cache-clear argument. You may purge:
  • All content: Exclude the --path and --surrogate-key options.
  • By relative path: Pass the --path option. You may use an * to represent zero or more characters.
  • By surrogate key: Pass the --surrogate-key option. Learn more about surrogate keys.
Run the following command to purge the basketball surrogate key from the production environment from the my-videos property:
1edgio cache-clear --organization=my-organization --property=my-videos --environment=production --surrogate-key=basketball


Purge cached content through the Edgio REST API through the clear-cache endpoint. You may purge:
  • All content: Exclude the paths and surrogateKeys properties.
  • By relative path: Pass the paths array of string values. You may use an * to represent zero or more characters.
  • By surrogate key: Pass the surrogateKeys array of string values. Learn more about surrogate keys.


By default, cached content is preserved when you deploy a new version of your site. Override this behavior by clearing the Preserve cache between deployments setting on the Caching page.
While preserving the cache between deployments can greatly reduce the load on your origin following a deployment, it can also lead to inconsistent behavior if the new version of your browser code receives an old, incompatible API response from the cache. If you plan on preserving cache content between deployments, then we recommend adding an API version number to your URL scheme to ensure that breaking changes to your API don’t affect your website’s functionality when old responses are served from the cache.

Automated Purging

Automate cache purging through NPM scripts and GitHub actions.

NPM Scripts

Here is an example script you can add to your package.json to handle cache clearing for each environment. You can also configure scripts to clear by surrogate key, path, or group (As defined in Edgio Console)
These scripts assume that you have created environments called “production”, “staging”, and “development and you have created a deploy key for your site and added it as a secret in your repo called “edgio_deploy_token”.
1"scripts": {
2 ...
3 "clearcache:dev": "edgio cache-clear --organization=my-organization --property=myEdgioApp --environment=development --token=$edgio_deploy_token",
4 "clearcache:stage": "edgio cache-clear --organization=my-organization --property=myEdgioApp --environment=staging --token=$edgio_deploy_token",
5 "clearcache:prod": "edgio cache-clear --organization=my-organization --property=myEdgioApp --environment=production --token=$edgio_deploy_token",
6 "clearcache:prod:pdps": "edgio cache-clear --organization=my-organization --property=myEdgioApp --environment=production --surrogate-key=pdp --token=$edgio_deploy_token",
7 "clearcache:prod:plps": "edgio cache-clear --organization=my-organization --property=myEdgioApp --environment=production --surrogate-key=plp --token=$edgio_deploy_token",
8 ...
9 },

GitHub Actions

Here is an example GitHub action that clears the cache at a scheduled time using the jobs defined in your package.json
1# Add this file to your project at .github/workflows/clear-cache.yml
3# This GitHub action clears the sites PRODUCTION cache at 09:15AM UTC every day.
5# The schedule syntax is standard cron syntax
6# minute hour day-of-month month day-of-week
7# * * * * *
9# 1.) This example depends on a script being defined in your package.json called clearcache:prod
11# In order for this action to clear your cache, you must create a deploy token from the site settings page
12# in and configure it as a secret called "edgio_deploy_token" in your repo on GitHub.
14name: Clear PRODUCTION cache at 5am
16 schedule:
17 - cron: '15 9 * * *'
19 clear-the-cache:
20 runs-on: ubuntu-latest
21 steps:
22 - name: Extract branch name
23 shell: bash
24 run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_ENV
25 - uses: actions/checkout@v1
26 - uses: actions/setup-node@v1
27 with:
28 node-version: 14
29 registry-url:
30 - name: Cache node modules
31 uses: actions/cache@v1
32 env:
33 cache-name: cache-node-modules
34 with:
35 path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
36 key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
37 restore-keys: |
38 ${{ runner.os }}-build-${{ env.cache-name }}-
39 ${{ runner.os }}-build-
40 ${{ runner.os }}-
41 - run: npm ci
42 - name: Clear cache in production
43 run: npm run clearcache:prod
44 env:
45 edgio_deploy_token: ${{secrets.edgio_deploy_token}}