bajo-template 2.5.3 → 2.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -3
- package/package.json +1 -1
- package/wiki/CHANGES.md +1 -0
package/index.js
CHANGED
|
@@ -25,7 +25,7 @@ async function factory (pkgName) {
|
|
|
25
25
|
},
|
|
26
26
|
loopDetectorDur: '1m',
|
|
27
27
|
cache: {
|
|
28
|
-
|
|
28
|
+
ttlDur: '1s'
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
this.loopDetector = {}
|
|
@@ -270,7 +270,7 @@ async function factory (pkgName) {
|
|
|
270
270
|
let subNs
|
|
271
271
|
const isAbsolute = path.isAbsolute(tpl)
|
|
272
272
|
if (!isAbsolute) subNs = breakNsPath(tpl).subNs
|
|
273
|
-
const canCache = (isAbsolute || subNs === 'template') && this.config.cache !== false && cache
|
|
273
|
+
const canCache = (isAbsolute || subNs === 'template') && this.config.cache !== false && cache
|
|
274
274
|
if (canCache) {
|
|
275
275
|
const item = await cache.get({ key })
|
|
276
276
|
if (item) return item
|
|
@@ -279,7 +279,7 @@ async function factory (pkgName) {
|
|
|
279
279
|
let text = await this._render(tpl, locals, opts)
|
|
280
280
|
if (opts.postProcessor) text = await opts.postProcessor({ text, locals, opts })
|
|
281
281
|
if (subNs) await runHook(`${this.ns}:afterRender${upperFirst(subNs)}`, { tpl, locals, opts, text })
|
|
282
|
-
if (canCache) await cache.set({ key, value: text, ttl: opts.
|
|
282
|
+
if (canCache) await cache.set({ key, value: text, ttl: opts.ttlDur ?? this.config.cache.ttlDur })
|
|
283
283
|
return text
|
|
284
284
|
}
|
|
285
285
|
|
package/package.json
CHANGED