Skip to content

Commit 26a9b08

Browse files
committed
Updated Resize to generic
1 parent f3dc311 commit 26a9b08

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ func (cache *Cache[T]) Stats() Stats {
402402

403403
// Resize the cache to hold at most n entries. If n is smaller than the current
404404
// size, entries are evicted to fit the new size. It errors if n <= 0.
405-
func (cache *Cache) Resize(n int) error {
405+
func (cache *Cache[T]) Resize(n int) error {
406406
if n <= 0 {
407407
return errors.New("must supply a positive capacity to Resize")
408408
}

cache_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ func TestActiveExpiration(t *testing.T) {
355355
}
356356

357357
func TestResize(t *testing.T) {
358-
cache := New(Config{
358+
cache := New(Config[int]{
359359
Capacity: 2,
360360
})
361361
cache.Set("a", 1)

0 commit comments

Comments
 (0)