Purge cache by Pattern

Efficiently eliminate one or multiple files from iSmartFrame's cache by specifying a Pattern.

POST https://app.ismartframe.com/api/v1/cache/purge/pattern

Query Parameters

Request Body

Cache purge successful. This operation may take a few minutes to propagate across all data centers.

curl --location 'https://app.ismartframe.com/api/v1/cache/purge/pattern?api_key=YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "pattern": "#^\/test-url\/.+\\.html$#"
}'

How does it work?

This API accepts a pattern parameter as input, which is a string containing a JSON-escaped regular expression (regex). This regex is utilized to filter through paths stored in the cache, performing a purge on those that match. The process is designed to ensure that only specific cache entries, identified by the paths that conform to the provided regex pattern, are removed. This allows for precise control over the cache purging process, enabling users to selectively clear cached content based on complex criteria defined by the regex.

For instance, if the regex pattern provided matches a set of URLs within your website, the API will target and purge the cache for those specific URLs across all device types, without affecting the cache of other pages or resources. This capability is particularly useful for maintaining the freshness of your site's content by removing outdated or no longer relevant cache entries without the need to clear the entire cache.

It's important to note that the regex pattern should be carefully crafted to match the intended paths accurately, as the API operates strictly based on the regex criteria provided. Misconfigured patterns may lead to unintended cache purging. Additionally, users should ensure that the regex string is properly JSON-escaped to avoid parsing errors and to ensure the API processes the pattern correctly.

Last updated