Skip to content

Commit

Permalink
Create changeset for 1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
AdiRishi committed Nov 30, 2023
1 parent 6b7c6ea commit 7725598
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .changeset/rich-bikes-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
"cachified-adapter-cloudflare-kv": major
---

🎉 We are 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`:

```sh
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:

```ts
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 });
},
};
```

For detailed usage and configuration options, please refer to the README in our repository.

We welcome users to this new chapter in `cachified-adapter-cloudflare-kv`'s journey and look forward to your feedback and contributions. Let's build a faster web together! 🌐
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,11 @@ Contributions are what make the open-source community an amazing place to learn,
- [@epic-web/cachified](https://github.com/epicweb-dev/cachified) - For the foundational caching library.
- [Cloudflare KV](https://developers.cloudflare.com/kv/) - For the underlying caching technology.
---
<div align="center">
Made with ❤️
</div>

0 comments on commit 7725598

Please sign in to comment.