add batch writes in cache.

In this PR, batch writes is added to the in memory cache as mentioned in #182
Why do we need this cache? We are already storing recent stats in 'dirtyStats'. We are duplicating memory here.