Retrieves data from cache with freshness information.
The path to retrieve.
CacheResult with freshness info, or null if not cached.
Invalidates cache for a specific path or clears entire cache. Called by file operations that modify directory contents (mkdir, touch, rm, upload).
Optionalpath: string
Optional specific path to invalidate. If omitted, clears entire cache.
Invalidates a path and every cached listing beneath it. Called by operations that remove or replace an entire directory tree (rm -r, a directory re-upload): nested listings cached before the mutation would otherwise serve the old tree's contents until their TTL expires, with no refresh hint.
Root of the subtree to invalidate. The entry for the path
itself is removed along with all entries under path + '/'.
Stores data in cache with optional TTL override.
The path to cache.
The data to cache.
Optionaloptions: CacheOptions
Optional TTL and dirty flag.
Registers a callback for checkpoint-worthy mutations (set, update, dirty, invalidate).
Callback invoked after a mutation.
Function that unregisters the callback.
The folder record kept for a path, while its listing's TTL holds.
The folder's path.
The lookup's promise, or null when none is kept or it expired.
Keeps a folder lookup for a path, under the listing's own TTL (one clock). A lookup that rejects is forgotten as it settles: a failure is not an answer. One that answers no folder is an answer and is kept like any other: a shared feed's logical path has no folder of its own, and every resolver, check and listing asked CUBE so again. A folder made here invalidates its parent, which drops the misses kept for it and every folder above; one made elsewhere is seen when the TTL runs out, as a listing's change is.
The folder's path.
The lookup under way.
How many folder records are kept (for a readout or a test).
Every path the cache currently holds.
Returned as a snapshot so a caller may mark or invalidate while iterating without mutating the map underneath itself.
The cached paths, least recently used first.
Creates a persistence-safe copy of every entry, oldest first.
The snapshot.
Merges a snapshot's entries into the cache, keeping their original timestamps: what was stale stays stale and is revalidated on its next visit. A path already cached in this process is newer than anything on disk and is kept as is. Entries beyond the LRU bound are dropped oldest-first.
A validated snapshot.
The invalidation count now, taken before a fetch and handed back to
cache_set as since.
A stamp.
Gets cache statistics.
Cache statistics including hits, misses, and current state.
Resets cache statistics. Useful for testing and monitoring.
Staticinstance_
Singleton cache for directory listings with TTL and dirty tracking.
Generic cache that stores any data type keyed by path. Eliminates redundant API calls by caching directory contents after ls operations.
Enhanced features:
Usage: