Create cache directory

This pull request adds the creation of cache directory.
and then drop it in here, even if it's an array. right now I don't even know if your code works with more than one entry.