original_string: protected static function get_backup_ids_cached($restoreid, $itemname, $itemid) {
          global $DB;
  
          $key = "$itemid $itemname $restoreid";
  
          // If record exists in cache then return.
          if (isset(self::$backupidsexist[$key]) && isset(self::$backupidscache[$key])) {
              // Return a copy of cached data, to avoid any alterations in cached data.
              return clone self::$backupidscache[$key];
          }
  
          // Clean cache, if it's full.
          if (self::$backupidscachesize <= 0) {
              // Remove some records, to keep memory in limit.
              self::$backupidscache = array_slice(self::$backupidscache, self::$backupidsslice, null, true);
              self::$backupidscachesize = self::$backupidscachesize + self::$backupidsslice;
          }
          if (self::$backupidsexistsize <= 0) {
              self::$backupidsexist = array_slice(self::$backupidsexist, self::$backupidsslice, null, true);
              self::$backupidsexistsize = self::$backupidsexistsize + self::$backupidsslice;
          }
  
          // Retrive record from database.
          $record = array(
              'backupid' => $restoreid,
              'itemname' => $itemname,
              'itemid'   => $itemid
          );
          if ($dbrec = $DB->get_record('backup_ids_temp', $record)) {
              self::$backupidsexist[$key] = $dbrec->id;
              self::$backupidscache[$key] = $dbrec;
              self::$backupidscachesize--;
              self::$backupidsexistsize--;
              return $dbrec;
          } else {
              return false;
          }
      }
code: protected static function get_backup_ids_cached($restoreid, $itemname, $itemid) {
          global $DB;
  
          $key = "$itemid $itemname $restoreid";
  
          // If record exists in cache then return.
          if (isset(self::$backupidsexist[$key]) && isset(self::$backupidscache[$key])) {
              // Return a copy of cached data, to avoid any alterations in cached data.
              return clone self::$backupidscache[$key];
          }
  
          // Clean cache, if it's full.
          if (self::$backupidscachesize <= 0) {
              // Remove some records, to keep memory in limit.
              self::$backupidscache = array_slice(self::$backupidscache, self::$backupidsslice, null, true);
              self::$backupidscachesize = self::$backupidscachesize + self::$backupidsslice;
          }
          if (self::$backupidsexistsize <= 0) {
              self::$backupidsexist = array_slice(self::$backupidsexist, self::$backupidsslice, null, true);
              self::$backupidsexistsize = self::$backupidsexistsize + self::$backupidsslice;
          }
  
          // Retrive record from database.
          $record = array(
              'backupid' => $restoreid,
              'itemname' => $itemname,
              'itemid'   => $itemid
          );
          if ($dbrec = $DB->get_record('backup_ids_temp', $record)) {
              self::$backupidsexist[$key] = $dbrec->id;
              self::$backupidscache[$key] = $dbrec;
              self::$backupidscachesize--;
              self::$backupidsexistsize--;
              return $dbrec;
          } else {
              return false;
          }
      }
code_tokens: protected static function get_backup_ids_cached ( $ restoreid , $ itemname , $ itemid ) { global $ DB ; $ key = "$itemid $itemname $restoreid" ; // If record exists in cache then return. if ( isset ( self :: $ backupidsexist [ $ key ] ) && isset ( self :: $ backupidscache [ $ key ] ) ) { // Return a copy of cached data, to avoid any alterations in cached data. return clone self :: $ backupidscache [ $ key ] ; } // Clean cache, if it's full. if ( self :: $ backupidscachesize <= 0 ) { // Remove some records, to keep memory in limit. self :: $ backupidscache = array_slice ( self :: $ backupidscache , self :: $ backupidsslice , null , true ) ; self :: $ backupidscachesize = self :: $ backupidscachesize + self :: $ backupidsslice ; } if ( self :: $ backupidsexistsize <= 0 ) { self :: $ backupidsexist = array_slice ( self :: $ backupidsexist , self :: $ backupidsslice , null , true ) ; self :: $ backupidsexistsize = self :: $ backupidsexistsize + self :: $ backupidsslice ; } // Retrive record from database. $ record = array ( 'backupid' => $ restoreid , 'itemname' => $ itemname , 'itemid' => $ itemid ) ; if ( $ dbrec = $ DB -> get_record ( 'backup_ids_temp' , $ record ) ) { self :: $ backupidsexist [ $ key ] = $ dbrec -> id ; self :: $ backupidscache [ $ key ] = $ dbrec ; self :: $ backupidscachesize -- ; self :: $ backupidsexistsize -- ; return $ dbrec ; } else { return false ; } }
docstring: Return cached backup id's
  
  @param int $restoreid id of backup
  @param string $itemname name of the item
  @param int $itemid id of item
  @return array backup id's
  @todo MDL-25290 replace static backupids* with MUC code
docstring_tokens: Return cached backup id s