Go\Core\GoAspectContainer::isFresh PHP Method

isFresh() public method

Checks the freshness of AOP cache
public isFresh ( integer $timestamp ) : boolean
$timestamp integer
return boolean Whether or not concrete file is fresh
    public function isFresh($timestamp)
    {
        if (!$this->maxTimestamp && !empty($this->resources)) {
            $this->maxTimestamp = max(array_map('filemtime', $this->resources));
        }
        return $this->maxTimestamp <= $timestamp;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Tests that container resources can be added and isFresh works correctly
  */
 public function testResourceManagement()
 {
     // Without resources this should be always true
     $isFresh = $this->container->isFresh(time());
     $this->assertTrue($isFresh);
     $this->container->addResource(__FILE__);
     $realMtime = filemtime(__FILE__);
     $isFresh = $this->container->isFresh($realMtime - 3600);
     $this->assertFalse($isFresh);
     $isFresh = $this->container->isFresh($realMtime + 3600);
     $this->assertTrue($isFresh);
 }