Use better caching in analytics generation