public function load_cached($qubaids, $whichtries) {
        global $DB;

        $timemodified = time() - self::TIME_TO_CACHE;
        // Variable name 'analyses' is the plural of 'analysis'.
        $responseanalyses = $DB->get_records_select('question_response_analysis',
                                            'hashcode = ? AND whichtries = ? AND questionid = ? AND timemodified > ?',
                                            array($qubaids->get_hash_code(), $whichtries, $this->questiondata->id, $timemodified));
        if (!$responseanalyses) {
            return false;
        }

        $analysisids = array();
        foreach ($responseanalyses as $responseanalysis) {
            $analysisforsubpart = $this->analysis->get_analysis_for_subpart($responseanalysis->variant, $responseanalysis->subqid);
            $class = $analysisforsubpart->get_response_class($responseanalysis->aid);
            $class->add_response($responseanalysis->response, $responseanalysis->credit);
            $analysisids[] = $responseanalysis->id;
        }
        list($sql, $params) = $DB->get_in_or_equal($analysisids);
        $counts = $DB->get_records_select('question_response_count', "analysisid {$sql}", $params);
        foreach ($counts as $count) {
            $responseanalysis = $responseanalyses[$count->analysisid];
            $analysisforsubpart = $this->analysis->get_analysis_for_subpart($responseanalysis->variant, $responseanalysis->subqid);
            $class = $analysisforsubpart->get_response_class($responseanalysis->aid);
            $class->set_response_count($responseanalysis->response, $count->try, $count->rcount);

        }
        return $this->analysis;
    }