包详细信息

@miniflare/cache

cloudflare638kMIT不推荐使用2.14.4

Miniflare v2 is no longer supported. Please upgrade to Miniflare v4

Cache module for Miniflare: a fun, full-featured, fully-local simulator for Cloudflare Workers

cloudflare, workers, worker, local

自述文件

@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

更新日志

docs/CHANGELOG.md