public function build($className)
    {
        //TODO【重要】 使用全局的缓存版本号, 而不是针对每个文件判断缓存过期与否
        $rfl = new \ReflectionClass($className) or \PhpBoot\abort("load class $className failed");
        $fileName = $rfl->getFileName();
        $key = str_replace('\\','.',get_class($this)).md5(serialize($this->annotations).$fileName.$className);
        $cache = new CheckableCache($this->cache);
        $res = $cache->get($key, $this);
        if($res === $this){
            try{
                $meta = $this->buildWithoutCache($className);
                $cache->set($key, $meta, 0, $fileName?new ClassModifiedChecker($className):null);
                return $meta;
            }catch (\Exception $e){
                Logger::warning(__METHOD__.' failed with '.$e->getMessage());
                $cache->set($key, $e->getMessage(), 0, $fileName?new ClassModifiedChecker($className):null);
                throw $e;
            }
        }elseif(is_string($res)){
            \PhpBoot\abort($res);
        }else{
            return $res;
        }
    }
public function build($className)
    {
        //TODO【重要】 使用全局的缓存版本号, 而不是针对每个文件判断缓存过期与否
        $rfl = new \ReflectionClass($className) or \PhpBoot\abort("load class $className failed");
        $fileName = $rfl->getFileName();
        $key = str_replace('\\','.',get_class($this)).md5(serialize($this->annotations).$fileName.$className);
        $cache = new CheckableCache($this->cache);
        $res = $cache->get($key, $this);
        if($res === $this){
            try{
                $meta = $this->buildWithoutCache($className);
                $cache->set($key, $meta, 0, $fileName?new ClassModifiedChecker($className):null);
                return $meta;
            }catch (\Exception $e){
                Logger::warning(__METHOD__.' failed with '.$e->getMessage());
                $cache->set($key, $e->getMessage(), 0, $fileName?new ClassModifiedChecker($className):null);
                throw $e;
            }
        }elseif(is_string($res)){
            \PhpBoot\abort($res);
        }else{
            return $res;
        }
    }
public function build ( $ className ) { //TODO【重要】 使用全局的缓存版本号, 而不是针对每个文件判断缓存过期与否 $ rfl = new \ ReflectionClass ( $ className ) or \ PhpBoot \ abort ( "load class $className failed" ) ; $ fileName = $ rfl -> getFileName ( ) ; $ key = str_replace ( '\\' , '.' , get_class ( $ this ) ) . md5 ( serialize ( $ this -> annotations ) . $ fileName . $ className ) ; $ cache = new CheckableCache ( $ this -> cache ) ; $ res = $ cache -> get ( $ key , $ this ) ; if ( $ res === $ this ) { try { $ meta = $ this -> buildWithoutCache ( $ className ) ; $ cache -> set ( $ key , $ meta , 0 , $ fileName ? new ClassModifiedChecker ( $ className ) : null ) ; return $ meta ; } catch ( \ Exception $ e ) { Logger :: warning ( __METHOD__ . ' failed with ' . $ e -> getMessage ( ) ) ; $ cache -> set ( $ key , $ e -> getMessage ( ) , 0 , $ fileName ? new ClassModifiedChecker ( $ className ) : null ) ; throw $ e ; } } elseif ( is_string ( $ res ) ) { \ PhpBoot \ abort ( $ res ) ; } else { return $ res ; } }
load from class with local cache
@param string $className
@return object
load from class with local cache