Utilizing OS-recommended caching in go to store files on disk
dev.to·16h·
Discuss: DEV
API Performance
Preview
Report Post

Table of Contents

  1. Overview
  2. Local caching
  3. API Scaffolding
  4. Creating the HTTP client
  5. Seeing it in action

Overview

I recently started writing a wrapper around an API that rate limits you after 60 requests/minute. This is pretty low in the grand scheme of software, but its responses effectively don’t change after a single query. With that in mind, it seemed like a great time to implement a local cache that is stored on disk and platform agnostic.

Local caching

There’s a bunch of great caching options that range from storing things in memory at startup to using Redis or other database services, but this tutorial will keep things straight forward: storing respons…

Similar Posts

Loading similar posts...