@less-is-more/less-js 1.5.0-4 → 1.5.0-5
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/package.json +1 -1
- package/src/cache.js +10 -3
package/package.json
CHANGED
package/src/cache.js
CHANGED
|
@@ -43,7 +43,14 @@ module.exports = class Cache {
|
|
|
43
43
|
* @param {boolean} useNas 是否使用Nas缓存
|
|
44
44
|
* @returns 优先返回对象
|
|
45
45
|
*/
|
|
46
|
-
static async auto(
|
|
46
|
+
static async auto(
|
|
47
|
+
keyPrefix,
|
|
48
|
+
timeSecond,
|
|
49
|
+
args,
|
|
50
|
+
fn,
|
|
51
|
+
zip = false,
|
|
52
|
+
useNas = false
|
|
53
|
+
) {
|
|
47
54
|
let fullKey = keyPrefix;
|
|
48
55
|
for (let i = 0; i < args.length; i++) {
|
|
49
56
|
fullKey += ":" + args[i].toString();
|
|
@@ -97,9 +104,9 @@ module.exports = class Cache {
|
|
|
97
104
|
console.log("Found cache" + (hasLocal ? " local" : ""), fullKey);
|
|
98
105
|
savedData = Cache._unzip(savedData);
|
|
99
106
|
// 优先转成json
|
|
100
|
-
|
|
107
|
+
try {
|
|
101
108
|
return JSON.parse(savedData);
|
|
102
|
-
}
|
|
109
|
+
} catch (e) {
|
|
103
110
|
return savedData;
|
|
104
111
|
}
|
|
105
112
|
}
|