Writes the cache to disk as JSON.

def write_cache(self):
        """Writes the cache to disk as JSON."""
        doc = {
            '__format__': 1,
            'dependencies': self._cache,
        }
        with open(self._cache_file, 'w') as f:
            json.dump(doc, f, sort_keys=True)