Cache result and dump to json files.