Cache use of get_term_by()

`get_term_by()` is uncached in core, so let's add a level of caching around our uses of it.