@toshihiko/redis-cache
v2.0.0-alpha.0
Published
Promise-only Redis cache for Toshihiko v2.
Downloads
151
Readme
Toshihiko Redis Cache
Promise-only Redis cache support for Toshihiko v2, using the ioredis Promise API with stable key generation and positional batch results.
Installation
npm install toshihiko @toshihiko/redis-cacheUsage
Create the cache and use the Toshihiko cache contract directly:
import { RedisCache } from '@toshihiko/redis-cache';
const cache = new RedisCache('127.0.0.1:6379', {
prefix: 'app:',
});
await cache.setData('app', 'users', 1, { id: 1, name: 'Alice' });
const users = await cache.getData('app', 'users', [1, 2]);getData(), setData(), deleteData(), and deleteKeys() return native Promises. Batch cache misses preserve their input positions with null values.
License
MIT
