/** * Load cached statistics from the database. * * @param $qubaids \qubaid_condition * @return calculated The statistics for overall attempt scores or false if not cached. */ public function get_cached($qubaids) { global $DB; $timemodified = time() - self::TIME_TO_CACHE; $fromdb = $DB->get_record_select('quiz_statistics', 'hashcode = ? AND timemodified > ?', array($qubaids->get_hash_code(), $timemodified)); $stats = new calculated(); $stats->populate_from_record($fromdb); return $stats; }