/**
  * {@inheritDoc}
  */
 public function clearCache($maxAge)
 {
     $delTime = time() - (int) $maxAge;
     $num = 0;
     foreach ($this->temporaryFilesystem->keys() as $key) {
         if (!$this->temporaryFilesystem->getAdapter()->isDirectory($key)) {
             if ($delTime > $this->temporaryFilesystem->mtime($key)) {
                 $this->temporaryFilesystem->delete($key);
                 $num++;
             }
         }
     }
     return $num;
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function getModifiedSince($id)
 {
     if ($this->filesystem->has($id)) {
         return $this->filesystem->mtime($id);
     }
 }
 /**
  * @param \Gaufrette\Filesystem $filesystem
  */
 function it_gets_mtime($filesystem)
 {
     $filesystem->mtime('filename')->shouldBeCalled()->willReturn(1358797854);
     $this->getMtime()->shouldReturn(1358797854);
 }
 /**
  * @test
  * @group functional
  * @expectedException \RuntimeException
  * @expectedMessage Could not get mtime for the "foo" key
  */
 public function shouldFailWhenTryMtimeForKeyWhichDoesNotExist()
 {
     $this->assertFalse($this->filesystem->mtime('foo'));
 }