Make Cached work with DI and on-disk caches

* Update Cached to use DI. To make this work, I change the old Cached
  class into CachedBuilder. Then I introduce a new Cached class which
  has the same API as the old Cached companion object.
* Make Results serializable by wrapping them before storing them
  in Cached's cache. This allows Cached to work with on-disk caches,
  not just in-memory caches.
Merge pull request #3641 from richdougherty/results-disk-cached

Make Cached work with DI and disk caches