update metrics_cache and metrics_cache_index for 1 hour and 6 hour data

This commit also introduces a big refactoring of AggregationTests. Tracking and
updating expected values was tedious and error prone; consequently, I
introduced InMemoryMetricsDB.