1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-17 16:12:42 +08:00
Files
go-mixed/cache/bigcache/big_cache_test.go
2023-08-25 15:31:00 +08:00

28 lines
416 B
Go

package bigcache
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestBigCache(t *testing.T) {
r := require.New(t)
c, err := NewBigCache(BigCacheConfig{})
r.Nil(err)
cacheKey := "a"
cacheValue := "bbb"
c.Set(cacheKey, []byte(cacheValue), time.Second*5)
r.True(c.Exist(cacheKey))
r.False(c.Exist("abb"))
b, ok := c.Get(cacheKey)
r.True(ok)
r.Equal(cacheValue, string(b))
}