def METHOD_NAME(self, key):
    """Ensure we can access a cache file. Create a lock for it if needed.
    Return whether the cache file exists yet or not.
    """
    cache_path = self.cache_path(key)
    exists = os.path.exists(cache_path)
    if exists:
        if not os.path.isfile(cache_path):
            raise CacheError("Cache file is not a file: %s" % cache_path)
        if not os.access(cache_path, os.R_OK):
            raise CacheError("Cannot access cache file: %s" % cache_path)
    else:
        # if the file is hierarchical, make parent directories
        parent = os.path.dirname(cache_path)
        if parent.rstrip(os.path.sep) != self.root:
            mkdirp(parent)
        if not os.access(parent, os.R_OK | os.W_OK):
            raise CacheError("Cannot access cache directory: %s" % parent)
        # ensure lock is created for this key
        self._get_lock(key)
    return exists