@midwayjs/cache-manager 4.0.0-beta.1 → 4.0.0-beta.10

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/README.md CHANGED
@@ -9,4 +9,4 @@ Document: [https://midwayjs.org](https://midwayjs.org)
9
9
 
10
10
  ## License
11
11
 
12
- [MIT]((https://github.com/midwayjs/midway/blob/master/LICENSE))
12
+ [MIT](https://github.com/midwayjs/midway/blob/master/LICENSE)
@@ -5,7 +5,9 @@
5
5
  * for example: add methodWrap
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.multiCaching = exports.createCache = exports.caching = void 0;
8
+ exports.caching = caching;
9
+ exports.createCache = createCache;
10
+ exports.multiCaching = multiCaching;
9
11
  const prmoiseCoalesce_1 = require("./prmoiseCoalesce");
10
12
  const store_1 = require("./store");
11
13
  /**
@@ -22,7 +24,6 @@ async function caching(factory, args) {
22
24
  }
23
25
  return createCache(factory, args);
24
26
  }
25
- exports.caching = caching;
26
27
  /**
27
28
  * Create cache instance by store (non-async).
28
29
  */
@@ -86,7 +87,6 @@ function createCache(store, args) {
86
87
  },
87
88
  };
88
89
  }
89
- exports.createCache = createCache;
90
90
  /**
91
91
  * Module that lets you specify a hierarchy of caches.
92
92
  */
@@ -193,5 +193,4 @@ function multiCaching(caches) {
193
193
  },
194
194
  };
195
195
  }
196
- exports.multiCaching = multiCaching;
197
196
  //# sourceMappingURL=cacheManager.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.coalesceAsync = void 0;
3
+ exports.coalesceAsync = coalesceAsync;
4
4
  const callbacks = new Map();
5
5
  /**
6
6
  * Enqueue a promise for the group identified by `key`.
@@ -34,7 +34,6 @@ fn) {
34
34
  }
35
35
  return enqueue(key);
36
36
  }
37
- exports.coalesceAsync = coalesceAsync;
38
37
  function hasKey(key) {
39
38
  return callbacks.has(key);
40
39
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.memoryStore = void 0;
3
+ exports.memoryStore = memoryStore;
4
4
  const LRUCache = require("lru-cache");
5
5
  const cloneDeep = require("lodash.clonedeep");
6
6
  function clone(object) {
@@ -75,5 +75,4 @@ function memoryStore(args) {
75
75
  load: (...args) => lruCache.load(...args),
76
76
  };
77
77
  }
78
- exports.memoryStore = memoryStore;
79
78
  //# sourceMappingURL=store.js.map
@@ -9,7 +9,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.CacheConfiguration = exports.getClassMethodDefaultCacheKey = void 0;
12
+ exports.CacheConfiguration = void 0;
13
+ exports.getClassMethodDefaultCacheKey = getClassMethodDefaultCacheKey;
13
14
  const core_1 = require("@midwayjs/core");
14
15
  const cacheKey_1 = require("./decorator/cacheKey");
15
16
  const factory_1 = require("./factory");
@@ -20,8 +21,9 @@ function getClassMethodDefaultCacheKey(target, methodName) {
20
21
  '-' +
21
22
  methodName);
22
23
  }
23
- exports.getClassMethodDefaultCacheKey = getClassMethodDefaultCacheKey;
24
24
  let CacheConfiguration = class CacheConfiguration {
25
+ decoratorService;
26
+ cacheService;
25
27
  async onReady(container) {
26
28
  // init factory and caching instance
27
29
  this.cacheService = await container.getAsync(factory_1.CachingFactory);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Caching = exports.CACHE_DECORATOR_KEY = void 0;
3
+ exports.CACHE_DECORATOR_KEY = void 0;
4
+ exports.Caching = Caching;
4
5
  const core_1 = require("@midwayjs/core");
5
6
  exports.CACHE_DECORATOR_KEY = 'cache-manager:caching';
6
7
  function Caching(cacheInstanceName, cacheKeyOrTTL, ttl) {
@@ -14,5 +15,4 @@ function Caching(cacheInstanceName, cacheKeyOrTTL, ttl) {
14
15
  ttl,
15
16
  });
16
17
  }
17
- exports.Caching = Caching;
18
18
  //# sourceMappingURL=cacheKey.js.map
package/dist/factory.js CHANGED
@@ -13,6 +13,8 @@ exports.CachingFactory = void 0;
13
13
  const core_1 = require("@midwayjs/core");
14
14
  const base_1 = require("./base");
15
15
  let CachingFactory = class CachingFactory extends core_1.ServiceFactory {
16
+ cacheManagerConfig;
17
+ applicationContext;
16
18
  async init() {
17
19
  await this.initClients(this.cacheManagerConfig);
18
20
  }
package/dist/store.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRedisStore = void 0;
3
+ exports.createRedisStore = createRedisStore;
4
4
  const core_1 = require("@midwayjs/core");
5
5
  const getVal = (value) => JSON.stringify(value) || '"undefined"';
6
6
  function createRedisStore(instanceName) {
@@ -11,7 +11,6 @@ function createRedisStore(instanceName) {
11
11
  return createStore(redisInstance, options);
12
12
  };
13
13
  }
14
- exports.createRedisStore = createRedisStore;
15
14
  function createStore(redisCache, options) {
16
15
  const isCacheable = options?.isCacheable || (value => value !== undefined && value !== null);
17
16
  const keys = (pattern) => redisCache.keys(pattern);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/cache-manager",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.10",
4
4
  "description": "midway cache manager",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -25,12 +25,12 @@
25
25
  "cache"
26
26
  ],
27
27
  "engines": {
28
- "node": ">=12"
28
+ "node": ">=20"
29
29
  },
30
30
  "devDependencies": {
31
- "@midwayjs/core": "^4.0.0-beta.1",
32
- "@midwayjs/mock": "^4.0.0-beta.1",
33
- "@midwayjs/redis": "^4.0.0-beta.1",
31
+ "@midwayjs/core": "^4.0.0-beta.10",
32
+ "@midwayjs/mock": "^4.0.0-beta.10",
33
+ "@midwayjs/redis": "^4.0.0-beta.10",
34
34
  "cache-manager": "6.0.0",
35
35
  "cache-manager-ioredis-yet": "2.1.2"
36
36
  },
@@ -38,5 +38,5 @@
38
38
  "lodash.clonedeep": "4.5.0",
39
39
  "lru-cache": "7.18.3"
40
40
  },
41
- "gitHead": "832961ec3aff123c033197d8c00cb2bc9bad7ff8"
41
+ "gitHead": "1b1856629913703f67304155aaf611ec936a81ac"
42
42
  }