mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
update
This commit is contained in:
27
cache/bigcache/big_cache_test.go
vendored
Normal file
27
cache/bigcache/big_cache_test.go
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
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))
|
||||
}
|
Reference in New Issue
Block a user