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


PHP Cache::clean方法代码示例

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


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

示例1: linkUrls

 /**
  * @param Url $oldUrl
  * @param Url $newUrl
  * @return void
  * @throws \Exception
  */
 public function linkUrls(Url $oldUrl, Url $newUrl)
 {
     if ($oldUrl->getId() === null or $newUrl->getId() === null) {
         throw new UrlNotPersistedException();
     }
     try {
         $this->em->beginTransaction();
         $alreadyRedirectedUrls = $this->findByActualUrl($oldUrl->getId());
         /** @var Url $url */
         foreach ($alreadyRedirectedUrls as $url) {
             $url->setRedirectTo($newUrl);
             $this->em->persist($url);
             $this->cache->clean([Cache::TAGS => [$url->getCacheKey()]]);
         }
         $oldUrl->setRedirectTo($newUrl);
         $this->em->persist($oldUrl);
         $this->cache->clean([Cache::TAGS => [$oldUrl->getCacheKey()]]);
         $this->em->flush();
         $this->em->commit();
     } catch (\Exception $e) {
         $this->em->rollback();
         $this->em->close();
         throw $e;
     }
 }
开发者ID:blitzik,项目名称:CMS,代码行数:31,代码来源:UrlLinker.php

示例2: invalidateCache

 public function invalidateCache($onlyTranslation = FALSE)
 {
     if ($onlyTranslation) {
         $this->cache->clean(array(Cache::TAGS => static::TAG_TRANSLATION));
     } else {
         $this->cache->clean(array(Cache::ALL => TRUE));
     }
 }
开发者ID:racinmat,项目名称:Translation,代码行数:8,代码来源:CatalogueCompiler.php

示例3: deleteItem

 /**
  * Delete single item from cache
  *
  * @param mixed $key   key
  * @param array $conds Conditions (optional)
  */
 public function deleteItem($key, $conds = null)
 {
     if ($conds) {
         $this->cache->clean($conds);
     } else {
         unset($this->cache[$key]);
     }
 }
开发者ID:ixtrum,项目名称:file-manager,代码行数:14,代码来源:Caching.php

示例4: removePageUrl

 /**
  * @param Page $page
  */
 private function removePageUrl(Page $page)
 {
     /** @var Url $url */
     $url = $this->urlFacade->getByPath($page->getUrlPath());
     if ($url !== null) {
         $this->cache->clean([Cache::TAGS => $url->getCacheKey()]);
         $this->em->remove($url);
     }
 }
开发者ID:blitzik,项目名称:CMS,代码行数:12,代码来源:PageRemover.php

示例5: execute

 /**
  * @see Console\Command\Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($ns = $input->getOption('tag')) {
         $this->cache->clean(array(Cache::TAGS => $input->getOption('tag')));
         $output->writeln('Cache tags "' . implode(', ', $ns) . '" has been invalidated.');
     } else {
         $this->cache->clean();
         $output->writeln('Cache has been invalidated.');
     }
 }
开发者ID:svobodni,项目名称:web,代码行数:13,代码来源:CacheCommand.php

示例6: __construct

 /**
  * @param ITemplateLocator
  * @param Cache
  * @param string|null
  * @param bool
  */
 public function __construct(ITemplateLocator $templateLocator, ICachingStorage $storage, $setupFingerprint = NULL, $onlyExistingFiles = FALSE)
 {
     $this->templateLocator = $templateLocator;
     $cache = new Cache($storage, 'Rixxi.TemplateLocator');
     if ($setupFingerprint !== $cache['setupFingerprint']) {
         $cache->clean(array(Cache::ALL => TRUE));
         $cache['setupFingerprint'] = $setupFingerprint;
     }
     $this->filesCache = $cache->derive('files');
     $this->layoutFilesCache = $cache->derive('layoutFiles');
     $this->componentFilesCache = $cache->derive('componentFiles');
     $this->onlyExistingFiles = $onlyExistingFiles;
 }
开发者ID:rixxi,项目名称:template-locator,代码行数:19,代码来源:CachedTemplateLocator.php

示例7: onFlush

 /**
  * @param \Doctrine\ORM\Event\OnFlushEventArgs $eventArgs
  */
 public function onFlush(OnFlushEventArgs $eventArgs)
 {
     $em = $eventArgs->getEntityManager();
     $uow = $em->getUnitOfWork();
     $entities = array();
     foreach ($uow->getScheduledEntityInsertions() as $entity) {
         $class = $em->getClassMetadata(get_class($entity))->name;
         $entities[$class][] = $uow->getSingleIdentifierValue($entity);
     }
     foreach ($uow->getScheduledEntityUpdates() as $entity) {
         $class = $em->getClassMetadata(get_class($entity))->name;
         $entities[$class][] = $uow->getSingleIdentifierValue($entity);
     }
     foreach ($uow->getScheduledEntityDeletions() as $entity) {
         $class = $em->getClassMetadata(get_class($entity))->name;
         $entities[$class][] = $uow->getSingleIdentifierValue($entity);
     }
     foreach ($entities as $class => $ids) {
         foreach ($ids as $id) {
             $this->cache->clean($this->getDependencies($class, $id));
         }
     }
 }
开发者ID:venne,项目名称:data-transfer,代码行数:26,代码来源:CacheInvalidationListener.php

示例8: saveEvent

 public function saveEvent(\Nette\Forms\Controls\Button $button)
 {
     $form = $button->getForm();
     $values = $form->getValues();
     $place = $this->context->createServiceEvents()->wherePrimary($values->id);
     $place->update($values);
     $this->presenter->flashMessage('Done', 'success');
     $cache = new Cache($this->context->getService('cacheStorage'));
     $cache->clean(array(Cache::TAGS => array('events', 'event', 'term', 'terms')));
     if ($this->presenter->isAjax()) {
         $this->redrawControl('content');
         $this->presenter->redrawControl('flash');
     } else {
         $this->redirect('this');
     }
 }
开发者ID:soundake,项目名称:pd,代码行数:16,代码来源:AdminToolsEventControl.php

示例9: save

 /**
  * Save dictionary
  * @param string
  */
 public function save($file)
 {
     if (!$this->loaded) {
         throw new Nette\InvalidStateException('Nothing to save, translations are not loaded.');
     }
     if (!isset($this->files[$file])) {
         throw new \InvalidArgumentException("Gettext file identified as '{$file}' does not exist.");
     }
     $dir = $this->files[$file];
     $path = "{$dir}/{$this->lang}.{$file}";
     $this->buildMOFile("{$path}.mo", $file);
     $this->buildPOFile("{$path}.po", $file);
     if (isset($this->sessionStorage->newStrings[$this->lang])) {
         unset($this->sessionStorage->newStrings[$this->lang]);
     }
     if ($this->productionMode) {
         $this->cache->clean(array('tags' => 'dictionary-' . $this->lang));
     }
 }
开发者ID:salamek,项目名称:gettexttranslator,代码行数:23,代码来源:Gettext.php

示例10: save

 /**
  * Save dictionary
  * @param string
  */
 public function save($file)
 {
     if (!$this->loaded) {
         throw new Nette\InvalidStateException('Nothing to save, translations are not loaded.');
     }
     if (!isset($this->files[$file])) {
         throw new \InvalidArgumentException("Gettext file identified as '{$file}' does not exist.");
     }
     $dir = $this->files[$file];
     $path = "{$dir}/{$this->lang}.{$file}";
     $metadata = $this->fileManager->generateMetadata($file, $this->metadata);
     $newStrings = $this->debugMode === true && isset($this->sessionStorage->newStrings[$this->lang]) ? $this->sessionStorage->newStrings[$this->lang] : array();
     $this->fileManager->buildMOFile("{$path}.mo", $file, $metadata, $this->dictionary);
     $this->fileManager->buildPOFile("{$path}.po", $file, $metadata, $this->dictionary, $newStrings);
     if ($this->debugMode === true && isset($this->sessionStorage->newStrings[$this->lang])) {
         unset($this->sessionStorage->newStrings[$this->lang]);
     }
     if ($this->productionMode) {
         $this->cache->clean(array(Cache::TAGS => 'dictionary-' . $this->lang));
     }
 }
开发者ID:klimesf,项目名称:gettext-translator,代码行数:25,代码来源:Gettext.php

示例11: invalidate

 /**
  * @param $class
  * @param $entity
  * @param $mode
  */
 protected function invalidate($class, $entity, $mode)
 {
     if (defined("\\{$class}::CACHE")) {
         $this->cache->clean(array(Cache::TAGS => $class::CACHE));
     }
     if ($entity instanceof \CmsModule\Content\Entities\PageEntity || $entity instanceof \CmsModule\Content\Entities\ExtendedPageEntity && ($entity = $entity->page)) {
         $this->cache->clean(array(Cache::TAGS => array('pages', 'page-' . $mode, 'page-' . $entity->id)));
     } elseif ($entity instanceof \CmsModule\Content\Entities\RouteEntity || $entity instanceof \CmsModule\Content\Entities\ExtendedRouteEntity && ($entity = $entity->route)) {
         $this->cache->clean(array(Cache::TAGS => array('routes', 'route-' . $mode, 'route-' . $entity->id)));
     } elseif ($entity instanceof \CmsModule\Content\Elements\ElementEntity || $entity instanceof \CmsModule\Content\Elements\ExtendedElementEntity && ($entity = $entity->element)) {
         $this->cache->clean(array(Cache::TAGS => array('elements', 'element-' . $mode, 'element-' . $entity->id)));
         if ($entity->mode === $entity::MODE_LAYOUT) {
             foreach ($entity->layout->routes as $route) {
                 $this->cache->clean(array(Cache::TAGS => array('routes', 'route-update', 'route-' . $route->id)));
             }
         } elseif ($entity->mode === $entity::MODE_PAGE) {
             $this->cache->clean(array(Cache::TAGS => array('pages', 'page-update', 'page-' . $entity->page->id)));
         } elseif ($entity->mode === $entity::MODE_ROUTE) {
             $this->cache->clean(array(Cache::TAGS => array('routes', 'route-update', 'page-' . $entity->route)));
         } else {
             $this->cache->clean(array(Cache::TAGS => array('routes', 'route-update', 'pages', 'page-update')));
         }
     }
 }
开发者ID:svobodni,项目名称:web,代码行数:29,代码来源:PageListener.php

示例12: clean

 /**
  * Remove all items cached by WebLoader
  *
  * @param array $conditions
  */
 public function clean(array $conditions = NULL)
 {
     parent::clean([self::TAGS => ['webloader']]);
 }
开发者ID:lohini,项目名称:webloader,代码行数:9,代码来源:Cache.php

示例13: languageFormSuccess

 public function languageFormSuccess()
 {
     if (function_exists('opcache_reset')) {
         opcache_reset();
     }
     $cache = new Cache($this->cacheStorage, 'Nette.Configurator');
     $cache->clean();
     $this->redirect('Installation:');
 }
开发者ID:svobodni,项目名称:web,代码行数:9,代码来源:InstallationPresenter.php

示例14: invalidateCache

 public function invalidateCache()
 {
     $this->cache->clean([Cache::ALL => TRUE]);
 }
开发者ID:kdyby,项目名称:translation,代码行数:4,代码来源:CatalogueCompiler.php

示例15: clear

 /**
  * @param string $namespace
  * @param string $name
  */
 public function clear($namespace, $name)
 {
     $this->cache->clean([Cache::TAGS => [$namespace . '/' . $name]]);
 }
开发者ID:josefzajac,项目名称:Nette-ImagesManager,代码行数:8,代码来源:CachedStorage.php


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