From 5971f0976a5e8316b3c313a3a17078063c92ff14 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Tue, 29 Jul 2025 20:37:47 -0600 Subject: [PATCH] chore: Comment out the unused caching utilities (so they're not mistakenly used). --- src/utils/PlatformServiceMixin.ts | 194 +++++++++++++++--------------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/src/utils/PlatformServiceMixin.ts b/src/utils/PlatformServiceMixin.ts index d0993048..d622d00f 100644 --- a/src/utils/PlatformServiceMixin.ts +++ b/src/utils/PlatformServiceMixin.ts @@ -59,14 +59,14 @@ import { // TYPESCRIPT INTERFACES // ================================================= -/** - * Cache entry interface for storing data with TTL - */ -interface CacheEntry { - data: T; - timestamp: number; - ttl: number; // milliseconds -} +// /** +// * Cache entry interface for storing data with TTL +// */ +// interface CacheEntry { +// data: T; +// timestamp: number; +// ttl: number; // milliseconds +// } /** * Vue component interface that uses the PlatformServiceMixin @@ -79,21 +79,21 @@ interface VueComponentWithMixin { platformService(): PlatformService; } -/** - * Global cache store for mixin instances - * Uses WeakMap to avoid memory leaks when components are destroyed - */ -const componentCaches = new WeakMap< - VueComponentWithMixin, - Map> ->(); - -/** - * Cache configuration constants - */ -const CACHE_DEFAULTS = { - default: 15000, // 15 seconds default TTL -} as const; +// /** +// * Global cache store for mixin instances +// * Uses WeakMap to avoid memory leaks when components are destroyed +// */ +// const componentCaches = new WeakMap< +// VueComponentWithMixin, +// Map> +// >(); +// +// /** +// * Cache configuration constants +// */ +// const CACHE_DEFAULTS = { +// default: 15000, // 15 seconds default TTL +// } as const; const _memoryLogs: string[] = []; @@ -203,8 +203,8 @@ export const PlatformServiceMixin = { logger.debug( `[PlatformServiceMixin] ActiveDid updated from ${oldDid} to ${newDid}`, ); - // Clear caches that might be affected by the change - this.$clearAllCaches(); + // // Clear caches that might be affected by the change + // this.$clearAllCaches(); } }, @@ -256,71 +256,71 @@ export const PlatformServiceMixin = { return (value as T) || defaultValue; }, - // ================================================= - // CACHING UTILITY METHODS - // ================================================= - - /** - * Get or initialize cache for this component instance - */ - _getCache(): Map> { - let cache = componentCaches.get(this as unknown as VueComponentWithMixin); - if (!cache) { - cache = new Map(); - componentCaches.set(this as unknown as VueComponentWithMixin, cache); - } - return cache; - }, - - /** - * Check if cache entry is valid (not expired) - */ - _isCacheValid(entry: CacheEntry): boolean { - return Date.now() - entry.timestamp < entry.ttl; - }, - - /** - * Get data from cache if valid, otherwise return null - */ - _getCached(key: string): T | null { - const cache = this._getCache(); - const entry = cache.get(key); - if (entry && this._isCacheValid(entry)) { - return entry.data as T; - } - cache.delete(key); // Clean up expired entries - return null; - }, - - /** - * Store data in cache with TTL - */ - _setCached(key: string, data: T, ttl?: number): T { - const cache = this._getCache(); - const actualTtl = ttl || CACHE_DEFAULTS.default; - cache.set(key, { - data, - timestamp: Date.now(), - ttl: actualTtl, - }); - return data; - }, - - /** - * Invalidate specific cache entry - */ - _invalidateCache(key: string): void { - const cache = this._getCache(); - cache.delete(key); - }, - - /** - * Clear all cache entries for this component - */ - _clearCache(): void { - const cache = this._getCache(); - cache.clear(); - }, + // // ================================================= + // // CACHING UTILITY METHODS + // // ================================================= + + // /** + // * Get or initialize cache for this component instance + // */ + // _getCache(): Map> { + // let cache = componentCaches.get(this as unknown as VueComponentWithMixin); + // if (!cache) { + // cache = new Map(); + // componentCaches.set(this as unknown as VueComponentWithMixin, cache); + // } + // return cache; + // }, + + // /** + // * Check if cache entry is valid (not expired) + // */ + // _isCacheValid(entry: CacheEntry): boolean { + // return Date.now() - entry.timestamp < entry.ttl; + // }, + + // /** + // * Get data from cache if valid, otherwise return null + // */ + // _getCached(key: string): T | null { + // const cache = this._getCache(); + // const entry = cache.get(key); + // if (entry && this._isCacheValid(entry)) { + // return entry.data as T; + // } + // cache.delete(key); // Clean up expired entries + // return null; + // }, + + // /** + // * Store data in cache with TTL + // */ + // _setCached(key: string, data: T, ttl?: number): T { + // const cache = this._getCache(); + // const actualTtl = ttl || CACHE_DEFAULTS.default; + // cache.set(key, { + // data, + // timestamp: Date.now(), + // ttl: actualTtl, + // }); + // return data; + // }, + + // /** + // * Invalidate specific cache entry + // */ + // _invalidateCache(key: string): void { + // const cache = this._getCache(); + // cache.delete(key); + // }, + + // /** + // * Clear all cache entries for this component + // */ + // _clearCache(): void { + // const cache = this._getCache(); + // cache.clear(); + // }, // ================================================= // ENHANCED DATABASE METHODS (with error handling) @@ -872,13 +872,13 @@ export const PlatformServiceMixin = { return await this.$contacts(); }, - /** - * Clear all caches for this component - $clearAllCaches() - * Useful for manual cache management - */ - $clearAllCaches(): void { - this._clearCache(); - }, + // /** + // * Clear all caches for this component - $clearAllCaches() + // * Useful for manual cache management + // */ + // $clearAllCaches(): void { + // this._clearCache(); + // }, // ================================================= // HIGH-LEVEL ENTITY OPERATIONS (eliminate verbose SQL patterns)