Since: 2.3
Author: Fabio B. Silva (fabio.bat.silva@gmail.com)
Inheritance: extends FileCache
 public function tearDown()
 {
     $dir = $this->driver->getDirectory();
     $ext = $this->driver->getExtension();
     $iterator = new \RecursiveDirectoryIterator($dir);
     foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::CHILD_FIRST) as $file) {
         if ($file->isFile()) {
             @unlink($file->getRealPath());
         } else {
             @rmdir($file->getRealPath());
         }
     }
 }
Beispiel #2
0
 /**
  * Puts data into the cache.
  *
  * @param string $id   The cache id.
  * @param mixed  $data The cache entry/data.
  *
  * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.
  */
 public function save($id, $data, $ttl = 20)
 {
     if ($this->businessEntityDebug) {
         parent::save($id, $data, $ttl);
     } else {
         parent::save($id, $data);
     }
 }
Beispiel #3
0
 /**
  * Puts data into the cache.
  *
  * @param string $id   The cache id.
  * @param mixed  $data The cache entry/data.
  *
  * @return bool TRUE if the entry was successfully stored in the cache, FALSE otherwise.
  */
 public function save($id, $data, $ttl = 20)
 {
     if ($this->debug) {
         parent::save($id, $data, $ttl);
     } else {
         parent::save($id, $data);
     }
 }
Beispiel #4
0
 public function doFlush()
 {
     // if the directory does not exist, do not bother to continue clearing
     if (!is_dir($this->directory)) {
         return;
     }
     foreach ($this->getFileIterator() as $name => $file) {
         $this->opCacheInvalidate($name);
     }
     parent::doFlush();
 }
 /**
  * {@inheritdoc}
  */
 public function getStats()
 {
     return $this->cache->getStats();
 }
 protected function doSave($id, $data, $lifeTime = 0)
 {
     $data = serialize($data);
     return parent::doSave($id, $data, $lifeTime);
 }
 /**
  * {@inheritdoc}
  */
 protected function doSave($id, $data, $lifeTime = 0)
 {
     $this->purge();
     parent::doSave($id, $data, $lifeTime);
 }