Isolating Intervals code

.. it will almost certainly break when metricDB is retired
   so isolating it a little further, we can fix it up once
   the ridecache code is done.