@steedos/service-cachers-manager 2.2.52 → 2.2.53-beta.2

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 +3 -3
  2. package/package.service.js +30 -3
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@steedos/service-cachers-manager",
3
- "version": "2.2.52",
3
+ "version": "2.2.53-beta.2",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "dependencies": {
8
- "@steedos/cachers": "2.2.52"
8
+ "@steedos/cachers": "2.2.53-beta.2"
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
- "gitHead": "1447c9ca4fb57a49233704f50a7d757aff0c5027"
13
+ "gitHead": "d6d2230d72af49a72fc546093b553463cd2f0e9d"
14
14
  }
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * @Author: baozhoutao@steedos.com
3
3
  * @Date: 2022-03-28 09:35:35
4
- * @LastEditors: baozhoutao@steedos.com
5
- * @LastEditTime: 2022-06-18 09:56:56
4
+ * @LastEditors: sunhaolin@hotoa.com
5
+ * @LastEditTime: 2022-07-07 10:17:46
6
6
  * @Description: 维护内存缓存
7
7
  */
8
8
  "use strict";
@@ -10,6 +10,7 @@ const project = require('./package.json');
10
10
  const serviceName = project.name;
11
11
  const core = require('@steedos/core');
12
12
  const cachers = require('@steedos/cachers');
13
+ const auth = require('@steedos/auth')
13
14
  /**
14
15
  * @typedef {import('moleculer').Context} Context Moleculer's Context
15
16
  * 软件包服务启动后也需要抛出事件。
@@ -56,7 +57,33 @@ module.exports = {
56
57
  handler(ctx){
57
58
  this.loadActionTriggers(ctx.broker);
58
59
  }
59
- }
60
+ },
61
+ /**
62
+ * userSession支持实时更新
63
+ * 当space_users属性值发生变更后清除userSession缓存
64
+ */
65
+ "@space_users.updated": {
66
+ handler(ctx){
67
+ const params = ctx.params
68
+ const operationType = params.operationType
69
+ if (operationType === 'AFTER_UPDATE') {
70
+ auth.deleteSpaceUserSessionCacheByChangedProp(params.new[0], params.old[0])
71
+ }
72
+ }
73
+ },
74
+ /**
75
+ * userSession支持实时更新
76
+ * 当spaces属性值发生变更后清除spaces缓存
77
+ */
78
+ "@spaces.updated": {
79
+ handler(ctx){
80
+ const params = ctx.params
81
+ const operationType = params.operationType
82
+ if (operationType === 'AFTER_UPDATE') {
83
+ auth.deleteSpaceCacheByChangedProp(params.new[0], params.old[0])
84
+ }
85
+ }
86
+ },
60
87
  },
61
88
 
62
89
  async started() {