public function get_folder_name($folderid) {
        if (empty($folderid)) {
            throw new coding_exception('Empty folderid passed to get_folder_name');
        }

        // Cache based on oauthtoken and folderid.
        $cachekey = $this->folder_cache_key($folderid);

        if ($foldername = $this->foldernamecache->get($cachekey)) {
            return $foldername;
        }

        $url = self::API."/{$folderid}";
        $ret = json_decode($this->get($url));
        if (isset($ret->error)) {
            $this->log_out();
            return false;
        }

        $this->foldernamecache->set($cachekey, $ret->name);
        return $ret->name;
    }