package mainimport ("context""time""github.com/allegro/bigcache/v3"
)func main() {// 创建BigCache实例cache, err := bigcache.NewBigCache(bigcache.Config{// 设置缓存大小限制为10MBHardMaxCacheSize: 10,// 设置清理间隔为1分钟CleanWindow: 1 * time.Minute,// 其他配置...})if err != nil {panic(err)}//设置cache.Set("my-key", []byte("value"))//查询v, _ := cache.Get("my-key")fmt.Println(string(v))
}