How To Purge the Cache

This article is a quick guide to purging your cache using the portal and the cache purge API. More details can be found in the Purging Your Cache in the Portal article in the Using the Customer Portal section and the Cache Purge API Guide.


Using the Portal

  1. Click on Config > Cache Purge to display the Cache Purge page:
  2. Select the Cache Purge Specificity. This can be
    • Multiple URLs
    • Single URL
    • Complete domain
  3. Follow the on-screen directions depending on which type of purge. For more details see Purging Your Cache in the Portal.
  4. Click Purge Cache. You will see a confirmation message. Click Yes, Purge Cache to proceed with the purge.

Warning

Full domain and prefix purge operations can potentially purge a large number of objects from the cache, which can temporarily affect your site's performance.

Using the Cache Purge API

A purge request is made by sending a JSON object to the Cache Purge API. It contains a purge_request block with an action field that specifies the type of purge request, and a uris block that contains uri objects, each of which has a match_mode that specifies the type of purge (EXACT_LITERAL or PREFIX_LITERAL) and a uri_pattern field.

Say you wanted to purge all cached images in the path /img and all CSS files in the path /css on the site acme.com. The purge_request would be:

"purge_request":{
   "action":"PURGE",   "uris":[
      {
         "match_mode":"PREFIX_LITERAL",
         "uri_pattern":"http://acme.com/img/"
      },
      {
         "match_mode":"PREFIX_LITERAL",
         "uri_pattern":"http://acme.com/css/"
      }
   ]
}

Note that the uri_pattern needs to begin with the protocol and domain name, unlike the path you give in the portal.

Using cURL

Execute the command

$ curl -k -u 'hsimpson@acme.com:doh!123' 'https://api.instartlogic.com/acme/v1/cache/purge' -d 
'{"purge_request":{"action":"PURGE","uris":[{"match_mode":"PREFIX_LITERAL",
"uri_pattern":"http://acme.com/img/*"},{"match_mode":"PREFIX_LITERAL",
"uri_pattern":"https://acme.com/css/"}]}}' -X POST

where you would of course use your own authorization string and company name in place of the placeholders.

Using Advanced REST client plugin for Chrome:

  1. In the URL field at the top enter

    https://api.hq.instart.co/acme/v1/cache/purge
  2. Click the POST radio button.
  3. In the Headers field, add a header named Authorization with a value

    Basic <authorization_string>

    where authorization_string consists of your username and password separated by a colon (:) and then base 64-encoded.

  4. Type the purge_request JSON (shown above) in the Raw payload field.
  5. Click Send.

By any method, if successful, the API server will respond with a JSON object similar to the following:

{
   "code": 200,
   "description": "OK"
   "purge_response": {
      "transaction_status_uri": "/transactions/67804160"
   }
   "transaction_id": 67804160
}

For more details see the Cache Purge API Guide.