@less-is-more/less-js 1.5.0-2 → 1.5.0-3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cache.js +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@less-is-more/less-js",
3
- "version": "1.5.0-2",
3
+ "version": "1.5.0-3",
4
4
  "description": "Fast develop kit for nodejs",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/cache.js CHANGED
@@ -40,10 +40,10 @@ module.exports = class Cache {
40
40
  * @param {*} args 直接传arguments,用于拼接缓存key
41
41
  * @param {function} fn 没有缓存的实现
42
42
  * @param {boolean} zip 是否压缩
43
- * @param {boolean} nas 是否使用Nas缓存
43
+ * @param {boolean} useNas 是否使用Nas缓存
44
44
  * @returns 优先返回对象
45
45
  */
46
- static async auto(keyPrefix, timeSecond, args, fn, zip = false, nas = false) {
46
+ static async auto(keyPrefix, timeSecond, args, fn, zip = false, useNas = false) {
47
47
  let fullKey = keyPrefix;
48
48
  for (let i = 0; i < args.length; i++) {
49
49
  fullKey += ":" + args[i].toString();
@@ -52,7 +52,7 @@ module.exports = class Cache {
52
52
  let savedData = Cache._getLocal(fullKey);
53
53
  let hasLocal = false;
54
54
  if (Param.isBlank(savedData)) {
55
- if (nas) {
55
+ if (useNas) {
56
56
  savedData = Nas.get(fullKey);
57
57
  } else {
58
58
  savedData = await Redis.exec("get", fullKey);
@@ -82,7 +82,7 @@ module.exports = class Cache {
82
82
  if (Cache._needZip(redisContent, zip)) {
83
83
  redisContent = Cache._zip(redisContent);
84
84
  }
85
- if (nas) {
85
+ if (useNas) {
86
86
  Nas.set(fullKey, result, timeSecond);
87
87
  } else {
88
88
  await Redis.exec("setex", fullKey, timeSecond + "", redisContent);