Factor out cache file generation
Merge pull request #6 from parasti/cache

Factor out cache file generation