Fix atomic variable alignment
Some checks failed
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (push) Has been cancelled
CI / Build Prometheus for all architectures (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled

Signed-off-by: Ganesh Vernekar <ganesh.vernekar@reddit.com>
This commit is contained in:
Ganesh Vernekar 2026-01-26 13:05:36 -08:00
parent 4add77eb64
commit c658f97d99

View file

@ -47,6 +47,11 @@ type cacheEntry struct {
// FileCache is a shared LRU cache for file blocks.
// It provides configurable memory limits, efficient eviction, and Prometheus metrics.
type FileCache struct {
requests atomic.Uint64 // Total cache access attempts
misses atomic.Uint64 // Cache misses
evictions atomic.Uint64 // Number of evictions
nextFileID atomic.Uint64 // File ID counter for unique identification
mu sync.RWMutex
maxSize int64
currentSize int64
@ -58,15 +63,9 @@ type FileCache struct {
pool sync.Pool
// Metrics - all atomic for lock-free reads
requests atomic.Uint64 // Total cache access attempts
misses atomic.Uint64 // Cache misses
evictions atomic.Uint64 // Number of evictions
// Prometheus metrics
metrics *fileCacheMetrics
// File ID counter for unique identification
nextFileID atomic.Uint64
}
// fileCacheMetrics holds Prometheus metrics for the file cache.