isCacheValid() public method

A valid file is considered and existing cache file that has a newer creation time, than the modify time, of an api class that the cache file belongs to.
public isCacheValid ( string $api, string $class ) : boolean
$api string Name of the rest api configuration.
$class string Fully qualified class name.
return boolean True if cache file is valid, otherwise false.
示例#1
0
文件: Rest.php 项目: Webiny/Framework
 /**
  * Registers the class and creates a compile cache version of it.
  *
  * @throws RestException
  */
 private function registerClass()
 {
     try {
         if (!$this->cacheInstance->isCacheValid($this->api, $this->class) || $this->isDevelopment()) {
             $this->parseClass();
         }
     } catch (\Exception $e) {
         $exception = new RestException('Unable to register class "' . $this->class . '". ' . $e->getMessage());
         $exception->setRequestedClass($this->class);
         throw $exception;
     }
 }
示例#2
0
 /**
  * Registers the class and creates a compile cache version of it.
  *
  * @throws RestException
  */
 private function registerClass()
 {
     try {
         if (!$this->cacheInstance->isCacheValid($this->api, $this->class) || $this->isDevelopment()) {
             try {
                 $this->parseClass();
             } catch (\Exception $e) {
                 throw new RestException('Error registering class "' . $this->class . '". ' . $e->getMessage());
             }
         }
     } catch (\Exception $e) {
         throw new RestException('Unable to register class "' . $this->class . '". ' . $e->getMessage());
     }
 }