Moving cache time calculation to where it's relevant