koa-api-starter
koa-api-starter copied to clipboard
Redis and RedisCache clients
- Add
redis-client.jsmodule - Replace
clientto importedredis-clientinioEmitter.js - Create
cachemodule withRedisCacheClient. - Replace
redistoioredisin dependencies.
Now we can use it like that:
const redisCacheClient = require('cache');
const cache = redisCacheClient.child('products');
const name = `key`;
await cache.exists(name);
await cache.get(name);
await cache.set(name, html);
await cache.remove(name);
await cache.removeAll();
Guys, interesting your opinion about this improvement.