original_string: public function cache($qubaids) {
          global $DB;
          $toinsert = new \stdClass();
          $toinsert->hashcode = $qubaids->get_hash_code();
          $toinsert->timemodified = time();
          foreach ($this->fieldsindb as $field) {
              $toinsert->{$field} = $this->{$field};
          }
          $DB->insert_record('question_statistics', $toinsert, false);
  
          if ($this->get_variants()) {
              foreach ($this->variantstats as $variantstat) {
                  $variantstat->cache($qubaids);
              }
          }
      }
code: public function cache($qubaids) {
          global $DB;
          $toinsert = new \stdClass();
          $toinsert->hashcode = $qubaids->get_hash_code();
          $toinsert->timemodified = time();
          foreach ($this->fieldsindb as $field) {
              $toinsert->{$field} = $this->{$field};
          }
          $DB->insert_record('question_statistics', $toinsert, false);
  
          if ($this->get_variants()) {
              foreach ($this->variantstats as $variantstat) {
                  $variantstat->cache($qubaids);
              }
          }
      }
code_tokens: public function cache ( $ qubaids ) { global $ DB ; $ toinsert = new \ stdClass ( ) ; $ toinsert -> hashcode = $ qubaids -> get_hash_code ( ) ; $ toinsert -> timemodified = time ( ) ; foreach ( $ this -> fieldsindb as $ field ) { $ toinsert -> { $ field } = $ this -> { $ field } ; } $ DB -> insert_record ( 'question_statistics' , $ toinsert , false ) ; if ( $ this -> get_variants ( ) ) { foreach ( $ this -> variantstats as $ variantstat ) { $ variantstat -> cache ( $ qubaids ) ; } } }
docstring: Cache calculated stats stored in this object in 'question_statistics' table.
  
  @param \qubaid_condition $qubaids
docstring_tokens: Cache calculated stats stored in this object in question_statistics table .