Can't speak for Git, but caching responses is a common enough problem that it's built into the standard HTTP headers.
As for building a cache, you'd want to know a few things:
- What is a cache entry? In your case, seems to be an API response.
- How long do cache entries live? Do they live for a fixed time (TTL cache)? Do you have a max number of cached entries before you evict entries to make space? How do you determine which entries to evict if so?
- What will store the cache entries? It seems like you chose Git, but I don't see any reason you couldn't start simple just by using the filesystem (and depending on the complexity, optionally a SQL DB).
You seem locked into using Git, and if that's the case, you still need to consider the second point there. Do you plan to evict cache entries? Git repos can grow unbounded in size, and it doesn't give you many options for determining what entries to keep.