Cache middleware for qoq.
yarn add qoq-cache
import { WebSlotManager, createConfig } from 'qoq';
import { Cache, MemoryCacheOptions } from 'qoq-cache';
const cacheOptions = createConfig<MemoryCacheOptions>({
slot: 'MemoryCache',
});
const webSlots = WebSlotManager.use(new Cache(cacheOptions));
Then feel free to use in routers
import { createWebRouter } from 'qoq';
export const router = createWebRouter({
slots: webSlots,
});
router
.get('/')
.action(async (ctx) => {
await ctx.cache.set('hello', 'world');
ctx.send('OK');
});
- FileCache
- MemoryCache
Of course, @see qoq-redis
Of course, @see qoq-sequelize