about redisCache
falstack opened this issue · 2 comments
falstack commented
sorry i don't know why use redis client and quit:
function redisCache(config) {
if (config && Array.isArray(config.configure)) {
const redis = require('redis')
const client = redis.createClient(config.client)
config.configure.forEach(function(options) {
client.config('set', ...options, function(err, result) {
if (err || result !== 'ok') {
console.error(err)
}
})
})
client.quit()
}
return cacheManager.caching({
store: require('cache-manager-redis'),
retry_strategy() {
return undefined
},
...config
})
}
why don't:
function redisCache(config) {
return cacheManager.caching({
store: require('cache-manager-redis'),
retry_strategy() {
return undefined
},
...config
})
}
and maybe we don't need multi-cache?
--- update
and why need serialize cache string?
arash16 commented
Configure is used to execute some configuration commands on redis instance, so that when it's memory is full, it knows which keys to evict (see sample usage).
If you don't need multi-cache you can simply configure it that.
About serialization, the object that is returned from nuxt contains some fields that can't be stringified easily.
falstack commented
Thanks