refs: handle the main ref_cache specially