Skip to main content

Module dir_cache

Module dir_cache 

Source
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’s TnId; never look up by file_id alone.
  • On insert, the TnId recorded MUST be the tenant that owns the row that produced the entry. Never insert a row read from a different tenant under the requestor’s TnId.
  • Entries store only parent_id, name, and is_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 TnId in the key prevents cross-tenant leakage even when file_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).