Wrap all api calls in get_transient/set_transient caching

This code is untested, but should work.

Also note I ignored the copy/paste mess that is this code and just made that problem worse.  A helper function or 2 could drop around 100 lines of code from this file.