Beispiel #1
0
 /**
  * Indicates whether the serialized cache file needs to be rebuild.
  *
  * @param string $cacheFile
  */
 public function needsRebuild($cacheFile)
 {
     $needsRebuild = true;
     if ($this->serializeCache->exists($cacheFile)) {
         try {
             $needsRebuild = time() - $this->ttl >= $this->serializeCache->mtime($cacheFile);
         } catch (\RuntimeException $e) {
         }
     }
     return $needsRebuild;
 }
 /**
  * {@inheritDoc}
  */
 public function getMetadata($key)
 {
     $result = false;
     if ($this->primary instanceof Adapter\MetadataSupporter) {
         if ($this->primary->exists($key)) {
             $result = $this->primary->getMetadata($key);
         } else {
             if ($this->fallback instanceof Adapter\MetadataSupporter) {
                 $result = $this->fallback->getMetadata($key);
             }
         }
     }
     return $result;
 }
 /**
  * @param $key
  * @return bool
  */
 public function exists($key)
 {
     return $this->gaufretteAdapter->exists($key);
 }
Beispiel #4
0
 /**
  * {@inheritdoc}
  */
 public function exists($key)
 {
     return $this->master->exists($key);
 }
 /**
  * @param \Gaufrette\Adapter $adapter
  */
 function it_does_not_calculate_checksum_of_file_which_does_not_exist($adapter)
 {
     $adapter->exists('filename')->shouldBeCalled()->willReturn(false);
     $this->shouldThrow(new \Gaufrette\Exception\FileNotFound('filename'))->duringChecksum('filename');
 }
 /**
  * @param \Gaufrette\Adapter $adapter
  */
 function it_delegates_exists($adapter)
 {
     $adapter->exists('filename')->willReturn(true);
     $adapter->exists('filename2')->willReturn(false);
     $this->exists('filename')->shouldReturn(true);
     $this->exists('filename2')->shouldReturn(false);
 }
Beispiel #7
0
 /**
  * @param \Gaufrette\Adapter $source
  */
 function it_should_check_if_exists_in_source($source)
 {
     $source->exists('filename')->shouldBeCalled()->willReturn(true);
     $this->exists('filename')->shouldReturn(true);
 }
Beispiel #8
0
 /**
  * @inheritdoc
  */
 public function isAvailable($value)
 {
     return !$this->adapter->exists($value);
 }