STS-3102: changed the way type hierarchy elements are cached to slightly reduce memory usage