vercel cache
The vercel cache command is used to manage the cache for your project, such as CDN cache and Data cache.
vercel cache purgeUsing the vercel cache purge command to purge the CDN
cache and Data cache for the current project.
vercel cache purge --type cdnUsing the vercel cache purge --type cdn command to
purge the CDN cache for the currenet project.
vercel cache purge --type dataUsing the vercel cache purge --type data command to
purge the Data cache for the current project.
vercel cache invalidate --tag blog-postsUsing the vercel cache invalidate --tag blog-posts command
to invalidate the cached content associated with tag "blog-posts" for the current
project. Subsequent requests for this cached content will serve STALE and
revalidate in the background.
vercel cache dangerously-delete --tag blog-postsUsing the vercel cache dangerously-delete --tag blog-posts
command to dangerously delete the cached content associated with tag "blog-posts" for
the current project. Subsequent requests for this cached content will serve
MISS and therefore block while revalidating.
vercel cache invalidate --srcimg /api/avatar/1Using the vercel cache invalidate --srcimg /api/avatar/1 command
to invalidate all cached content associated with the source image "/api/avatar/1" for the current
project. Subsequent requests for this cached content will serve STALE and
revalidate in the background.
vercel cache dangerously-delete --srcimg /api/avatar/1Using the vercel cache dangerously-delete --srcimg /api/avatar/1
command to dangerously delete all cached content associated with the source image "/api/avatar/1" for
the current project. Subsequent requests for this cached content will serve
MISS and therefore block while revalidating.
vercel cache dangerously-delete --srcimg /api/avatar/1 --revalidation-deadline-seconds 604800Using the vercel cache dangerously-delete --srcimg /api/avatar/1 --revalidation-deadline-seconds 604800
command to dangerously delete all cached content associated with the source image "/api/avatar/1" for
the current project if not accessed in the next 604800 seconds (7 days).
These are options that only apply to the vercel cache command.
The --tag option specifies which tag to invalidate or delete from the cache. You can provide a single tag or multiple comma-separated tags. This option works with both invalidate and dangerously-delete subcommands.
vercel cache invalidate --tag blog-posts,user-profiles,homepageUsing the vercel cache invalidate command with multiple tags.
The --srcimg option specifies a source image path to invalidate or delete from the cache. This invalidates or deletes all cached variants of the source image. This option works with both invalidate and dangerously-delete subcommands.
You can't use both --tag and --srcimg options together. Choose one based on whether you're invalidating cached content by tag or by source image.
vercel cache invalidate --srcimg /api/avatar/1Using the vercel cache invalidate command with a source image path.
The --revalidation-deadline-seconds option specifies the revalidation deadline in seconds. When used with dangerously-delete, cached content will only be deleted if it hasn't been accessed within the specified time period.
vercel cache dangerously-delete --tag blog-posts --revalidation-deadline-seconds 3600Using the vercel cache dangerously-delete command with a 1-hour (3600 seconds) revalidation deadline.
The --yes option can be used to bypass the confirmation prompt when purging the cache or dangerously deleting cached content.
vercel cache purge --yesUsing the vercel cache purge command with the
--yes option.
The following global options can be passed when using the vercel cache command:
For more information on global options and their usage, refer to the options section.
Was this helpful?