Cache API responses.

Also included a nicer logging HOF.