Joint modeling and optimization of caching and recommendation systems