January 2018
Intermediate to advanced
366 pages
9h 7m
English
The first step is to download dependency with Redis as the connection driver:
$ go get github.com/garyburd/redigo/redis
The Redigo is our communication interface with Redis. We will use Redis as a cache tool of our microservice.
Now, we will create the cache.go file. This file is responsible for delivering us a configured instance of the cache. Similar to the other files we've ever created, let's declare the package where we are working and the dependencies, as follows:
package main
import (
"log"
"time"
redigo "github.com/garyburd/redigo/redis"
)
Then, we create an interface to create a pool of connections to the Redis and a struct with all the settings of the connection. Note that the instance of our pool will also be in ...
Read now
Unlock full access