@hverlin/redis-hybrid-cache
v0.0.3
Published
Hybrid Redis client for NodeJS. Leverage the client tracking feature of Redis to combine an in-memory cache with a Redis server for faster performance.
Downloads
15
Maintainers
Readme
Redis Hybrid Cache
This client makes use of Redis client tracking to combine:
- a local in-memory cache
- a redis server (using hverlin/redis)
Only works with Redis >= 6 as it makes use of RESP3.
Quick Start
Installation
npm install --save @hverlin/redis-hybrid-cache
See https://github.com/hverlin/redis-hybrid-cache/packages/1570282
Usage
// create the client and set set client side tracking
const client = await createHybridClient();
const value = await client.get('foo'); // null
await client.set('foo', 'bar', { ttl: 60 });
console.log(await client.get('foo')); // bar, from local cache
Supported commands
- get
- set
- del
Other commands are accessible by using client.getRedisClient()
which will return a clientV3 instance of hverlin/redis