A unified approach to the performance analysis of caching systems