Refactored the federation caching.