(key: T, value: SystemConfigValueType<T> | undefined)
| 190 | } |
| 191 | |
| 192 | private _set<T extends SystemConfigKey>(key: T, value: SystemConfigValueType<T> | undefined) { |
| 193 | const prev = this.cache.get(key); |
| 194 | const storage = this.getStorage(key); |
| 195 | let asyncOp; |
| 196 | if (value === undefined) { |
| 197 | this.cache.delete(key); |
| 198 | asyncOp = storage.remove(key); |
| 199 | } else { |
| 200 | this.cache.set(key, value); |
| 201 | asyncOp = storage.set(key, value); |
| 202 | } |
| 203 | asyncOp.then(() => { |
| 204 | // 发送消息通知更新 |
| 205 | this.mq.publish<TKeyValue<T>>(SystemConfigChange, { |
| 206 | key, |
| 207 | value, |
| 208 | prev, |
| 209 | }); |
| 210 | }); |
| 211 | } |
| 212 | |
| 213 | defaultCheckScriptUpdateCycle() { |
| 214 | return 86400; |
no test coverage detected