diff options
-rw-r--r-- | lib/containers/arcache.go | 2 | ||||
-rw-r--r-- | lib/containers/lrucache.go | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/containers/arcache.go b/lib/containers/arcache.go index 3f15f67..c92a149 100644 --- a/lib/containers/arcache.go +++ b/lib/containers/arcache.go @@ -230,7 +230,7 @@ type arCache[K comparable, V any] struct { // Before getting to the meaty ARC stuff, let's get some // boring/simple synchronization/blocking primitives out of the way: -// waitForEval is called before storing something into the cache. +// waitForAvail is called before storing something into the cache. // This is nescessary because if the cache is full and all entries are // pinned, then we won't have to store the entry until something gets // unpinned ("Release()d"). diff --git a/lib/containers/lrucache.go b/lib/containers/lrucache.go index d2aff41..2ea1989 100644 --- a/lib/containers/lrucache.go +++ b/lib/containers/lrucache.go @@ -60,12 +60,14 @@ type lruCache[K comparable, V any] struct { // Blocking primitives ///////////////////////////////////////////////////////// -// Because of pinning, there might not actually be an available entry -// for us to use/evict. If we need an entry to use or evict, we'll -// call waitForAvail to block until there is en entry that is either -// unused or evictable. We'll give waiters FIFO priority. +// waitForAvail is called before storing something into the cache. +// This is nescessary because if the cache is full and all entries are +// pinned, then we won't have to store the entry until something gets +// unpinned ("Release()d"). func (c *lruCache[K, V]) waitForAvail() { if !(c.unused.IsEmpty() && c.evictable.IsEmpty()) { + // There is already an available `lruEntry` that we + // can either use or evict. return } ch := make(chan struct{}) |