nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Add ability to configure a namespace/prefix for configured cache storages.

Open mdarrik opened this issue 2 months ago • 0 comments

Describe the feature

Description of the issue

We're working on a Nuxt site using Azure blob storage for the caching layer. We're hitting cache collisions with preview environments since they share the same blob storage container. Since the preview environments are generated on PR, it's not really feasible to give each of them a separate container. It'd be nice to prefix them so they'd be separated by environment.

Proposed feature idea

Alternatives

We could probably use #1048 to do something similar. But this could still be an easier way to have separate caches across multiple deploys or A/B Tests.

Other info

  • I've looked at the cache function in nitro a bit, but can't tell what all would need to be fixed to handle this. I did see that the nitro provided useStorage hook supports using a base as a prefix, but it's not used inside Nitro anywhere. Base is also used in the nitro docs/functions to refer to which storage layer to use, not necessarily to prefix the storage layer.

  • I marked that I'd be willing to submit a PR for this, which is true. My major concerns are around any unintended/easy to miss consequences of this change since the cache handlers are not trivial parts of the Nitro codebase.

Additional information

  • [X] Would you be willing to help implement this feature?

mdarrik avatar Apr 10 '24 20:04 mdarrik