Refactor initialization logic for cache container.