koa-api-starter
koa-api-starter copied to clipboard
Redis and RedisCache clients
- Add
redis-client.js
module - Replace
client
to importedredis-client
inioEmitter.js
- Create
cache
module withRedisCacheClient
. - Replace
redis
toioredis
in 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.