Skip to content

Commit 7d94937

Browse files
committed
fix bug: update the condition in Count func
1 parent 272a345 commit 7d94937

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lru_cache.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (c *LRUCache[K, V]) Count() int {
165165

166166
var count int
167167
for _, v := range c.m {
168-
if v.Value.(*lruItem[K, V]).expireAt != nil && v.Value.(*lruItem[K, V]).expireAt.Before(time.Now()) {
168+
if v.Value.(*lruItem[K, V]).expireAt == nil || !v.Value.(*lruItem[K, V]).expireAt.Before(time.Now()) {
169169
count++
170170
}
171171
}

0 commit comments

Comments
 (0)