Extract Analytics cache building to a class.