Purging the resource cache
To purge the cache of the resource:
-
In the management console
, select the folder where your resource is located. -
Go to Cloud CDN.
-
Click the resource name.
-
Navigate to the Content tab.
-
In the top-right corner, click
Purge cache. -
Select the type of cache purging:
-
Full: To purge the cache for all files. -
Selective: To purge the cache for selected files. In the File path field, specify comma-separated paths to the files.For partial purging, you can specify paths to individual files and folders. Each path must begin with the
/or (only when using theEdgeCDNprovider)*character. The*wildcard character can replace any number of characters.Note
When using the Yandex Cloud CDN provider, you can only specify the
*wildcard character at the end of the path. If you specify*at the beginning or middle of a path, the cache for matching files will not be purged.
-
-
Click Purge cache.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
-
View the description of the CLI command to update a resource:
yc cdn resource update --help -
Get a list of all CDN resources in the default folder:
yc cdn resource list --format yamlResult:
id: s0me1dkfjq******** folder_id: s0mef01der7p******** cname: testexample.com created_at: "2022-01-19T09:23:57.921365Z" updated_at: "2022-01-19T10:55:30.305141Z" active: true options: edge_cache_settings: enabled: true default value: "345600" cache_http_headers: enabled: true value: - content-type - content-length - connection - server - date - test stale: enabled: true value: - error - updating allowed_http_methods: value: - GET - POST - HEAD - OPTIONS origin_group_id: "89783" origin_group_name: My origins group origin_protocol: HTTP ssl_certificate: type: DONT_USE status: READY -
Purge the file cache:
yc cdn cache purge \ --resource-id <resource_ID> \ --path <file_path_1>,<file_path_2>,...,<file_path_n>Where:
-
--resource-id: ID of the CDN resource to purge cache in. -
--path: List of paths to CDN resource files whose cache needs purging.For partial purging, you can specify paths to individual files and folders. Each path must begin with the
/or (only when using theEdgeCDNprovider)*character. The*wildcard character can replace any number of characters.Note
When using the Yandex Cloud CDN provider, you can only specify the
*wildcard character at the end of the path. If you specify*at the beginning or middle of a path, the cache for matching files will not be purged.If the CDN resource uses
Varyheaders (e.g.,Vary: Accept-Encoding), you must add the*wildcard character to the end of the path when purging the cache to remove all possible cached versions of the files, e.g.,/image/foobar.png*.If you omit the
--pathsetting with paths to files, the cache of all resource files will be purged. For more information, see Purging cache.
For more information about the
yc cdn cache purgecommand, see this CLI reference. -
Use the purge REST API method for the Cache resource or the CacheService/Purge gRPC API call.
It may take up to 15 minutes to purge the cache.