当前位置: 首页>>代码示例>>PHP>>正文


PHP StorageInterface::flush方法代码示例

本文整理汇总了PHP中Zend\Cache\Storage\StorageInterface::flush方法的典型用法代码示例。如果您正苦于以下问题:PHP StorageInterface::flush方法的具体用法?PHP StorageInterface::flush怎么用?PHP StorageInterface::flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Cache\Storage\StorageInterface的用法示例。


在下文中一共展示了StorageInterface::flush方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: invalidate

 /**
  * @param Event  $e
  * @param string $class
  * @param string $event
  * @return void
  */
 public function invalidate(Event $e, $class, $event)
 {
     $term = $e->getParam('term');
     $result = false;
     if ($term instanceof TaxonomyTermInterface) {
         $result = $this->cacheService->clearByTags(['route_taxonomy/term/get', 'param_term_' . $term->getId()]);
         $this->cacheService->clearByTags(['navigation/render']);
         $this->clearParents($term);
     }
     if ($this->storage instanceof FlushableInterface && !$result) {
         $this->storage->flush();
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:19,代码来源:TaxonomyStorageInvalidator.php

示例2: invalidate

 /**
  * @param Event  $e
  * @param string $class
  * @param string $event
  * @return void
  */
 public function invalidate(Event $e, $class, $event)
 {
     $repository = $e->getParam('repository');
     $result = false;
     if ($repository instanceof EntityInterface) {
         $result = $this->cacheService->clearByTags(['route_entity/page', 'param_entity_' . $repository->getId()]);
         $this->clearTaxonomyTerms($repository->getTaxonomyTerms());
     } elseif ($repository instanceof PageRepositoryInterface) {
         $result = $this->cacheService->clearByTags(['route_page/view', 'param_page_' . $repository->getId()]);
     }
     if ($this->storage instanceof FlushableInterface && !$result) {
         $this->storage->flush();
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:20,代码来源:RepositoryStorageInvalidator.php

示例3: __destruct

 /**
  * Object destructor
  *
  * Clean up cache storage
  */
 public function __destruct()
 {
     if ($this->cache !== null) {
         if ($this->cache instanceof ClearByNamespaceCacheStorage) {
             $this->cache->clearByNamespace($this->cache->getOptions()->getNamespace());
         } elseif ($this->cache instanceof FlushableCacheStorage) {
             $this->cache->flush();
         }
     }
 }
开发者ID:eltonoliveira,项目名称:jenkins,代码行数:15,代码来源:MemoryManager.php

示例4: testFlush

 public function testFlush()
 {
     if (!$this->_storage instanceof FlushableInterface) {
         $this->markTestSkipped("Storage doesn't implement OptimizableInterface");
     }
     $this->assertSame(array(), $this->_storage->setItems(array('key1' => 'value1', 'key2' => 'value2')));
     $this->assertTrue($this->_storage->flush());
     $this->assertFalse($this->_storage->hasItem('key1'));
     $this->assertFalse($this->_storage->hasItem('key2'));
 }
开发者ID:ninahuanca,项目名称:zf2,代码行数:10,代码来源:CommonAdapterTest.php

示例5: clear

 /**
  * Deletes all items in the pool.
  *
  * @return bool
  *   True if the pool was successfully cleared. False if there was an error.
  */
 public function clear()
 {
     $cleared = false;
     try {
         /* @todo Not at all sure about this... do we really want to flush()? What happens if the storage supports
            /*       namespaces, but none has been provided? */
         $options = $this->storage->getOptions();
         $namespace = $options->getNamespace();
         if ($this->storage instanceof ClearByNamespaceInterface && $namespace) {
             $cleared = $this->storage->clearByNamespace($namespace);
         } elseif ($this->storage instanceof FlushableInterface) {
             $cleared = $this->storage->flush();
         } else {
             throw new CacheException(sprintf("Storage %s does not support clear()", get_class($this->storage)));
         }
     } catch (Exception\InvalidArgumentException $e) {
         throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
     } catch (Exception\ExceptionInterface $e) {
         throw new CacheException($e->getMessage(), $e->getCode(), $e);
     }
     return $cleared;
 }
开发者ID:Nyholm,项目名称:zend-cache-psr6,代码行数:28,代码来源:CacheItemPoolAdapter.php

示例6: invalidate

 /**
  * @param Event  $e
  * @param string $class
  * @param string $event
  * @return void
  */
 public function invalidate(Event $e, $class, $event)
 {
     if ($this->storage instanceof FlushableInterface) {
         $this->storage->flush();
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:12,代码来源:StrokerStorageInvalidator.php


注:本文中的Zend\Cache\Storage\StorageInterface::flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。