示例#1
0
 /**
  * Called when a class needs to be loaded
  * @param $class - the name of the class
  */
 public function loadClass($class)
 {
     // Find out where the class is stored, from the cache
     $filePath = apc_fetch($this->cacheKey . $class);
     // Did we find it?
     if ($filePath === false) {
         // Not in the cache, so find out where the class is kept
         $filePath = parent::getFilePath($class);
         // store it in the cache
         if ($filePath !== false) {
             apc_store($this->cacheKey . $class, $filePath);
         }
     }
     // include it if we got a hit
     if ($filePath !== false) {
         require $filePath;
     }
 }