Get returns the cached data for the given key, or nil if not found.
(key string)
| 172 | // at the back. index maps a key to its element for O(1) touch/drop. |
| 173 | order *list.List |
| 174 | index map[string]*list.Element |
| 175 | // summary is enabled only in summary lookup mode. It mirrors index |
| 176 | // mutations incrementally, so snapshot serving never scans the cache index. |
| 177 | summary *summaryIndex |
| 178 | // renameFile is os.Rename in production and a per-cache failure seam in tests. |
| 179 | renameFile func(string, string) error |
| 180 | // removeFile is os.Remove in production and a per-cache failure seam in tests. |
| 181 | removeFile func(string) error |
| 182 | // openScanDirectory is os.Open in production and lets constructor tests |
| 183 | // inject directory-open and mid-scan failures deterministically. |
| 184 | openScanDirectory openCacheDirectory |
| 185 | |
| 186 | // Durable recency is optional for tests and always enabled by main. Exact |
| 187 | // LRU updates remain synchronous; only coarse mtime persistence is queued. |
| 188 | recency *recencyWriter |
| 189 | recencyNow func() time.Time |
| 190 | recencyInterval time.Duration |
| 191 | // commitMu linearizes the short final rename/accounting/recency commit with |
| 192 | // shutdown without coupling lifecycle progress to a potentially blocking |
| 193 | // pressure-driven unlink under mu. |