(func?: Function | string)
| 212 | } |
| 213 | |
| 214 | static clear(func?: Function | string): void { |
| 215 | if (func !== undefined) { |
| 216 | const fnName = getFnName(func); |
| 217 | const fnCacheDir = path.join(Cache.cacheDirectory, fnName);; |
| 218 | const cacheDir = fnCacheDir; |
| 219 | if (fs.existsSync(cacheDir)) { |
| 220 | rmSync(cacheDir, { recursive: true, force: true }); |
| 221 | } |
| 222 | createdFns.delete(fnName); |
| 223 | } else { |
| 224 | const cacheDir = Cache.cacheDirectory; |
| 225 | if (fs.existsSync(cacheDir)) { |
| 226 | rmSync(cacheDir, { recursive: true, force: true }); |
| 227 | } |
| 228 | cacheCheckDone = false; |
| 229 | createdFns.clear(); |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | static async deleteItemsByFilter(func: Function | string, items: any[], shouldDeleteItem: (key: any, data: any) => boolean): Promise<number> { |
| 234 | const testItems = Cache.filterItemsInCache(func, items); |
no test coverage detected