From e37261a28191a3219b27e0bfbd29c948aeb4a2eb Mon Sep 17 00:00:00 2001 From: "M. J. Fromberger" Date: Thu, 5 Sep 2024 18:38:03 -0700 Subject: [PATCH] cache: fix up some comment idiosyncrasies --- cache/cache.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cache/cache.go b/cache/cache.go index 57d94ef..c67640f 100644 --- a/cache/cache.go +++ b/cache/cache.go @@ -194,7 +194,7 @@ type Store[Key comparable, Value any] interface { // This counts as an access of the value. // // If key is already present, Store should panic. - // That condition should not be possible. + // That condition should not be possible when used from a [Cache]. Store(key Key, val Value) // Remove removes the specified key from the cache. If key is not present, @@ -206,10 +206,10 @@ type Store[Key comparable, Value any] interface { // each key/value pair to be evicted, if any, to obtain its effective size. // // If Evict cannot satisfy the specified size, it should panic. - // That condition should not be possible. + // That condition should not be possible when used from a [Cache]. Evict(need int64, sizeOf func(Key, Value) int64) int64 } -// Length is a convenience function using the length of a string or byte slice -// as its size in a cache. +// Length is a convenience function for using the length of a string or byte +// slice as its size in a cache. It returns len(v). func Length[T ~[]byte | ~string](v T) int64 { return int64(len(v)) }