Hi, Is managing the cloudflare cache inside the worker's entry point module the recommend way?

I’m working on a small Next.js project deployed to Cloudflare Workers using OpenNext. The app includes both frontend and backend — meaning there’s no separate Node.js server, everything runs directly in the Worker environment. The example usage of either Fetch-based caching or Cache API are all demonstrated inside the Worker’s entry point Is this the recommended way to manage caching in Cloudflare Workers? i.e., handling all caching logic in the entry point? Or is it also acceptable to perform caching closer to where data is fetched, such as inside a Next.js Route Handler? for example something like this:
const getSomething = () => {

const cache = cache.default;

const cached = cache.match("somekey")

.....

}
const getSomething = () => {

const cache = cache.default;

const cached = cache.match("somekey")

.....

}
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?