Added metrics to memory cache. Improved metrics collection.