forked from p93542168/wheat-cache
24 lines
506 B
Go
24 lines
506 B
Go
package lru
|
|
|
|
import (
|
|
"fmt"
|
|
"gitee.com/timedb/wheatCache/pkg/structure/stringx"
|
|
"github.com/stretchr/testify/require"
|
|
"testing"
|
|
)
|
|
|
|
func TestNewLRUCache(t *testing.T) {
|
|
cache := NewLRUCache()
|
|
v1 := stringx.NewStringSingle()
|
|
v2 := stringx.NewStringSingle()
|
|
v3 := stringx.NewStringSingle()
|
|
cache.Add("1", v1)
|
|
cache.Add("2", v2)
|
|
cache.Add("3", v3)
|
|
cache.Add("1", v1)
|
|
fmt.Println(cache.nowSize)
|
|
cache.Del()
|
|
fmt.Println(cache.nowSize)
|
|
_, isTrue := cache.Get("1")
|
|
require.Equal(t, isTrue, true)
|
|
} |