feat: add lru cache

This commit is contained in:
dudaodong
2022-03-11 17:05:55 +08:00
parent 0c06cdb29f
commit 78519088ab
2 changed files with 118 additions and 0 deletions

View 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)
}