original_string: protected static function get_course_cache_lock($courseid) {
          // Get database lock to ensure this doesn't happen multiple times in parallel. Wait a
          // reasonable time for the lock to be released, so we can give a suitable error message.
          // In case the system crashes while building the course cache, the lock will automatically
          // expire after a (slightly longer) period.
          $lockfactory = \core\lock\lock_config::get_lock_factory('core_modinfo');
          $lock = $lockfactory->get_lock('build_course_cache_' . $courseid,
                  self::COURSE_CACHE_LOCK_WAIT, self::COURSE_CACHE_LOCK_EXPIRY);
          if (!$lock) {
              throw new moodle_exception('locktimeout', '', '', null,
                      'core_modinfo/build_course_cache_' . $courseid);
          }
          return $lock;
      }
code: protected static function get_course_cache_lock($courseid) {
          // Get database lock to ensure this doesn't happen multiple times in parallel. Wait a
          // reasonable time for the lock to be released, so we can give a suitable error message.
          // In case the system crashes while building the course cache, the lock will automatically
          // expire after a (slightly longer) period.
          $lockfactory = \core\lock\lock_config::get_lock_factory('core_modinfo');
          $lock = $lockfactory->get_lock('build_course_cache_' . $courseid,
                  self::COURSE_CACHE_LOCK_WAIT, self::COURSE_CACHE_LOCK_EXPIRY);
          if (!$lock) {
              throw new moodle_exception('locktimeout', '', '', null,
                      'core_modinfo/build_course_cache_' . $courseid);
          }
          return $lock;
      }
code_tokens: protected static function get_course_cache_lock ( $ courseid ) { // Get database lock to ensure this doesn't happen multiple times in parallel. Wait a // reasonable time for the lock to be released, so we can give a suitable error message. // In case the system crashes while building the course cache, the lock will automatically // expire after a (slightly longer) period. $ lockfactory = \ core \ lock \ lock_config :: get_lock_factory ( 'core_modinfo' ) ; $ lock = $ lockfactory -> get_lock ( 'build_course_cache_' . $ courseid , self :: COURSE_CACHE_LOCK_WAIT , self :: COURSE_CACHE_LOCK_EXPIRY ) ; if ( ! $ lock ) { throw new moodle_exception ( 'locktimeout' , '' , '' , null , 'core_modinfo/build_course_cache_' . $ courseid ) ; } return $ lock ; }
docstring: Gets a lock for rebuilding the cache of a single course.
  
  Caller must release the returned lock.
  
  This is used to ensure that the cache rebuild doesn't happen multiple times in parallel.
  This function will wait up to 1 minute for the lock to be obtained. If the lock cannot
  be obtained, it throws an exception.
  
  @param int $courseid Course id
  @return \core\lock\lock Lock (must be released!)
  @throws moodle_exception If the lock cannot be obtained
docstring_tokens: Gets a lock for rebuilding the cache of a single course .