O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementing caching in Go

Caching data in a web application is sometimes necessary to avoid requesting static data from a database or external service again and again. Go does not provide any built-in package to cache responses, but it does support it through external packages.

There are a number of packages, such as https://github.com/coocood/freecache and https://github.com/patrickmn/go-cache, which can help in implementing caching and, in this recipe, we will be using the https://github.com/patrickmn/go-cache to implement it.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required