Skip to content

Instantly share code, notes, and snippets.

@simonklee
Created March 29, 2012 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonklee/2242549 to your computer and use it in GitHub Desktop.
Save simonklee/2242549 to your computer and use it in GitHub Desktop.
MaxClientConn + 1
package main
import (
"fmt"
"github.com/simonz05/godis"
)
func main() {
done := make(chan int)
c := godis.New("", 0, "")
for i := 0; i < godis.MaxClientConn + 1; i++ {
go func(n int, done chan int) {
p := godis.NewPipeClientFromClient(c)
p.Multi()
p.Set("foo", n)
p.Get("foo")
replies := p.Exec()
fmt.Println("GET foo:", replies[1].Elem.Int64())
done<-n
}(i, done)
}
cnt := 0
for _ = range done {
if cnt == godis.MaxClientConn {
break
}
cnt++
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment