我使用Go映射作为内存缓存和channel来确保同步访问。我的“session”包将缓存定义为:map[string]*SessionDataSessionData是一个也在包中定义的结构,以及代码中看到的其他访问函数。GetWebPage(rwhttp.ResponseWriter,req*http.Request){varsd*session.SessionDatavarsessTknstringcookie,err:=req.Cookie("sesstoken")iferr==nil{//cookiefoundsessTkn=cookie.Value//Checkforcache