@steedos/service-cachers-manager 2.2.41
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/LICENSE.txt +25 -0
- package/package.json +11 -0
- package/package.service.js +67 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Steedos Licensing
|
|
2
|
+
|
|
3
|
+
SOFTWARE LICENSING
|
|
4
|
+
|
|
5
|
+
To determine under which license you may use a file from the Steedos source code,
|
|
6
|
+
please resort to the header of that file.
|
|
7
|
+
|
|
8
|
+
If the file has no header, the following rules apply
|
|
9
|
+
1. project templates are licensed under MIT, see License.MIT.txt
|
|
10
|
+
2. enterprise features are licensed under Steedos Enterprise Terms, see License.enterprise.txt
|
|
11
|
+
3. source code that is neither (1) nor (2) is licensed under AGPL, see License.AGPL.txt
|
|
12
|
+
|
|
13
|
+
On request, licenses under different terms are available.
|
|
14
|
+
|
|
15
|
+
Project templates can be found in the folders steedos-projects/
|
|
16
|
+
|
|
17
|
+
Source code of enterprise features are files that
|
|
18
|
+
* are in folders named "ee" or start with "ee_", or in subfolders of such folders.
|
|
19
|
+
* contain the strings "ee_" in its filename name.
|
|
20
|
+
The files can be found by running the command `find . -iname ee -or -iname "*_ee*" -or -iname "*ee_*"`
|
|
21
|
+
|
|
22
|
+
STEEDOS TRADEMARK GUIDELINES
|
|
23
|
+
|
|
24
|
+
Your use of the mark Steedos is subject to Steedos, Inc's prior written approval. For trademark approval or any questions
|
|
25
|
+
you have about using these trademarks, please email zhuangjianguo@steedos.com
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-03-28 09:35:35
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2022-06-11 16:46:51
|
|
6
|
+
* @Description: 维护内存缓存
|
|
7
|
+
*/
|
|
8
|
+
"use strict";
|
|
9
|
+
const project = require('./package.json');
|
|
10
|
+
const serviceName = project.name;
|
|
11
|
+
const core = require('@steedos/core');
|
|
12
|
+
const cachers = require('@steedos/cachers');
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {import('moleculer').Context} Context Moleculer's Context
|
|
15
|
+
* 软件包服务启动后也需要抛出事件。
|
|
16
|
+
*/
|
|
17
|
+
module.exports = {
|
|
18
|
+
name: serviceName,
|
|
19
|
+
namespace: "steedos",
|
|
20
|
+
/**
|
|
21
|
+
* Settings
|
|
22
|
+
*/
|
|
23
|
+
settings: {
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Dependencies
|
|
28
|
+
*/
|
|
29
|
+
dependencies: [],
|
|
30
|
+
methods: {
|
|
31
|
+
loadActionTriggers: async function (broker) {
|
|
32
|
+
const cache = cachers.getCacher('action-triggers');
|
|
33
|
+
broker.call('triggers.getAll').then((res)=>{
|
|
34
|
+
cache.set('triggerActions', res);
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Events
|
|
41
|
+
*/
|
|
42
|
+
events: {
|
|
43
|
+
"translations.change": {
|
|
44
|
+
handler() {
|
|
45
|
+
core.loadTranslations()
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"translations.object.change": {
|
|
49
|
+
handler() {
|
|
50
|
+
core.loadObjectTranslations().then(()=>{
|
|
51
|
+
cachers.getCacher('lru.translations.objects').clear();
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"triggers.change": {
|
|
56
|
+
handler(ctx){
|
|
57
|
+
this.loadActionTriggers(ctx.broker);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
async started() {
|
|
63
|
+
core.loadTranslations();
|
|
64
|
+
core.loadObjectTranslations();
|
|
65
|
+
this.loadActionTriggers(this.broker);
|
|
66
|
+
},
|
|
67
|
+
};
|