Expand description
File state cache utilities Translated from /data/home/swei/claudecode/openclaudecode/src/utils/fileStateCache.ts
Structs§
- File
State - File state representing cached file content
- File
State Cache - A file state cache that normalizes all path keys before access. This ensures consistent cache hits regardless of whether callers pass relative vs absolute paths with redundant segments (e.g. /foo/../bar) or mixed path separators on Windows (/ vs ).
Constants§
- DEFAULT_
MAX_ CACHE_ SIZE_ BYTES - Default size limit for file state caches (25MB) This prevents unbounded memory growth from large file contents
- READ_
FILE_ STATE_ CACHE_ SIZE - Default max entries for read file state caches
Functions§
- cache_
keys - Helper function to get all keys from cache (used by several components)
- cache_
to_ object - Helper function to convert cache to object (used by compact.rs)
- clone_
file_ state_ cache - Helper function to clone a FileStateCache Preserves size limit configuration from the source cache
- create_
file_ state_ cache_ with_ size_ limit - Factory function to create a size-limited FileStateCache. Uses LRU cache’s built-in size-based eviction to prevent memory bloat. Note: Images are not cached (see FileReadTool) so size limit is mainly for large text files, notebooks, and other editable content.
- merge_
file_ state_ caches - Merge two file state caches, with more recent entries (by timestamp) overriding older ones