MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / clearAll

Method clearAll

src/cache/CacheManager.ts:114–143  ·  view source on GitHub ↗

* Clear all registered caches in priority order. * Lower priority values are cleared first. * @param options Optional configuration

(options: ClearAllOptions = {})

Source from the content-addressed store, hash-verified

112 * @param options Optional configuration
113 */
114 clearAll(options: ClearAllOptions = {}): void {
115 // Guard against re-entry (some clear functions might trigger events)
116 if (this.isClearing) {
117 appLogger.warn('[CacheManager] clearAll already in progress, skipping');
118 return;
119 }
120
121 this.isClearing = true;
122 const startTime = performance.now();
123
124 try {
125 // Build sorted list respecting priorities and dependencies
126 const sortedEntries = this.topologicalSort(options);
127
128 // Clear each cache, catching errors to ensure all caches get cleared
129 for (const entry of sortedEntries) {
130 try {
131 entry.clear();
132 } catch (err) {
133 appLogger.error(`[CacheManager] Error clearing "${entry.name}":`, err);
134 // Continue clearing other caches
135 }
136 }
137
138 const elapsed = performance.now() - startTime;
139 appLogger.info(`[CacheManager] Cleared ${sortedEntries.length} caches in ${elapsed.toFixed(1)}ms`);
140 } finally {
141 this.isClearing = false;
142 }
143 }
144
145 /**
146 * Clear specific caches by name.

Callers 2

clearAllCachesFunction · 0.80

Calls 2

topologicalSortMethod · 0.95
clearMethod · 0.65

Tested by

no test coverage detected