Refactor: Extract getHCache and addHCache.