
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
koa-cachier
Advanced tools
A Koa Middleware backed by a Redis-powered cache store
npm i koa-cachier
import Koa from "koa";
const app = new Koa();
import { Store, cachier } from "koa-cachier";
const store = new Store();
app.use(cachier(store));
cachier(store, options?);
The middleware factory accepts an options
object. It is expected to contain the following properties:
Type: string
Default: true
Optional: Yes
When set to true
, only successful response bodies are cached.
When set to false
, all response bodies are cached regardless of response codes.
Type: string
Default: true
Optional: Yes
When set to true
, empty response bodies are not cached.
When set to false
, empty response bodies are also cached.
Type: Function
Default: undefined
Optional: Yes
By default, cache store keys are generated with the keyBuilder
as defined in https://github.com/UnKnoWn-Consortium/koa-cachier/blob/b3bd39bf622fbecd71daf717d5d73e53ff25b0a3/src/lib/middleware/index.ts#L22-L30
keyBuilder
is a named export in koa-cachier
.
You can change that by passing in your own key generator via keyCustomizer
.
Koa ctx
is passed to this function when called.
cachier(store, options?, postCacheMiddleware?);
Type: Function
Default: undefined
Optional: Yes
The middleware factory also accepts a postCacheMiddleware
function as the last parameter.
If defined, it gets called with Koa ctx
and next
whenever a cached body is found in the store.
Combined with koa-compose
, postCacheMiddleware
can be leveraged to create an alternative post-cache middleware chain.
FAQs
A Koa Middleware backed by a Redis-powered cache store
The npm package koa-cachier receives a total of 1 weekly downloads. As such, koa-cachier popularity was classified as not popular.
We found that koa-cachier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.