Use factory to lazily instantiate disk cache.

Fixes #298