[RFC] Expose `caches.default` as `caches`

Hi there,

As per docs:

Cloudflare Workers runtime exposes a single global cache object.

If there’s only one, would it be possible to expose caches.default as the caches reserved variable? As you’re aware, this is the actual worker API. Currently, the caches.default approach makes working with tools like TypeScript a nightmare…because it’s wrong.

I imagine that you could ship a grace period, maintaining caches.default as an alias for caches (or vice versa).

I think caches.default would have only made sense if you planned on exposing multiple CacheStorage instances, but I haven’t seen any mention of that and the documentation explicitly states “single” – so perhaps there are no plans?


1 Like