mirror of
https://github.com/duke-git/lancet.git
synced 2025-11-03 03:13:32 +08:00
feat: add lru cache
This commit is contained in:
19
algorithm/lru_cache_test.go
Normal file
19
algorithm/lru_cache_test.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package algorithm
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/duke-git/lancet/internal"
|
||||
)
|
||||
|
||||
func TestLRUCache(t *testing.T) {
|
||||
asssert := internal.NewAssert(t, "TestLRUCache")
|
||||
|
||||
cache := NewLRUCache[int, int](2)
|
||||
|
||||
cache.Put(1, 1)
|
||||
cache.Put(2, 2)
|
||||
|
||||
_, ok := cache.Get(0)
|
||||
asssert.Equal(false, ok)
|
||||
}
|
||||
Reference in New Issue
Block a user