Created
March 29, 2012 19:23
-
-
Save simonklee/2242549 to your computer and use it in GitHub Desktop.
MaxClientConn + 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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