Further reduce number of calls to map::ter() by caching the value and referencing it multiple times in build_outside_cache().