Clearing the cache of a domain or subdomain¶
Sends a PUT request to the endpoint /domain/{domainId}/cache-clear.
Description¶
The Clear-Cache request allows the user to delete all cached files or specific cached files on all Myra nodes for all or selected domains and subdomains.
Requirements¶
Values of the request: Domain ID {domainId}
Objects: CacheClearVO
Request¶
To clear cache from a domain or subdomain, the Domain-ID {domainId} needs to be added to the path of the request.
For a detailed specification of which information is required to clear the cache, the object CacheClearVO with the following attributes needs to be defined in the body:
| Attributes | Description | Values |
|---|---|---|
fqdn |
The name of the domain or subdomain.NoteIf the attribute is not set, the entire cache of the domain will be cleared. | string |
recursive |
The setting to match the pattern against sub-directories. |
|
resource |
The resources to be cleared from the cache.NoteIf the attribute is not set, the whole cache of the defined domain or subdomain will be cleared. | string |
bulk |
A list of resources to be cleared.NoteIf set, the resources attribute will be ignored. |
The following options are available to clear the cache:
-
Deleting file-type from the cache:
fqdn: The name of the domain or subdomain.recursive:trueresource: The pattern to search for (for example:/*js).- Delete the
bulkattribute.
-
Deleting all files of a domain or subdomain from the cache:
fqdn: The name of the domain or subdomain.recursive:true- Delete the
resourceattribute. - Delete the
bulkattribute.
-
Deleting all files from the cache for all domains and subdomains:
- Delete the
Fqdnattribute. recursive:true- Delete the
resourceattribute. - Delete the
bulkattribute.
- Delete the
-
Deleting cached files from all domains and subdomains from the cache:
- Delete the
Fqdnattribute. recursive:trueresource: The pattern to search for (for example:/*js).- Delete the
bulkattribute.
- Delete the
-
Deleting a list of defined files from a domain or subdomain:
fqdn: The name of the domain or subdomain.recursive:trueorfalse- Delete the
resourceattribute. bulk: Array of all cached file types (for example:"bulk": ["/*.css", "/*.txt"])
Examples of pattern matching using recursive
| Pattern | Recursive | Resource | Result |
|---|---|---|---|
| /*.js | No | /main.js | match |
| /*.js | No | /folder/main.js | no match |
| /*.js | No | /testmain.css | no match |
| .js | Yes | /assets/script.js | match |
| .js | Yes | /assets/jquery/jquery.js | match |
| .js | Yes | /main.js | match |
| .js | Yes | /main.css | no match |
| .js | Yes | /assets/js/source.map | no match |
| /assets/*.js | No | /assets/script.js | match |
| /assets/*.js | No | /asset/script.js | no match |
| /assets/*.js | No | /main.js | no match |
| /assets/*.js | No | /folder/js/script.js | no match |
| /assets/*.js | Yes | /assets/script.js | match |
| /assets/*.js | Yes | /assets/jquery/jquery.js | match |
| /assets/*.js | Yes | /main.js | no match |
| /assets/*.js | Yes | /js/angular.js | no match |
| /*.* | Yes | /main.js | match |
| /* | Yes | /main.js | match |
The system only returns a 200 HTTP code in response to the successful request.
Example¶
Example request body:
{
"objectType": "string",
"fqdn": "string",
"resource": "string",
"recursive": true,
"bulk": "string"
}
Responses¶
The following responses are available:
| STATUS CODE | DESCRIPTION |
|---|---|
| 200 | The request has succeeded. |
| 400 | The request was unsuccessful. The request was invalid or information is missing. |
| 401 | The request has not succeeded because the user authentication was incorrect. |
| 403 | The request has not succeeded because the user does not have the right permissions. |