问题描述
我将通过 golang 使用 google kms 服务。
https://github.com/GoogleCloudPlatform/golang-samples/blob/master/kms/create_key_ring.go
此示例是创建 kms 客户端和使用的指南。
并且在kms客户端库中有这样的评论,
fun main() {
ctx := context.Background()
client,err := kms.NewKeyManagementClient(ctx)
if err != nil {
return fmt.Errorf("Failed to create kms client: %v",err)
}
defer client.Close()
r := gin.Default()
r.POST("/create",func(c *gin.Context) {
reqCtx := context.Background()
client.CreateCryptoKey(reqCtx,req)
c.JSON(200,gin.H{
"message": "ok",})
})
r.Run()
}
这个客户端对象似乎可以在多个 goroutine 之间使用 所以,我要把这个客户端对象放在 main 全局上。并在请求处理程序中使用它,就像这个相同的代码
{{1}}
此时我想知道,一个 kms 客户端可以同时处理多少个请求。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)