Пример #1
0
 public function save($data, $id, $tags = array(), $specificLifetime = false)
 {
     if ($this->_options['compression']) {
         $data = gzdeflate($data);
     }
     return parent::save($data, $id, $tags, $specificLifetime);
 }
 /**
  * @dataProvider allMethodsDataProvider
  */
 public function testAllMethods($methodName)
 {
     $this->_mockBackend->expects($this->once())->method($methodName);
     $decorator = $this->getMockForAbstractClass('Magento\\Framework\\Cache\\Backend\\Decorator\\AbstractDecorator', [['concrete_backend' => $this->_mockBackend]]);
     call_user_func([$decorator, $methodName], null, null);
 }
Пример #3
0
 /**
  * Drop a metadata record
  *
  * @param  string $id Cache id
  * @return boolean True if no problem
  */
 protected function _delMetadatas($id)
 {
     $metadata = $this->_loadMetadatas($id);
     $file = $this->_metadatasFile($id);
     if (isset($metadata['tags']) && is_array($metadata['tags'])) {
         foreach ($metadata['tags'] as $tag) {
             $link = $this->_getMetadataTagSymlinkFilename($file, $tag);
             $this->_remove($link);
             // remove directory if empty
             @rmdir(dirname($link));
         }
     }
     return parent::_delMetadatas($id);
 }
Пример #4
0
 /**
  * Extended parent test method
  * Test if a cache is available or not (for the given id)
  *
  * @param string $id cache id
  * @return mixed false (a cache is not available) or "last modified" timestamp (int) of the available cache record
  */
 public function test($id)
 {
     $metadatas = $this->getMetadatas($id);
     if (count($metadatas['tags'])) {
         if (count(array_intersect($metadatas['tags'], $this->_disabledTags))) {
             return false;
         }
     }
     return parent::test($id);
 }