Skip to content

SYSTEM Cited by 1 source

vinext KVCacheHandler

KVCacheHandler is the default Cloudflare-KV-backed cache handler shipped with vinext (from vinext/cloudflare). Plugs into Next.js's setCacheHandler() API so ISR works out of the box on Workers.

import { KVCacheHandler } from "vinext/cloudflare";
import { setCacheHandler } from "next/cache";

setCacheHandler(new KVCacheHandler(env.MY_KV_NAMESPACE));

Pluggable by design

"The caching layer is designed to be pluggable. That setCacheHandler call means you can swap in whatever backend makes sense." Named alternatives:

  • R2 — better fit for apps with large cached payloads or different access patterns.
  • Cloudflare Cache API — post-launch target. "We're also working on improvements to our Cache API that should provide a strong caching layer with less configuration."

Canonical wiki instance of patterns/pluggable-cache-handler.

Seen in

Last updated · 200 distilled / 1,178 read