We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Cache Add/Get

A cache stores data so that future requests for that data can be served faster. We'll use one to keep PokeAPI responses in memory. No need to make the same network request twice!

First, we need a way to store and retrieve entries. I used a Cache struct with a map[string][]byte: the key identifies the data, and the value holds the raw bytes. The cache doesn't need to know anything about Pokemon or JSON.

Assignment

We'll add expiration and connect the cache to the PokeAPI in the next lessons. For now, map and mapb should work as before.

Run and submit the CLI tests from the root of the repo.