fix issue of dead lock in gcache.doSetWithLockCheck

This commit is contained in:
John
2019-07-02 19:22:06 +08:00
parent 31921905a9
commit e63e989d41
2 changed files with 27 additions and 7 deletions

View File

@ -1,8 +1,28 @@
package main
import "fmt"
import (
"github.com/gogf/gf/g/os/glog"
"github.com/gogf/gf/g/os/gcache"
)
func localCache() {
result := gcache.GetOrSetFunc("test.key.1", func() interface{} {
return nil
}, 1000*60*2)
if result == nil {
glog.Error("未获取到值")
} else {
glog.Infofln("result is $v", result)
}
}
func TestCache() {
for i := 0; i < 100; i++ {
localCache()
}
}
func main() {
s := "123"
fmt.Println([]byte(s))
TestCache()
}