이 름 : 바다아이
|
조회수 : 9942
짧은 주소 : https://www.bada-ie.com/su/?291591922939
API docs: https://godoc.org/github.com/go-redis/redis. Examples: https://godoc.org/github.com/go-redis/redis#pkg-examples.
Installation
Install:go get -u github.com/go-redis/redis
Import:
import"github.com/go-redis/redis"
Quickstart
funcExampleNewClient() {
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>
}
funcExampleClient() {
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 exist")
} elseif err != nil {
panic(err)
} else {
fmt.Println("key2", val2)
}
// Output: key value// key2 does not exist
}
|
|
번 호
카테고리
제 목
이름
조회수
Copyright ⓒ 2001.12. bada-ie.com. All rights reserved.
이 사이트는 리눅스에서 firefox 기준으로 작성되었습니다. 기타 브라우저에서는 다르게 보일 수 있습니다.
[ Ubuntu + GoLang + PostgreSQL + Mariadb ]
서버위치 : 오라클 클라우드 춘천 실행시간 : 0.16441 초 to webmaster... gogo sea. gogo sea.