From fc881047d0ed06a6cc26b195e6a15e65cb558178 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 27 Mar 2023 22:32:29 -0600 Subject: touch up comments --- lib/caching/arcache.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/caching/arcache.go b/lib/caching/arcache.go index 892cf8a..5b7394c 100644 --- a/lib/caching/arcache.go +++ b/lib/caching/arcache.go @@ -400,9 +400,10 @@ func (c *arCache[K, V]) dblReplace() *LinkedListEntry[arcLiveEntry[K, V]] { // c.recentLive, c.frequentPinned, c.frequentLive, or c.unusedLive), // and is ready to be stored into a list by the caller. // -// If an eviction is performed, the `ghostEntry` argument is where the -// eviction should be recorded to. `ghostEntry` is still present in -// its old list, in case an eviction is not performed. +// If an eviction is performed, `ghostEntry` is a pointer to the entry +// object that is used as a record of the eviction. `ghostEntry` +// should still be present in its old list, in case an eviction is not +// performed and the `ghostEntry` object is not modified. // // The `arbitrary` argument is arbitrary, see the quote about it // below. @@ -410,8 +411,10 @@ func (c *arCache[K, V]) arcReplace(ghostEntry *LinkedListEntry[arcGhostEntry[K]] c.waitForAvail() // If the cache isn't full, no need to do an eviction. (This - // is a nescessary enhancement over standard ARC in order to - // support "delete".) + // check is a nescessary enhancement over standard ARC in + // order to support "delete"; because without "delete", + // arcReplace wouldn't ever be called when the cache isn't + // full.) if entry := c.unusedLive.Oldest; entry != nil { c.unusedLive.Delete(entry) return entry -- cgit v1.2.3