function findCacheDir(name) {
  if (env.CACHE_DIR && !["true", "false", "1", "0"].includes(env.CACHE_DIR)) {
    return path.join(env.CACHE_DIR, name);
  }
  const rootPkgJSONPath = path.dirname(findUpSync("package.json"));
  if (rootPkgJSONPath) {
    return path.join(rootPkgJSONPath, "node_modules", ".cache", name);
  }
  return os.tmpdir();
}
Retrieve file from cache, or create a new one for future reads

@async
@param  {Object}   params
@param  {String}   params.cacheDirectory   Directory to store cached files
@param  {String}   params.cacheIdentifier  Unique identifier to bust cache
@param  {Boolean}  params.cacheCompression Whether compressing cached files
@param  {String}   params.source   Original contents of the file to be cached
@param  {Object}   params.options  Options to be given to the transform fn

@example

  const result = await cache({
    cacheDirectory: '.tmp/cache',
    cacheIdentifier: 'babel-loader-cachefile',
    cacheCompression: false,
    source: *source code from file*,
    options: {
      experimental: true,
      runtime: true
    },
  });