@miniflare/cache
@miniflare/cache
npm i @miniflare/cache
@miniflare/cache

@miniflare/cache

🔥 Fully-local simulator for Cloudflare Workers

by cloudflare

2.12.1 (see all)License:MITTypeScript:Built-In
npm i @miniflare/cache
Readme

@miniflare/cache

Cache module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers. See ✨ Cache for more details.

Example

import { Cache } from "@miniflare/cache";
import { Response } from "@miniflare/core";
import { MemoryStorage } from "@miniflare/storage-memory";

const cache = new Cache(new MemoryStorage());

const key = "http://localhost";
const res = new Response("body", {
  headers: { "Cache-Control": "max-age=3600" },
});
await cache.put(key, res);

const cachedRes = await cache.match(key);
console.log(await cachedRes.text()); // body
VersionTagPublished
2.12.1
latest
1mo ago
2.8.2-d1.0
d1
6mos ago
2.0.0-rc.5
next
1yr ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate