Return the pants global cache directory.
190524
def get_pants_cachedir():
  """"""
  # Follow the unix XDB base spec: http://standards.freedesktop.org/basedir-spec/latest/index.html.
  cache_home = os.environ.get('XDG_CACHE_HOME')
  if not cache_home:
    cache_home = '~/.cache'
  return os.path.expanduser(os.path.join(cache_home, 'pants'))
1103188
def path(self):
    """"""
    if self._root_dir is None:
      # This env variable is for testing purpose.
      override_buildroot = os.environ.get('PANTS_BUILDROOT_OVERRIDE', None)
      if override_buildroot:
        self._root_dir = override_buildroot
      else:
        self._root_dir = os.path.realpath(self.find_buildroot())
      if PY2:
        self._root_dir = self._root_dir.decode('utf-8')
    return self._root_dir
908472
def key_to_path(self, key):
        """"""
        return os.path.join(self.cache_dir, key[:2], key[2:4],
                            key[4:] + '.pkl')
193726
def cache(self):
        """"""
        cache = self._cache or self.app.config.get('COLLECTIONS_CACHE')
        return import_string(cache) if isinstance(cache, six.string_types) \
            else cache
600559
def _get_temp_file_location():
    '''
    

    '''
    from .._connect import main as _glconnect
    unity = _glconnect.get_unity()
    cache_dir = _convert_slashes(unity.get_current_cache_file_location())
    if not _os.path.exists(cache_dir):
        _os.makedirs(cache_dir)
    return cache_dir
848218
def mk_dir(self) :
        """"""
        if not os.path.exists(self.abs) :
            os.makedirs(self.abs)
17130
def set_cache_dir(directory):
    
    global cache_dir

    if directory is None:
        cache_dir = None
        return

    if not os.path.exists(directory):
        os.makedirs(directory)
    if not os.path.isdir(directory):
        raise ValueError("not a directory")
    cache_dir = directory
385406
def default_ccache_dir() -> str:
    """"""
    # Share ccache across containers
    if 'CCACHE_DIR' in os.environ:
        ccache_dir = os.path.realpath(os.environ['CCACHE_DIR'])
        try:
            os.makedirs(ccache_dir, exist_ok=True)
            return ccache_dir
        except PermissionError:
            logging.info('Unable to make dirs at %s, falling back to local temp dir', ccache_dir)
    # In osx tmpdir is not mountable by default
    import platform
    if platform.system() == 'Darwin':
        ccache_dir = "/tmp/_mxnet_ccache"
        os.makedirs(ccache_dir, exist_ok=True)
        return ccache_dir
    return os.path.join(os.path.expanduser("~"), ".ccache")
589431
@SuppressWarnings("unchecked")
   public static <K, V> Cache<K, V> getGlobalCache() {
      if (caches.containsKey(GLOBAL_CACHE)) {
         return Cast.as(caches.get(GLOBAL_CACHE));
      }
      return register(getCacheSpec(GLOBAL_CACHE));
   }
102510
private function cacheDirectory(): string
    {
        $cacheDirectory = (string) $this->cacheDirectory;

        if ('' === $cacheDirectory && false === \is_writable($cacheDirectory))
        {
            $cacheDirectory = \sys_get_temp_dir();
        }

        return \rtrim($cacheDirectory, '/');
    }
158753
def cache(self):
        """"""
        if not self._cache:
            self._cache = self.graph.get('%s' % self.id)

        return self._cache
267257
def _prepare_workdir(self):
    """"""
    pants_jar_base_dir = os.path.join(self.versioned_workdir, 'cache')
    safe_mkdir(pants_jar_base_dir)
    return pants_jar_base_dir
940885
def get_global_cache_dir(appname='default', ensure=False):
    
    if appname is None or  appname == 'default':
        appname = get_default_appname()
    global_cache_dir = util_cplat.get_app_resource_dir(appname,
                                                       meta_util_constants.global_cache_dname)
    if ensure:
        util_path.ensuredir(global_cache_dir)
    return global_cache_dir
1046187
def get_cached(self, path, cache_name, **kwargs):
        
        if gw2api.cache_dir and gw2api.cache_time and cache_name:
            cache_file = os.path.join(gw2api.cache_dir, cache_name)
            if mtime(cache_file) >= time.time() - gw2api.cache_time:
                with open(cache_file, "r") as fp:
                    tmp = json.load(fp)
                return self.make_response(tmp["data"], tmp["meta"])
        else:
            cache_file = None

        meta, data = self._get(path, **kwargs)

        if cache_file:
            with open(cache_file, "w") as fp:
                json.dump({"meta": meta, "data": data}, fp, indent=2)

        return self.make_response(data, meta)
944430
def _directory (self):
        """"""
        if self._filename is None:
            return os.path.join(self._ROOT_DIR, 'config')
        else:
            return os.path.dirname(self._filename)
1290003
def create_cache_directories(self):
        """"""
        if not os.path.isdir(self.package_cache_dir):
            if not os.path.isdir(self.stacker_cache_dir):
                os.mkdir(self.stacker_cache_dir)
            os.mkdir(self.package_cache_dir)
408226
def cachedir
      if Gem.win_platform?
        File.join(ENV['LOCALAPPDATA'], 'PDK', 'cache')
      else
        File.join(Dir.home, '.pdk', 'cache')
      end
    end