CACHE
v0.1.0 — SWR + ETag + stampede protection for Hyper routes.
$ hyper add cache
Copies 2 files into src/hyper/cache/ and updates hyper.lock.json.
DEPS
- registry: core
FILES
- cache/index.ts
- cache/sqlite.ts
README
@hyper/cache
SWR + ETag + stampede protection for Hyper routes.
Install
Components are installed as source into your repo, not pulled from npm:
bunx hyper add cache
Wires the alias @hyper/cache to src/hyper/cache/ (configurable in hyper.config.json). See hyperjs.ai for the full registry.
Usage
import { Hyper, ok } from "@hyper/core"
import { cache } from "@hyper/cache"
export default new Hyper()
.use(cache({ maxAgeMs: 60_000 }))
.get("/feed", async () => ok(await loadFeed()))
.listen(3000)
Docs
See the main README and docs/ for guides and integration recipes.
License
MIT
MANIFEST
- /r/cache.json — latest
- /r/cache@0.1.0.json — immutable