@midwayjs/cache-manager 3.15.2 → 3.15.6
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/dist/configuration.js +5 -4
- package/package.json +5 -5
package/dist/configuration.js
CHANGED
|
@@ -28,16 +28,17 @@ let CacheConfiguration = class CacheConfiguration {
|
|
|
28
28
|
}
|
|
29
29
|
return {
|
|
30
30
|
around: async (joinPoint) => {
|
|
31
|
+
let cacheKey = metadata.cacheKey;
|
|
31
32
|
const cachingInstance = this.cacheService.get(metadata.cacheInstanceName);
|
|
32
|
-
if (typeof
|
|
33
|
-
|
|
33
|
+
if (typeof cacheKey === 'function') {
|
|
34
|
+
cacheKey = await cacheKey({
|
|
34
35
|
methodArgs: joinPoint.args,
|
|
35
36
|
ctx: joinPoint.target[core_1.REQUEST_OBJ_CTX_KEY],
|
|
36
37
|
target: joinPoint.target,
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
|
-
if (typeof
|
|
40
|
-
return cachingInstance.methodWrap(
|
|
40
|
+
if (typeof cacheKey === 'string') {
|
|
41
|
+
return cachingInstance.methodWrap(cacheKey, joinPoint.proceed, joinPoint.args, metadata.ttl);
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
44
|
return joinPoint.proceed(...joinPoint.args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/cache-manager",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.6",
|
|
4
4
|
"description": "midway cache manager",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"node": ">=12"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@midwayjs/core": "^3.15.
|
|
32
|
-
"@midwayjs/mock": "^3.15.
|
|
33
|
-
"@midwayjs/redis": "^3.15.
|
|
31
|
+
"@midwayjs/core": "^3.15.6",
|
|
32
|
+
"@midwayjs/mock": "^3.15.6",
|
|
33
|
+
"@midwayjs/redis": "^3.15.6",
|
|
34
34
|
"cache-manager-ioredis-yet": "1.2.2"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"lodash.clonedeep": "4.5.0",
|
|
38
38
|
"lru-cache": "7.18.3"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "b04e58d015b8f4ffb48c98ad72180d88c70011e5"
|
|
41
41
|
}
|