You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As correctly pointed out by @StephenButtolph , and quoting his message about the Put function:
Total aside but Put would probably be cleaner if it was:
func (f *FIFO[K, V]) Put(key K, val V) bool {
f.l.Lock()
defer f.l.Unlock()
_, exists := f.m[key]
if !exists {
f.buffer.Push(key) // Insert will remove the oldest [K] if we are at the [limit]
}
f.m[key] = val
return exists
}
The comment should probably be fixed as well:
// Insert will remove the oldest [K] if we are at the [limit]
Should be:
// Push removes the oldest [K] if we are at the [limit]
The text was updated successfully, but these errors were encountered:
As correctly pointed out by @StephenButtolph , and quoting his message about the
Put
function:The text was updated successfully, but these errors were encountered: