mm_cache 1.4.6 → 1.4.8

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/index.js +5 -4
  2. package/package.json +3 -3
package/index.js CHANGED
@@ -113,6 +113,7 @@ Cache.prototype.getCacheWay = function () {
113
113
  return this.config.way;
114
114
  };
115
115
 
116
+
116
117
  /**
117
118
  * @description 连接缓存数据库
118
119
  * @return {Promise<Boolean>} 是否连接成功
@@ -135,7 +136,7 @@ Cache.prototype.connect = async function () {
135
136
  } catch (e) {
136
137
  $.log.warn('[Cache] [connect] Cache模块加载失败,回退到memory:', e.message);
137
138
  this.config.way = 'memory';
138
- await this._clientect(); // 递归调用,使用memory
139
+ await this.connect(); // 递归调用,使用memory
139
140
  return false;
140
141
  }
141
142
  break;
@@ -152,7 +153,7 @@ Cache.prototype.connect = async function () {
152
153
  } catch (e) {
153
154
  $.log.warn('[Cache] [connect] MongoDB模块加载失败,回退到memory:', e.message);
154
155
  this.config.way = 'memory';
155
- await this._clientect(); // 递归调用,使用cachebase memory
156
+ await this.connect(); // 递归调用,使用cachebase memory
156
157
  return false;
157
158
  }
158
159
  break;
@@ -203,7 +204,7 @@ Cache.prototype.switchCache = async function (way, config) {
203
204
  if (config) {
204
205
  this.config[way] = Object.assign(this.config[way], config);
205
206
  }
206
- return await this._clientect();
207
+ return await this.connect();
207
208
  }
208
209
  return false;
209
210
  };
@@ -245,7 +246,7 @@ Cache.prototype.has = async function (key) {
245
246
  Cache.prototype._safeCall = async function (method, args = []) {
246
247
  if (!this._client) {
247
248
  // 如果未连接,自动尝试连接
248
- await this._clientect();
249
+ await this.connect();
249
250
  if (!this._client) {
250
251
  $.log.error('[Cache] [_safeCall] 数据库未初始化');
251
252
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_cache",
3
- "version": "1.4.6",
3
+ "version": "1.4.8",
4
4
  "description": "一个统一的缓存操作框架,为多种缓存方式(Redis、MongoDB、CacheBase、Memory)提供统一的API接口,实现无缝切换和兼容",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "homepage": "https://gitee.com/qiuwenwu/mm_cache#readme",
32
32
  "dependencies": {
33
- "mm_cachebase": "^1.9.6",
34
- "mm_mongodb": "^1.5.5",
33
+ "mm_cachebase": "^1.9.7",
34
+ "mm_mongodb": "^1.5.6",
35
35
  "mm_redis": "^2.1.1"
36
36
  }
37
37
  }