Documentation
¶
Overview ¶
Package filecache stores fetched full-file contents (the context view's raw material) under the XDG cache directory. Entries are keyed by content identity — a git blob hash, or a PR head commit plus path — so a file that changes upstream simply produces a new key and the stale entry ages out; nothing ever needs to be invalidated in place.
Index ¶
Constants ¶
const ( MaxAge = 14 * 24 * time.Hour MaxBytes = 50 << 20 // 50 MiB )
Cleanup limits. Both are enforced on every Open: entries older than MaxAge are dropped, then the oldest survivors are dropped until the total is under MaxBytes — whichever constraint bites first, bites.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a directory of content-addressed files.
func Open ¶
Open resolves the default cache directory ($XDG_CACHE_HOME/leanreview/files, ~/.cache fallback) and runs cleanup. Errors are returned rather than tolerated: a broken cache dir should disable caching loudly at the one caller, not fail on every Put.
func OpenAt ¶
OpenAt opens (creating if needed) a cache rooted at dir and runs cleanup. Split from Open so tests can point it at a temp directory.