Simple and flexible caching mechanism for in memory and persistent caches.