add more tests for the api cache
abstract out duplication in caches