Skip to main content

Module file_state_cache

Module file_state_cache 

Source
Expand description

File state cache utilities Translated from /data/home/swei/claudecode/openclaudecode/src/utils/fileStateCache.ts

Structs§

FileState
File state representing cached file content
FileStateCache
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