Install the github.com/astaxie/beego/cache package using the go get command, as follows:
$ go get github.com/astaxie/beego/cache
Move to $GOPATH/src/my-first-beego-project/controllers and create cachecontroller.go, where we will define the GetFromCache handler, which will get the value for a key from a cache and write it to an HTTP response, as follows:
Move to $GOPATH/src/my-first-beego-project/routers and edit router.go to add the GET mapping /getFromCache, which will be handled by the GetFromCache handler defined in a CacheController, as follows: