Refactor allocateCaches in TopologyManagerImpl