@pisell/core 1.0.22 → 1.0.23

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.
@@ -124,20 +124,26 @@ var getCache = /*#__PURE__*/function () {
124
124
  case 0:
125
125
  _getConfig3 = getConfig(), storage = _getConfig3.storage; // 如果 当前时间 - 数据缓存时间 小于 超时时间, 则数据正常.
126
126
  if (!(cache.type === 'memory')) {
127
- _context2.next = 6;
127
+ _context2.next = 8;
128
128
  break;
129
129
  }
130
- if (!getIsEffectiveTime(CACHES[key].time)) {
130
+ if (CACHES[key]) {
131
131
  _context2.next = 4;
132
132
  break;
133
133
  }
134
- return _context2.abrupt("return", CACHES[key].data);
134
+ return _context2.abrupt("return", null);
135
135
  case 4:
136
- _context2.next = 21;
137
- break;
136
+ if (!getIsEffectiveTime(CACHES[key].time)) {
137
+ _context2.next = 6;
138
+ break;
139
+ }
140
+ return _context2.abrupt("return", CACHES[key].data);
138
141
  case 6:
142
+ _context2.next = 23;
143
+ break;
144
+ case 8:
139
145
  if (!(cache.type === 'storage')) {
140
- _context2.next = 13;
146
+ _context2.next = 15;
141
147
  break;
142
148
  }
143
149
  storageDetail = storage.getStorage(key) || "";
@@ -145,35 +151,35 @@ var getCache = /*#__PURE__*/function () {
145
151
  storageDetail = JSON.parse(storageDetail);
146
152
  }
147
153
  if (!getIsEffectiveTime(storageDetail.time)) {
148
- _context2.next = 11;
154
+ _context2.next = 13;
149
155
  break;
150
156
  }
151
157
  return _context2.abrupt("return", (_storageDetail = storageDetail) === null || _storageDetail === void 0 ? void 0 : _storageDetail.data);
152
- case 11:
153
- _context2.next = 21;
154
- break;
155
158
  case 13:
159
+ _context2.next = 23;
160
+ break;
161
+ case 15:
156
162
  if (!(cache.type === 'indexDB')) {
157
- _context2.next = 21;
163
+ _context2.next = 23;
158
164
  break;
159
165
  }
160
166
  app = getApp();
161
167
  if (!app.dbManager) {
162
- _context2.next = 21;
168
+ _context2.next = 23;
163
169
  break;
164
170
  }
165
- _context2.next = 18;
171
+ _context2.next = 20;
166
172
  return app.dbManager.get('requests', key);
167
- case 18:
173
+ case 20:
168
174
  indexDBDetail = _context2.sent;
169
175
  if (!indexDBDetail) {
170
- _context2.next = 21;
176
+ _context2.next = 23;
171
177
  break;
172
178
  }
173
179
  return _context2.abrupt("return", indexDBDetail === null || indexDBDetail === void 0 ? void 0 : indexDBDetail.data);
174
- case 21:
180
+ case 23:
175
181
  return _context2.abrupt("return", null);
176
- case 22:
182
+ case 24:
177
183
  case "end":
178
184
  return _context2.stop();
179
185
  }
@@ -77,6 +77,9 @@ var getIsEffectiveTime = (time) => {
77
77
  var getCache = async (key, cache) => {
78
78
  const { storage } = (0, import_config.getConfig)();
79
79
  if (cache.type === "memory") {
80
+ if (!CACHES[key]) {
81
+ return null;
82
+ }
80
83
  if (getIsEffectiveTime(CACHES[key].time)) {
81
84
  return CACHES[key].data;
82
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/core",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "scripts": {
5
5
  "build": "father build",
6
6
  "dev": "father dev",