@express-route-cache/redis
v0.1.3
Published
Redis adapter for @express-route-cache/core
Downloads
252
Maintainers
Readme
@express-route-cache/redis
Redis adapter for
@express-route-cache/core.
Installation
npm install @express-route-cache/redis ioredisUsage
import { createCache } from "@express-route-cache/core";
import { createRedisAdapter } from "@express-route-cache/redis";
const cache = createCache({
adapter: createRedisAdapter({
url: "redis://localhost:6379",
// OR pass ioredis options
options: {
password: "auth",
},
}),
staleTime: 60,
});Features
- High Performance: Uses native Redis
MGET,SET EX, andINCRcommands. - Distributed: Perfect for multi-instance Express applications.
- Flexible: Accepts connection strings,
ioredisoptions, or an existingioredisinstance. - Safe Lifecycle Management: If you pass an existing
clientinstance, the adapter will never call.quit()on it when tearing down, ensuring it won't kill connections shared by the rest of your app.
Documentation
For full configuration options and caching logic, see the Core Documentation.
License
MIT
