(set: Set<any>, key: any, expire: number)
| 14 | export const cache = { |
| 15 | // 存入缓存并设置过期时间 |
| 16 | set(set: Set<any>, key: any, expire: number) { |
| 17 | // 如果禁用缓存,则不执行任何操作 |
| 18 | if (!config.useCache) return; |
| 19 | |
| 20 | set.add(key); |
| 21 | if (expire >= 0) { |
| 22 | setTimeout(() => set.delete(key), expire); |
| 23 | } |
| 24 | }, |
| 25 | |
| 26 | // local 系列为特化的缓存方法,用于操作翻译缓存 |
| 27 | localSet(key: string, value: string) { |
nothing calls this directly
no outgoing calls
no test coverage detected