opennextjs / opennextjs-cloudflare

Open Next.js adapter for Cloudflare
https://opennext.js.org/cloudflare
MIT License
378 stars 8 forks source link

refactor: retrieve cache handler kv instance inside constructor #72

Closed james-elicx closed 1 month ago

james-elicx commented 1 month ago

Context

At the moment, the KV instance that is used by the cache handler is assigned to the class as a static property as part of the code patch that happens. We should move this to happen during the creation of a new instance of the class.

Normally, all logic related to setting up the cache handler would happen within the cache handler itself, whereas it currently happens externally. This also means that in the long-term, it makes it easier to extend the cache handler to support additional mechanisms/customisability should we desire (e.g. R2).

Changes

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 0dbf79c10f0ad7bf0f59be31de708c56ba175269

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------------- | ----- | | @opennextjs/cloudflare | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

pkg-pr-new[bot] commented 1 month ago

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/cloudflare@72

commit: 0dbf79c