Skip to content

Instantly share code, notes, and snippets.

@vmihailenco
Last active September 10, 2016 14:00
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 vmihailenco/1c790383011ebc388dc469a640a76514 to your computer and use it in GitHub Desktop.
Save vmihailenco/1c790383011ebc388dc469a640a76514 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"strconv"
"time"
redis "gopkg.in/redis.v4"
)
func main() {
client := redis.NewClusterClient(&redis.ClusterOptions{
Addrs: []string{":7000", ":7001", ":7002", ":7003", ":7004", ":7005"},
})
err := client.FlushAll().Err()
if err != nil {
log.Println(err)
}
for i := 0; i < 200; i++ {
key := "key " + strconv.Itoa(i)
value := "value " + strconv.Itoa(i)
_, err := client.Set(key, value,0).Result()
if err != nil {
log.Println(err)
}
}
for {
for i := 0; i < 200; i++ {
key := "key " + strconv.Itoa(i)
_, err := client.Get(key).Result()
if err != nil {
log.Println("err : ", err)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment