openFile opens a cached entry WITHOUT recording a hit. Used to serve a body that was just fetched on a miss — that path already counted a miss, so counting it as a hit too would double-count.
(key string)
| 296 | startupContext = context.Background() |
| 297 | } |
| 298 | removedTemporaryFiles, err := resetTemporaryDirectory(startupContext, filepath.Join(dir, tmpSubdir)) |
| 299 | if err != nil { |
| 300 | return nil, fmt.Errorf("reset cache temp dir: %w", err) |
| 301 | } |
| 302 | if removedTemporaryFiles > 0 { |
| 303 | cacheTemporaryFilesRemovedTotal.Add(float64(removedTemporaryFiles)) |
| 304 | } |
| 305 | |
| 306 | // Complete enumeration and the exceptional hard-cap survivor pass before |
| 307 | // sampling free space. No soft-target deletion occurs during startup. |
| 308 | ownedBytes, err := dc.scanExistingContext(startupContext) |
| 309 | if err != nil { |
| 310 | return nil, fmt.Errorf("scan existing cache entries: %w", err) |
| 311 | } |
| 312 | startupSpace, err := dc.diskSpace() |
| 313 | if err != nil { |
| 314 | return nil, fmt.Errorf("statfs %s: %w", dir, err) |
| 315 | } |
| 316 | if err := dc.initializeCapacity(ownedBytes, startupSpace); err != nil { |
| 317 | return nil, fmt.Errorf("apply startup cache limits: %w", err) |
| 318 | } |
| 319 | if option.IncrementalSummary { |
| 320 | summaryCapacity := fixedSummaryBloomCapacity() |
| 321 | if option.DynamicSummary { |