| 85 | * @template T 缓存的数据类型 |
| 86 | */ |
| 87 | export interface ICachedStore<T> extends IResettable { |
| 88 | /** |
| 89 | * 加载数据到缓存 |
| 90 | * 如果已缓存则直接返回,否则从数据库加载 |
| 91 | */ |
| 92 | load(key: string): Promise<T> |
| 93 | |
| 94 | /** |
| 95 | * 从缓存获取数据(不触发加载) |
| 96 | */ |
| 97 | get(key: string): T | undefined |
| 98 | |
| 99 | /** |
| 100 | * 检查是否已缓存 |
| 101 | */ |
| 102 | has(key: string): boolean |
| 103 | |
| 104 | /** |
| 105 | * 清除指定缓存 |
| 106 | */ |
| 107 | evict(key: string): void |
| 108 | |
| 109 | /** |
| 110 | * 清除所有缓存 |
| 111 | */ |
| 112 | evictAll(): void |
| 113 | } |
no outgoing calls
no test coverage detected