MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / registerAllCaches

Function registerAllCaches

src/cache/registerCaches.ts:46–251  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44 * Safe to call multiple times (only registers once).
45 */
46export function registerAllCaches(): void {
47 if (registered) {
48 return;
49 }
50 registered = true;
51
52 // ========================================================================
53 // Priority 0: THREE.Texture objects (must dispose first)
54 // ========================================================================
55
56 CacheManager.register({
57 name: 'frustumTextures',
58 label: 'Frustum Textures',
59 priority: CacheDisposalPriority.TEXTURE,
60 clear: clearFrustumTextureCache,
61 getStats: () => {
62 const stats = getFrustumTextureCacheStats();
63 // Textures: ~65KB each (128px bitmaps)
64 return {
65 count: stats.textures,
66 sizeBytes: stats.textures * 65000,
67 };
68 },
69 strategy: 'lazy',
70 memoryType: 'js',
71 showInStats: true,
72 });
73
74 CacheManager.register({
75 name: 'frustumBitmaps',
76 label: 'Decoded Bitmaps',
77 priority: CacheDisposalPriority.BITMAP,
78 clear: () => {}, // Cleared with frustumTextures
79 getStats: () => {
80 const stats = getFrustumTextureCacheStats();
81 // Bitmaps: ~65KB each (128px)
82 return {
83 count: stats.bitmaps,
84 sizeBytes: stats.bitmaps * 65000,
85 };
86 },
87 strategy: 'lazy',
88 memoryType: 'js',
89 showInStats: true,
90 });
91
92 // ========================================================================
93 // Priority 20: Blob URLs (revoke after textures release references)
94 // Note: thumbnailCache creates blob URLs from decoded images
95 // ========================================================================
96
97 CacheManager.register({
98 name: 'thumbnails',
99 label: 'Thumbnails',
100 priority: CacheDisposalPriority.BLOB_URL,
101 clear: clearThumbnailCache,
102 getStats: () => {
103 const stats = getThumbnailCacheStats();

Callers 1

main.tsxFile · 0.90

Calls 7

getThumbnailCacheStatsFunction · 0.90
getActiveZipStatsFunction · 0.85
registerMethod · 0.80
resetMethod · 0.80
getRegisteredNamesMethod · 0.80

Tested by

no test coverage detected