Basic Redis Examples with Go

POOL

func main() {    pool := newPool()
conn := pool.Get()
defer conn.Close()
err := ping(conn)
if err != nil {
fmt.Println(err)
}
...

PING

SET

// set executes the redis SET command
func set(c redis.Conn) error {
_, err := c.Do("SET", "Favorite Movie", "Repo Man")
if err != nil {
return err
}
_, err = c.Do("SET", "Release Year", 1984)
if err != nil {
return err
}
return nil
}

GET

STRUCT (SET)

STRUCT (GET)

{Username:otto MobileID:1234567890 Email:ottoM@repoman.com FirstName:Otto LastName:Maddox}

Go enthusiast; Loyalty/CRM Technology Leader; Drummer; Vinyl geek; Husband/Dad

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Implementing New Technologies

How To Deploy WSO2 API Manager In Production-Grade Kubernetes

CS373 Fall 2020: Grant Larson

These Skills Separate the Best Back-End Developers from the Rest

Road to Genius: smart #21

Handle :hover CSS on mobile touch screen

Software Design

How To Use Serverless Framework And Fauna To Build Serverless Application.

Getting Started with Selenium Automation Testing

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dan Gillis

Dan Gillis

Go enthusiast; Loyalty/CRM Technology Leader; Drummer; Vinyl geek; Husband/Dad

More from Medium

Is gRPC going to take over REST?

Couple of tips for K8s operator beginner developer

A TL;DR guide to MVC frameworks

Testing a web server : Part 1