How long does ImageKit cache assets?

Can I change this for different kind of assets? We would like it to be shorter for some content.

By default, ImageKit caches assets for a maximum of 365 days on the CDN. The cache header that is sent out is public, s-maxage=31536000, max-age=31536000, must-revalidate

Note that this is maximum time of cache, and is not guaranteed that the content will stay in CDN cache for this duration, as CDNs keep only popular content (content which gets frequent requests) in cache.

ImageKit also maintains some internal caches which have a lower or equal cache time. However, as an exception, video cache duration for processed videos are unrestricted.

All of these caches can be cleared using the Purge cache API or dashboard.

You can also use versioning in your URLs to bypass existing cache. You can learn more about versioning here.

You can also set a custom cache time by using the origin-based cache control feature, where ImageKit honors the cache-control header available from your connected origin to ImageKit. If the origin does not send a cache-control header, then the default cache time is used. You can learn more about custom cache control time here.