Skip to content

cache

Kinsta caches a site in three places: the site cache of the environment itself, the edge cache and the CDN. The cache commands clear each of them and control edge caching and CDN image optimization.

Terminal window
kinstactl cache clear my-site --env live
kinstactl cache edge clear my-site --env live
kinstactl cache cdn clear my-site --env live

Clearing a cache is not destructive, so none of these commands asks for confirmation. They wait for Kinsta to finish by default, and accept --no-wait, --timeout <minutes> and --dry-run; see operations.

Clear the site cache of an environment.

Terminal window
kinstactl cache clear my-site --env live
kinstactl cache clear [site] [options]

Clear the site cache of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID

Options

OptionDescription
--env <environment>environment name or ID
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: POST /sites/tools/clear-cache

Use this after a deploy or a content import, when a page still shows old content. It clears the site cache of that one environment, not the edge cache or the CDN.

Clear the edge cache of an environment.

Terminal window
kinstactl cache edge clear my-site --env live --url https://example.com/blog/ --subdirectories
kinstactl cache edge clear [site] [options]

Clear the edge cache of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID

Options

OptionDescription
--env <environment>environment name or ID
--url <url>clear only this URL
--subdirectoriesalso clear the subdirectories of --url
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: POST /sites/edge-caching/clear

Without --url, the whole edge cache of the environment is cleared. With --url only that URL is cleared, and --subdirectories extends that to everything below it.

Enable edge caching of an environment.

Terminal window
kinstactl cache edge enable my-site --env live
kinstactl cache edge enable [site] [options]

Enable edge caching of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID

Options

OptionDescription
--env <environment>environment name or ID
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites, PUT /sites/edge-caching/status

Edge caching is a setting per environment. Use this command and cache edge disable to switch it, for example to turn it off while you debug a caching problem and on again afterwards.

Disable edge caching of an environment.

Terminal window
kinstactl cache edge disable my-site --env live
kinstactl cache edge disable [site] [options]

Disable edge caching of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID

Options

OptionDescription
--env <environment>environment name or ID
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites, PUT /sites/edge-caching/status

The counterpart of cache edge enable.

Clear the CDN cache of an environment.

Terminal window
kinstactl cache cdn clear my-site --env live
kinstactl cache cdn clear [site] [options]

Clear the CDN cache of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID

Options

OptionDescription
--env <environment>environment name or ID
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites/{site_id}/environments, POST /sites/cdn/clear-cache

Use this when static files such as images, CSS or JavaScript are served stale from the CDN.

Show or set the CDN image optimization of an environment.

Terminal window
kinstactl cache cdn image-optimization my-site lossy --env live
kinstactl cache cdn image-optimization <site> [type] [options]

Show or set the CDN image optimization of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID
typeset this type; omit to show the current one Choices: off, lossy, lossless.

Options

OptionDescription
--env <environment>environment name or ID
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites, GET /sites/{site_id}/environments, PUT /sites/cdn/image-optimization

Without a type, the command shows the current setting. With off, lossy or lossless it changes the setting; only that form is an operation that waits and accepts --dry-run. To read the current value:

Terminal window
kinstactl cache cdn image-optimization my-site --env live