An attempt to clean up ajax code related to cache

Does this have test coverage already?