package main import ( "log" "github.com/bsm/redeo" "github.com/bsm/redeo/resp" ) func main() { srv := redeo.NewServer(nil) srv.HandleFunc("hello", func(out resp.ResponseWriter, req *resp.Request) { out.WriteInlineString("world") }) if err := srv.ListenAndServe(":9736"); err != nil { log.Fatalln(err) } }
package main import ( "log" "net" "github.com/bsm/redeo/resp" ) func main() { conn, err := net.Dial("tcp", "localhost:6379") if err != nil { log.Fatalln(err) } defer conn.Close() client := resp.NewClient(conn) resp, err := client.Do(resp.NewRequest("hello")) if err != nil { log.Fatalln(err) } println(resp.String()) }This example shows a Redis client built using the Responder package. The client connects to a Redis server running on localhost port 6379 and sends the "hello" command. It then prints the response received from the server. Overall, the go github.com.bsm.redeo Responder package is perfect for building high-performance Redis servers and clients.