A Unified Approach to the Performance Analysis of Caching Systems