Middleware v2, complete rewrite by @stafyniaksacha ! 👏 👏
New configuration:
// config/middleware.js
module.exports = ({ env }) => ({
settings: {
/**
* @typedef {Object} UserMiddlewareCacheConfig
* @property {'mem'|'redis'=} type
* @property {boolean=} enabled
* @property {boolean=} logs
* @property {boolean=} populateContext
* @property {boolean=} populateStrapiMiddleware
* @property {boolean=} enableEtagSupport
* @property {boolean=} enableXCacheHeaders
* @property {boolean=} clearRelatedCache
* @property {boolean=} withKoaContext
* @property {boolean=} withStrapiMiddleware
* @property {string[]=} headers
* @property {number=} max
* @property {number=} maxAge
* @property {number=} cacheTimeout
* @property {(UserModelCacheConfig | string)[]=} models
* @property {Object=} redisConfig
*/
cache: {
enabled: true,
type: 'redis',
models: ['review'],
redisConfig: {
sentinels: [
{ host: '192.168.10.41', port: 26379 },
{ host: '192.168.10.42', port: 26379 },
{ host: '192.168.10.43', port: 26379 },
],
name: 'redis-primary',
},
},
},
});
Full Changelog: v1.5.0...v2.1.1