feat(perf): add LRU cache for file metadata#41
Open
BandiAkarsh wants to merge 1 commit into
Open
Conversation
Following maintainer approach - PR B Changes: - Add cache.rs with LRU cache implementation (no dead_code) - Wire cache into fs stat command - Register cache in app state (10,000 entries) - Add lru = 0.12 dependency to Cargo.toml The cache is integrated into the stat command: - Checks cache first for O(1) lookup - On miss, fetches from filesystem and caches result - Reduces repeated stat() calls for the same files
73a6477 to
fd1ad3f
Compare
BandiAkarsh
added a commit
to BandiAkarsh/sidex
that referenced
this pull request
Apr 22, 2026
- Add cache_invalidate command for frontend to call when files change - Emit cache-invalidate event from watch.rs when files are modified/created/deleted - Wire cache into file watcher for proper invalidation Following maintainer feedback from PR Sidenai#41 review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Following maintainer approach - PR B
This PR adds an LRU cache for file metadata to improve stat command performance.
Changes
Added
src-tauri/src/commands/cache.rs- LRU cache implementation (10,000 entries)#![allow(dead_code)]- code is actively usedModified
src-tauri/src/commands/fs.rs- stat command wired to use cachesrc-tauri/src/lib.rs- cache registered in app statesrc-tauri/src/commands/mod.rs- cache module addedsrc-tauri/Cargo.toml- lru = 0.12 dependencyHow It Works
The cache is integrated into the
statcommand:Performance Impact
Note
This is following the maintainer's suggested approach: