golag语言目前唯一的高性能goroutielocalstorage实现,每秒可以完成数百万次Get/Set。
OperatePerformaceBechmark_Goid5.30s/opBechmark_Set271s/opBechmark_Get155s/opBechmark_Set_4Threads129s/opBechmark_Get_4Threads58.6s/op使用起来极为简单:
import "github.com/yyzybb537/gls"// 设置协程局部变量gls.Set("Value", 1)// 获取协程局部变量var i it = gls.Get("Value").(it)// 协程退出时使用Cleaup清除相关资源defer Cleaup()









评论