Minor refactoring to improve code, but no functional changes.
Could be improved further: Currently it always calls createDir on data path and meta path.
If input is a file name without path this will effectively call createDir on the cache roots.
Cache roots should always exist, because this is ensured in New function. The createDir
should then always end up just calling os.Stat on the cache roots and checking IsDir on result.
In addition to the unnecessary stat call, this will also perform unnecessary filepath
processing: Joining root with empty path still performs clean on root, but it has already
been cleaned.
One reason to keep calling createDir unconditionally could be that it gives an extra
failsafe, if cache root directories for some reason has been deleted they will be
recreated instead of cache operation failing.