Skip to content

Commit

Permalink
cache: fix up some comment idiosyncrasies
Browse files Browse the repository at this point in the history
  • Loading branch information
creachadair committed Sep 6, 2024
1 parent f722a62 commit e37261a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)) }

0 comments on commit e37261a

Please sign in to comment.