Skip to content

Commit ce7cd57

Browse files
committed
Export Len
1 parent de2247e commit ce7cd57

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

‎lazycache.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ func (c *Cache[K, V]) keys() []K {
176176
return c.lru.Keys()
177177
}
178178

179-
// len returns the number of items in the cache.
179+
// Len returns the number of items in the cache.
180180
// note that this wil also include values that are not yet ready.
181-
func (c *Cache[K, V]) len() int {
181+
func (c *Cache[K, V]) Len() int {
182182
c.mu.RLock()
183183
defer c.mu.RUnlock()
184184
return c.lru.Len()

‎lazycache_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func TestCache(t *testing.T) {
5252
c.Assert(cache.Delete(15), qt.IsFalse)
5353
c.Assert(cache.contains(15), qt.IsFalse)
5454

55-
c.Assert(cache.len(), qt.Equals, 0)
55+
c.Assert(cache.Len(), qt.Equals, 0)
5656

5757
c.Assert(func() { New[int, any](Options[int, any]{MaxEntries: -1}) }, qt.PanicMatches, "must provide a positive size")
5858
}
@@ -68,7 +68,7 @@ func TestDeleteFunc(t *testing.T) {
6868
c.Assert(cache.DeleteFunc(func(key int, value any) bool {
6969
return key%2 == 0
7070
}), qt.Equals, 5)
71-
c.Assert(cache.len(), qt.Equals, 5)
71+
c.Assert(cache.Len(), qt.Equals, 5)
7272
})
7373

7474
c.Run("Temporary", func(c *qt.C) {

0 commit comments

Comments
 (0)