Building categories and relations between apps and categories in cache