comment updates for gcfg
@@ -2,12 +2,34 @@ package main
import (
"fmt"
- "github.com/gogf/gf/g/container/gring"
+ "github.com/gogf/gf/g/database/gredis"
+ "github.com/gogf/gf/g/util/gconv"
+)
+
+var (
+ config = gredis.Config{
+ Host : "127.0.0.1",
+ Port : 6379,
+ Db : 1,
+ }
)
func main() {
- r := gring.New(3)
- r.Put(1)
- r.Put(2)
- fmt.Println(r.Val())
+ group := "test"
+ gredis.SetConfig(config, group)
+
+ redis := gredis.Instance(group)
+ defer redis.Close()
+
+ _, err := redis.Do("SET", "k", "v")
+ if err != nil {
+ panic(err)
+ }
+
+ r, err := redis.Do("GET", "k")
+ if err != nil {
+ panic(err)
+ }
+ fmt.Println(gconv.String(r))
+
}
\ No newline at end of file
