package main
import (
"fmt"
"time"
"strconv"
"github.com/go-redis/redis"
)
func getRedisClient() (*redis.Client) {
client := redis.NewClient(&redis.Options{
Addr: "localhost:6379",
Password: "", // no password set
DB: 0, // use default DB
})
return client
}
func main() {
rc := getRedisClient()
ts := strconv.Itoa(int(time.Now().Unix()))
key := "set:"+ts
ret := rc.SAdd(key, "hoge")
fmt.Printf("ret1:%v,%v\n", ret.Err(), ret.Val())
ret = rc.SAdd(key, "hoge")
fmt.Printf("ret1:%v,%v\n", ret.Err(), ret.Val())
}