Files
Artstr-Studio/src
thePR0M3TH3AN 5f2f057e52 Linked Designs P3c: localStorage disk cache
Mirror the in-memory resolver cache to localStorage so cold reloads
paint linked sources without a relay round-trip. 24-hour TTL keeps
return visits feeling instant while still propagating source edits
within a day; 4 MB LRU eviction stops a host with many linked
layers from blowing the quota.

Storage shape (artstr.linkedDesignCache.v1):

  { version: 1,
    entries: {
      [cacheKey]: { sourceEvent, fetchedAt }
    }
  }

The disk cache stores only the raw sourceEvent — premium / private
detection, vault lookup, and decrypt all re-run on every read via
the extracted _entryFromEvent helper. That means vault state,
sign-in changes, and unlocks since the last fetch are always
respected on disk-cache hits; we never serve stale "locked" state
once the user has unlocked, or stale "unlocked" state once they
clear the vault.

Refresh + Unlink continue to be the user's escape hatch:
clearCache(key) now wipes both the in-memory entry AND the disk
entry, so a manual refresh genuinely re-fetches from relays.

Eviction is LRU by fetchedAt when total content bytes exceed
LINKED_DESIGN_DISK_MAX_BYTES. Quota errors on save drop the whole
cache and continue — better to lose the optimization than to break
publishing for an unrelated localStorage write.
2026-05-31 22:12:59 -04:00
..
2026-05-26 16:13:06 -04:00
2026-05-20 22:06:50 -04:00
2026-05-26 16:13:06 -04:00