-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (22 loc) · 722 Bytes
/
index.js
File metadata and controls
26 lines (22 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const RedisComponentCache = require('./redis-component-cache')
module.exports = function nuxtRedisComponnetCache (options) {
if (this.options.render.ssr === false) {
// SSR Disabled
return
}
// Create empty bundleRenderer object if not defined
if (typeof this.options.render.bundleRenderer !== 'object' || this.options.render.bundleRenderer === null) {
this.options.render.bundleRenderer = {}
}
// Disable if cache explicitly provided in project
if (this.options.render.bundleRenderer.cache) {
return
}
this.options.render.bundleRenderer.cache = RedisComponentCache(Object.assign({
redis: {
port: 6379,
host: '127.0.0.1'
},
ttl: 1000 * 60 * 15
}, options))
}