Skip to content

Commit 9c6b76a

Browse files
author
Eero Norri
committed
Change common interface to use Keys() in Len() method
1 parent e6e2171 commit 9c6b76a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

cache.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,7 @@ func (c *Cache[K, V]) Delete(key K) {
257257

258258
// Len returns the number of items in the cache.
259259
func (c *Cache[K, V]) Len() int {
260-
c.mu.Lock()
261-
defer c.mu.Unlock()
262-
return c.cache.Len()
260+
return len(c.Keys())
263261
}
264262

265263
// Contains reports whether key is within cache.

0 commit comments

Comments
 (0)