Max CacheTtl Allowed In Cloudflare workers

Is there any limitations on max cache time to live allowed in Cloudflare workers cache API
cf: {
cacheEverything: true,
cacheTtl: 31536000 // 1 year in seconds
}
cf: {
cacheEverything: true,
cacheTtl: 31536000 // 1 year in seconds
}
6 Replies
Hard@Work
Hard@Work5d ago
It just has to be a valid number. Note though that this is a Max TTL, so most objects would expire before this deadline
dev.itsarun
dev.itsarunOP5d ago
Do you mean I can get cacheTtl for atleast 2 days ?
Hard@Work
Hard@Work5d ago
Yeah, you can set it to a year, and it will be fine
dev.itsarun
dev.itsarunOP5d ago
Is there any limits based on the plans we are Workers free / Pro ?
Hard@Work
Hard@Work5d ago
Here are the limits and default behaviour for Cache: https://developers.cloudflare.com/cache/concepts/default-cache-behavior/
Cloudflare Docs
Default Cache Behavior · Cloudflare Cache (CDN) docs
Cloudflare respects the origin web server’s cache headers in the following order unless an Edge Cache TTL cache rule overrides the headers. Refer to the Edge TTL section for details on default TTL behavior.
dev.itsarun
dev.itsarunOP5d ago
Thank you

Did you find this page helpful?