mirror of
https://github.com/redis/go-redis.git
synced 2025-06-16 23:40:55 +03:00
Add proper SingleConnPool implementation
This commit is contained in:
@ -151,6 +151,27 @@ func ExampleClient() {
|
||||
// missing_key does not exist
|
||||
}
|
||||
|
||||
func ExampleConn() {
|
||||
conn := redisdb.Conn()
|
||||
|
||||
err := conn.ClientSetName("foobar").Err()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Open other connections.
|
||||
for i := 0; i < 10; i++ {
|
||||
go redisdb.Ping()
|
||||
}
|
||||
|
||||
s, err := conn.ClientGetName().Result()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println(s)
|
||||
// Output: foobar
|
||||
}
|
||||
|
||||
func ExampleClient_Set() {
|
||||
// Last argument is expiration. Zero means the key has no
|
||||
// expiration time.
|
||||
|
Reference in New Issue
Block a user