Add core components for request coalescing and service management
- Introduced coalescing logic in `coalescing.go` to handle concurrent identical upstream fetches, including a state machine and response buffering for improved performance. - Implemented a new cache file format in `format.go`, supporting serialization and deserialization of HTTP responses, along with range request handling. - Developed an HTTP handler in `handler.go` to manage requests, including special endpoint handling and metrics reporting. - Added rate limiting functionality in `ratelimit.go` to control per-client and global request rates, enhancing security and performance. - Created service management capabilities in `service.go` to define and manage cacheable services, including user-agent detection. - Updated tests in `steamcache_test.go` to cover new functionalities, ensuring robustness and reliability across the codebase.
This commit is contained in:
@@ -319,7 +319,9 @@ func (m *MemoryFS) EvictLRU(bytesNeeded uint) uint {
|
||||
break
|
||||
}
|
||||
fi := elem.Value.(*types.FileInfo)
|
||||
toEvict = append(toEvict, fi.Key)
|
||||
key := fi.Key
|
||||
m.LRU.Remove(key) // actually remove during collection so Back() advances to distinct items
|
||||
toEvict = append(toEvict, key)
|
||||
cur -= fi.Size // local estimate; real size updated in W phase
|
||||
}
|
||||
m.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user