Will Cloudflare Snippets' isolations persist for a certain amount of time after booting?
I know that the Cloudflare Workers might persist the isolations for a certain amount of time after booting, allowing the module-scope object to survive (i.e.
const cache = new Map()
on the top) across few requests.
I'd like to know if Cloudflare Snippets works in the same way or the isolations are destroyed after their requests finished. This is to determine whether I should hoist a few objects and variabled to the module scope so that they would be re-used across requests or not.4 Replies
Snippets are just Workers so yes, they work the same.
Nice. Does Worker Snippets have some limitations? It seems that I can't interact with CDN cache in Snippets using
waitUntil
, I must call put
before the response is sent. Is this intended or has it be fixed? Or snippets just don't have waitUntil
?Snippets don't have access to waitUntil
Limits are here: https://developers.cloudflare.com/rules/snippets/#limits
you may actually be able to import waitUntil now.. I haven't tried: https://developers.cloudflare.com/changelog/2025-08-08-add-waituntil-cloudflare-workers/
should work though
Well, I don't see anything related with
waitUntil
in that Snippets' Limitations docs.