Skip to content

feat(viewer): enable persistent label caching in the online file viewer - #302

Open
utkarshpatwa393-sys wants to merge 1 commit into
apple:mainfrom
utkarshpatwa393-sys:feat/online-label-cache
Open

utkarshpatwa393-sys wants to merge 1 commit into
apple:mainfrom
utkarshpatwa393-sys:feat/online-label-cache

Conversation

@utkarshpatwa393-sys

Copy link
Copy Markdown

Closes #169

Summary

  • Add createBrowserCache, createMemoryCache, and datasetCacheNamespace in packages/viewer/src/utils/browser_cache.ts (IndexedDB-backed bounded LRU cache with an in-memory mirror/fallback when IndexedDB is unavailable or blocked).
  • Wire cache into FileViewer.svelte so the online "Load Data" viewer reuses cached cluster labels:
    • Datasets with precomputed projections use createBrowserCache(datasetCacheNamespace(inputs)), scoping entries by URL or file metadata (name, size, lastModified) so distinct datasets loading into table "dataset" do not collide.
    • Datasets whose projection is computed in-browser use createMemoryCache() for the active session so layout switches/remounts avoid recomputation without persisting labels from one UMAP run to a future run.
  • Default EmbeddingAtlasStore.chartContext.persistentCache to createMemoryCache() when options.cache is omitted so embedded instances also reuse cached labels within a session.

Verification

  • npm run test -w @embedding-atlas/utils -w @embedding-atlas/viewer (@embedding-atlas/utils: 124 passed; @embedding-atlas/viewer: 149 passed including 5 new tests in packages/viewer/test/browser_cache.test.ts)
  • npx prettier -c . (all matched files pass)
  • npm run test:versions (all versions match 0.26.0)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

performance : allow to have labels in cache

1 participant