move @cache||= outside of safely do