cacheflow-elsolya
v0.1.0
Published
Safe HTTP response caching with ETags, invalidation, and revalidation
Maintainers
Readme
cacheflow-elsolya
Safe HTTP response caching with ETags, stale-while-revalidate, and tag invalidation.
Install
npm install cacheflow-elsolyaUsage
import { createResponseCache, createMemoryResponseCacheStore } from "cacheflow-elsolya";
const cache = createResponseCache({
store: createMemoryResponseCacheStore(),
ttl: "5m",
staleWhileRevalidate: "30m",
});
const response = await cache.execute({
request: { method: "GET", path: "/products" },
handler: async () => ({ status: 200, headers: {}, body: { items: [] } }),
});License
MIT
