# Golang: cache things using interfaces

DevFeed: [Golang: cache things using interfaces](<https://devfeed.tech/articles/golang-cache-things-using-interfaces-37737.md>)

Original publisher: [Read original article](<https://carlosbecker.com/posts/golang-cache-interface/>)

Author: Carlos Alexandro Becker

Published: 2018-12-17T00:00:00Z

Content type: tutorial

Language: en

Sources: [Carlos Becker](<https://devfeed.tech/sources/carlos-becker.md>)

Topics: [Caching](<https://devfeed.tech/topics/caching.md>), [Go Language](<https://devfeed.tech/topics/go-language.md>), [interface](<https://devfeed.tech/topics/interface.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [GitHub API](<https://devfeed.tech/topics/github-api.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [caching](<https://devfeed.tech/tags/caching.md>), [golang](<https://devfeed.tech/tags/golang.md>), [interface](<https://devfeed.tech/tags/interface.md>), [pretty](<https://devfeed.tech/tags/pretty.md>), [redis](<https://devfeed.tech/tags/redis.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

A tutorial on using interfaces and a decorator-style wrapper to add caching to Go clients. It explains how this approach avoids a global cache, reduces direct dependencies, and makes caching logic easier to test, with a GitHub API example and possible extensions to Redis and SQL-backed applications.

## Source excerpt

Caching things can be hard to do and hard to test. In this post I'll demonstrate a convenient way of doing that using interfaces.