The neo-ui-framework implements a client-side caching mechanism using an in-memory DataLoader service. This service caches API responses based on unique keys derived from the request parameters (token, share ID, page number, etc.). The caching strategy for the data corpus (Files) is primarily on-demand (lazy loading) and page-based, rather than pre-fetching the entire dataset.
Answer: No.
- Mechanism: The application does not fetch the list of all files at application startup or when the session is restored.
- Evidence:
- The
fetchSystemDatafunction inNeoApiService(used during initialization) explicitly returnsfiles: nulland does not invoke the file search/list endpoints. - File data is only requested when
handleSelectFilesShareis triggered, typically via user interaction (selecting a share or the "All shares" view). - Even when triggered, the request is specific to a page (defaulting to page 1) and a page size (default 100). There is no loop or background process to iterate through all pages and cache them.
- The
Answer: No, it strictly caches individual pages.
- Mechanism: The interface caches the results of specific pagination requests. It does not cache the "full" list of all files unless the user manually navigates to every single page.
- Behavior:
- When a user visits Page 1, the response for Page 1 is cached.
- When the user navigates to Page 2, a new request is made and cached.
- If the user navigates back to Page 1, the cached response is used (provided it hasn't expired or been evicted).
- The
DataLoaderkey for file lists includes the page numberpageandpageSize, ensuring unique cache entries for each slice of data (e.g.,files:token:shareId:1:100).
Answer: No.
- Mechanism: The pagination list endpoints (
/filesor/search/files) return an array ofFileEntryobjects. - Data Structure:
- The
FileEntryinterface contains metadata such as filename, path, size, file type, and timestamps. - It does not contain the actual file content (text or bytes).
- The
- Content Retrieval: File content is only fetched when specifically requested via
getFileMetadata(which returnsFileMetadataResponse), and this is a separate cache entry (fileMetadata:token:shareId:fileId).
- Implementation:
src/services/data-loader.ts - Strategy: In-memory LRU (Least Recently Used) cache.
- TTL (Time To Live): Defaults to 30 seconds for general data, but
filesTtl(configurable, default 10 minutes) is used for file-related requests. - Eviction: Based on entry size and a maximum cache size limit (default 100MB).
- File List: Returns
FilesResponse { files: FileEntry[], ... }.FileEntryfields:id,file_path,filename,size,created_at,modified_time,accessed_at,is_directory,file_type.
- File Content: Returns
FileMetadataResponse.- Fields:
content,content_chunks, plus metadata.
- Fields: