. Useful for storing non-vital information like feeds, and other stuff that can be recovered easily.
Author: Bob den Otter, bob@twokings.nl
Inheritance: extends Doctrine\Common\Cache\FilesystemCache
Exemplo n.º 1
0
 /**
  * Checks if giving a relative path results in the same path under water.
  */
 public function testCacheDirLocation()
 {
     $cacheDirLocation = $this->cache->getDirectory();
     $filesystem = new Filesystem();
     $relative = $filesystem->makePathRelative($cacheDirLocation, __DIR__);
     $newCache = new Cache($relative);
     $this->assertEquals($cacheDirLocation, $newCache->getDirectory());
 }
Exemplo n.º 2
0
 /**
  * @dataProvider setProvider
  */
 public function testSet($value, $expected)
 {
     $key = 'foo';
     $this->object->set($key, $value);
     // We've just checked the get file name method, so we can use this now
     $getFilenameMethod = $this->getMethod('getFilename');
     $cacheFilePath = $getFilenameMethod->invokeArgs($this->object, array($key));
     $this->assertTrue(file_exists($cacheFilePath));
     $this->cacheFiles[] = $cacheFilePath;
     $this->assertEquals($expected, file_get_contents($cacheFilePath));
 }
Exemplo n.º 3
0
 /**
  * Check if the cache version matches Bolt's current version
  *
  * @return boolean TRUE  - versions match
  *                 FALSE - versions don't match
  */
 protected function checkCacheVersion()
 {
     $file = $this->cache->getDirectory() . '/.version';
     if (!file_exists($file)) {
         return false;
     }
     $version = md5($this->boltVersion . $this->boltName);
     $cached = file_get_contents($file);
     if ($version === $cached) {
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
 /**
  * Write our version string out to given cache directory
  */
 protected function updateCacheVersion()
 {
     $version = md5($this->boltVersion);
     file_put_contents($this->cache->getDirectory() . '/.version', $version);
 }
Exemplo n.º 5
0
 private function getVersionFileName()
 {
     return dirname(dirname($this->cache->getDirectory())) . '/.version';
 }
Exemplo n.º 6
0
 /**
  * @dataProvider setProvider
  */
 public function testSet($value, $expected)
 {
     $key = 'foo';
     $this->cache->save($key, $value);
     $this->assertEquals($expected, $this->cache->fetch($key));
 }