golang中实现redis的事务
go
·
package main import ( "fmt" "github.com/gomodule/redigo/redis" ) func main(){ conn,err:=redis.Dial("tcp","localhost:6379") if err!=nil{ fmt.Println("conn reids error") return } defer conn.Close() conn.Send("MULTI") conn.Send("INCR","foo") conn.Send("INCR","bar") r,err:=conn.Do("EXEC") fmt.Println(r) }
更多推荐
已为社区贡献1条内容
所有评论(0)