Releases: AdiRishi/cachified-adapter-cloudflare-kv
v2.3.0
What's New
- Compatibility: Updated to support
@epic-web/cachified
version 5.2.0. - Enhanced Functionality: Full support for
waitUntil
has been added.
Documentation Updates
The package documentation has been revised to demonstrate the optimal usage of @epic-web/cachified
with Cloudflare KV, including the new waitUntil
support.
v2.2.1
Changes from 2.2.0
There was a bug in the Github CI/CD pipeline that stopped version 2.2.0
from getting a proper release. Here was the changelog
- Update Cloudflare worker types to the recommended default compatibility date of 2023-07-01
Patch Changes
v2.1.0
v2.0.0
Major Changes
-
4be40a6: Bump @epic-web/cachified peer dependency to ^5.0.0
While there are no breaking changes to this package, @epic-web/cachified has a few breaking changes in their 5.0.0 release.
Please see https://github.com/epicweb-dev/cachified/releases/tag/v5.0.0 for more information.
Minor Changes
- 4be40a6: Add generics to the cloudflare cache implementation
This is in an effort to match the behavior of @epic-web/cachified since 5.1.0
v1.0.1
v1.0.0
Major Changes
-
7725598: 🎉 I'm thrilled to announce the official 1.0 release of
cachified-adapter-cloudflare-kv
! 🚀📦 Installation
To get started, simply install the package along with its peer dependency
@epic-web/cachified
:npm install cachified-adapter-cloudflare-kv @epic-web/cachified
💡 Usage
Integrating the adapter into your Cloudflare Workers is straightforward. Here's a quick example to show you how it's done:
import { cachified, Cache } from "@epic-web/cachified"; import { cloudflareKvCacheAdapter } from "cachified-adapter-cloudflare-kv"; export interface Env { KV: KVNamespace; } export async function getUserById( userId: number, cacheAdapter: Cache, ): Promise<Record<string, unknown>> { return cachified({ key: `user-${userId}`, cache: cacheAdapter, async getFreshValue() { return { id: userId, name: "John Doe" }; }, ttl: 60_000, // 1 minute staleWhileRevalidate: 300_000, // 5 minutes }); } export default { async fetch( request: Request, env: Env, ctx: ExecutionContext, ): Promise<Response> { env.CACHIFIED_KV_CACHE = cloudflareKvCacheAdapter({ kv: env.KV }); const user = await getUserById(1, env.CACHIFIED_KV_CACHE); return new Response(JSON.stringify(user), { headers: { "content-type": "application/json" }, }); }, };
For detailed usage and configuration options, please refer to the README in our repository.
I'm excited to share the latest updates to
cachified-adapter-cloudflare-kv
with you. Your feedback and contributions are greatly appreciated as we work together to enhance web performance. 🌐