mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-16 08:02:51 +00:00
Move deps from _workspace/ to vendor/
godep restore pushd $GOPATH/src/github.com/appc/spec git co master popd go get go4.org/errorutil rm -rf Godeps godep save ./... git add vendor git add -f $(git ls-files --other vendor/) git co -- Godeps/LICENSES Godeps/.license_file_state Godeps/OWNERS
This commit is contained in:
49
vendor/github.com/xyproto/simpleredis/example/main.go
generated
vendored
Normal file
49
vendor/github.com/xyproto/simpleredis/example/main.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/xyproto/simpleredis"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Check if the redis service is up
|
||||
if err := simpleredis.TestConnection(); err != nil {
|
||||
log.Fatalln("Could not connect to Redis. Is the service up and running?")
|
||||
}
|
||||
|
||||
// Use instead for testing if a different host/port is up.
|
||||
// simpleredis.TestConnectionHost("localhost:6379")
|
||||
|
||||
// Create a connection pool, connect to the given redis server
|
||||
pool := simpleredis.NewConnectionPool()
|
||||
|
||||
// Use this for connecting to a different redis host/port
|
||||
// pool := simpleredis.NewConnectionPoolHost("localhost:6379")
|
||||
|
||||
// For connecting to a different redis host/port, with a password
|
||||
// pool := simpleredis.NewConnectionPoolHost("password@redishost:6379")
|
||||
|
||||
// Close the connection pool right after this function returns
|
||||
defer pool.Close()
|
||||
|
||||
// Create a list named "greetings"
|
||||
list := simpleredis.NewList(pool, "greetings")
|
||||
|
||||
// Add "hello" to the list, check if there are errors
|
||||
if list.Add("hello") != nil {
|
||||
log.Fatalln("Could not add an item to list!")
|
||||
}
|
||||
|
||||
// Get the last item of the list
|
||||
if item, err := list.GetLast(); err != nil {
|
||||
log.Fatalln("Could not fetch the last item from the list!")
|
||||
} else {
|
||||
log.Println("The value of the stored item is:", item)
|
||||
}
|
||||
|
||||
// Remove the list
|
||||
if list.Remove() != nil {
|
||||
log.Fatalln("Could not remove the list!")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user