minor fix to invalidate cache logic

This commit is contained in:
chrisk325 2026-03-06 13:43:04 +05:30 committed by GitHub
parent a64d5ac910
commit 6e7a121be0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,8 +14,8 @@ interface CacheEntry {
} }
export class TrailerService { export class TrailerService {
// Cache for 3 minutes — just enough to avoid re-extracting on quick re-renders // Cache for 5 seconds — just enough to avoid re-extracting on quick re-renders
private static readonly CACHE_TTL_MS = 30 * 1000; private static readonly CACHE_TTL_MS = 5 * 1000;
private static urlCache = new Map<string, CacheEntry>(); private static urlCache = new Map<string, CacheEntry>();
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -114,6 +114,11 @@ export class TrailerService {
return { url, title, year }; return { url, title, year };
} }
static invalidateCache(videoId: string): void {
this.urlCache.delete(videoId);
logger.info('TrailerService', `Cache invalidated for videoId=${videoId}`);
}
static setUseLocalServer(_useLocal: boolean): void {} static setUseLocalServer(_useLocal: boolean): void {}
static getServerStatus(): { usingLocal: boolean; localUrl: string } { static getServerStatus(): { usingLocal: boolean; localUrl: string } {