设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 软件追踪 查看内容

Go语言Redis客户端Go-Redis v4.1.2发布

2016-8-11 21:26| 发布者: joejoe0332| 查看: 1075| 评论: 0|原作者: oschina|来自: oschina

摘要: Go-Redis v4.1.2 发布了,Go-Redis 是Redis数据库的Google Go语言的客户端开发包。支持:Redis 3 commands except QUIT, MONITOR, SLOWLOG and SYNC.Pub/Sub.Transactions.Pipelining.Scripting.Timeouts.Redis Sent ...

Go-Redis v4.1.2 发布了,Go-Redis 是 Redis 数据库的 Google Go 语言的客户端开发包。

支持:

API docs: http://godoc.org/gopkg.in/redis.v4. Examples: http://godoc.org/gopkg.in/redis.v4#pkg-examples.

示例如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
func ExampleNewClient() {  
    client := redis.NewClient(&redis.Options{
        Addr: "localhost:6379",
        Password: ""// no password set  DB: 0, // use default DB 
        }) 
pong, err := client.Ping().Result()
   fmt.Println(pong, err) // Output: PONG <nil> 
        }  
        func ExampleClient() { 
            err := client.Set("key""value", 0).Err()  
                if err != nil {  
                panic(err)
  }  
  val, err := client.Get("key").Result()  
      if err != nil {  
      panic(err)
  }
  fmt.Println("key", val)  
      val2, err := client.Get("key2").Result()  
      if err == redis.Nil {
    fmt.Println("key2 does not exists")
  else if err != nil {  
        panic(err)
  else {
    fmt.Println("key2", val2)
  }  // Output: key value  // key2 does not exists 
    }

酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部