feat(mobile): in-memory attachment cache by handle id
This commit is contained in:
@@ -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();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user