MCPcopy
hub / github.com/callumalpass/tasknotes / refreshCache

Method refreshCache

src/main.ts:1386–1412  ·  view source on GitHub ↗

* Refreshes the TaskNotes cache by clearing all cached data and re-initializing

()

Source from the content-addressed store, hash-verified

1384 * Refreshes the TaskNotes cache by clearing all cached data and re-initializing
1385 */
1386 async refreshCache(): Promise<void> {
1387 try {
1388 // Show loading notice
1389 const loadingNotice = new Notice("Refreshing tasknotes cache...", 0);
1390
1391 // Clear all caches
1392 await this.cacheManager.clearAllCaches();
1393
1394 // Notify all views to refresh
1395 this.notifyDataChanged(undefined, true, true);
1396 this.emitter.trigger(TASKNOTES_RUNTIME_LIFECYCLE_RAW_EVENTS["cache.rebuilt"], {
1397 force: true,
1398 timestamp: new Date().toISOString(),
1399 });
1400
1401 // Hide loading notice and show success
1402 loadingNotice.hide();
1403 new Notice("Tasknotes cache refreshed successfully");
1404 } catch (error) {
1405 tasknotesLogger.error("Error refreshing cache:", {
1406 category: "stale-data",
1407 operation: "refreshing-cache",
1408 error: error,
1409 });
1410 new Notice("Failed to refresh cache. Please try again.");
1411 }
1412 }
1413
1414 /**
1415 * Convert any checkbox task on current line to TaskNotes task

Callers 1

Calls 5

notifyDataChangedMethod · 0.95
clearAllCachesMethod · 0.80
errorMethod · 0.80
triggerMethod · 0.65
hideMethod · 0.45

Tested by

no test coverage detected