MCPcopy Index your code
hub / github.com/omkarcloud/botasaurus / clear

Method clear

js/botasaurus-js/src/cache.ts:214–231  ·  view source on GitHub ↗
(func?: Function | string)

Source from the content-addressed store, hash-verified

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);

Callers 4

cleanupFunction · 0.45
playwright.tsFile · 0.45
cleanupFunction · 0.45

Calls 3

getFnNameFunction · 0.85
joinMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected