Expand description
Shared LRU cache of folder metadata (parent id, name, is_folder) used to
resolve withParent / withPath listing options and bounded parent-chain
walks without recursive SQL. The cache holds folder rows only.
Tenant safety invariants:
- The cache key is
(TnId, file_id). Callers MUST pass the requesting tenant’sTnId; never look up byfile_idalone. - On insert, the
TnIdrecorded MUST be the tenant that owns the row that produced the entry. Never insert a row read from a different tenant under the requestor’sTnId. - Entries store only
parent_id,name, andis_folder. They do NOT cache access control. ACL checks happen at the call site, not via the cache.
Structs§
- DirCache
- Process-wide LRU cache shared across all tenants. The
TnIdin the key prevents cross-tenant leakage even whenfile_ids collide. - DirEntry
Functions§
- new_
dir_ cache - Construct the process-wide folder-metadata cache with the default capacity. Capacity is fixed for now (~1k entries ≈ ~150 KB shared across tenants).