feat(mobile): in-memory attachment cache by handle id

This commit is contained in:
byGalax
2026-05-14 00:16:49 +02:00
parent 8b7b6a3b0f
commit 415fa10ed0
+18
View File
@@ -0,0 +1,18 @@
// Module-level memo of decrypted-attachment data URLs by handle id.
// Survives screen unmounts (e.g. user pops in and out of a conversation)
// but evicts on app restart — good enough for Phase 2; an LRU + disk
// cache is a later polish.
const cache = new Map<string, string>();
export function getCachedAttachment(id: string): string | undefined {
return cache.get(id);
}
export function setCachedAttachment(id: string, dataUrl: string): void {
cache.set(id, dataUrl);
}
export function clearAttachmentCache(): void {
cache.clear();
}