Bunch of bug fixes to the MetadataCache batched reads and writes.

We were trying to understand why metadata wasn't being written to cassandra even if we enabled batched writes for meta cache. There was a bug where we checked the in memory cache before writing the value to disk. We were using an incorrect key to lookup the cache. This PR fixes that problem.

Also, I went ahead and did some cleanup:

1) Use explicit locks for flush and fetch meta.
2) Kickoff batch timers only when batch mode is turned on.
3) Another minor bug when we should really check the FIFO queue for writing meta and not the hash set we have for tracking duplicates.