refactoring some functions into a utility class

This commit also updates the logic in PastDataAggregator for how it invokes the
processCacheBlock method. If the 6 hour time slice has finished, it no longer
updates the metrics_cache and metrics_cache_index tables. There are additional
changes needed for when PastDataAggregator calls processCacheBlock. It needs to
determine if the 6 hour and 24 hour data need to be recomputed similar to what
is done in the processBatch method.