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


PHP Cache::delete方法代码示例

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


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

示例1: indexAction

 /**
  * @Route("/entry-point/{mac}", defaults={"mac" = null})
  * @Method({"GET", "POST"})
  * @Template()
  */
 public function indexAction(Request $request, $mac)
 {
     // Attempting to do anything here as a logged in user will fail. Set the current user token to null to log user out.
     $this->get('security.token_storage')->setToken(null);
     if (!$mac) {
         if (!$request->getSession()->get('auth-data')) {
             // No MAC code, nothing in the session, so we can't help - return to front page.
             return $this->redirectToRoute('barbon_hostedapi_app_index_index');
         }
     } else {
         $cacheKey = sprintf('mac-%s', $mac);
         // If MAC isn't found in the cache, it's already been processed - redirect back to this route without the MAC, and try again.
         if (!$this->cache->contains($cacheKey)) {
             return $this->redirectToRoute('barbon_hostedapi_landlord_authentication_entrypoint_index');
         }
         // store data to session and empty the cache
         $authData = unserialize($this->cache->fetch($cacheKey));
         $request->getSession()->set('auth-data', $authData);
         $this->cache->delete($cacheKey);
     }
     // Decide which tab should start as visible, so that is a registration attempt is in progress it re-shows that tab.
     $selectedTab = $request->query->get('action') ?: 'register';
     if ($request->isMethod(Request::METHOD_POST)) {
         if ($request->request->has('direct_landlord')) {
             $selectedTab = 'register';
         }
     }
     return array('selectedTab' => $selectedTab);
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:34,代码来源:EntryPointController.php

示例2: removeTags

 /**
  * {@inheritdoc}
  */
 public function removeTags(array $tags)
 {
     foreach ($tags as $tag) {
         // doctrine does not care if the key does not exist.
         $this->cache->delete($tag);
     }
 }
开发者ID:dantleech,项目名称:sf-http-cache-tagging,代码行数:10,代码来源:DoctrineCache.php

示例3: getMetadataForClass

 /**
  * Get metadata for a certain class - loads once and caches
  * @param  string                $className
  * @throws \Drest\DrestException
  * @return ClassMetaData         $metaData
  */
 public function getMetadataForClass($className)
 {
     if (isset($this->loadedMetadata[$className])) {
         return $this->loadedMetadata[$className];
     }
     // check the cache
     if ($this->cache !== null) {
         $classMetadata = $this->cache->fetch($this->cache_prefix . $className);
         if ($classMetadata instanceof ClassMetaData) {
             if ($classMetadata->expired()) {
                 $this->cache->delete($this->cache_prefix . $className);
             } else {
                 $this->loadedMetadata[$className] = $classMetadata;
                 return $classMetadata;
             }
         }
     }
     $classMetadata = $this->driver->loadMetadataForClass($className);
     if ($classMetadata !== null) {
         $this->loadedMetadata[$className] = $classMetadata;
         if ($this->cache !== null) {
             $this->cache->save($this->cache_prefix . $className, $classMetadata);
         }
         return $classMetadata;
     }
     if (is_null($this->loadedMetadata[$className])) {
         throw DrestException::unableToLoadMetaDataFromDriver();
     }
     return $this->loadedMetadata[$className];
 }
开发者ID:steve-todorov,项目名称:drest,代码行数:36,代码来源:MetadataFactory.php

示例4: removeObject

 public function removeObject($object)
 {
     $class = $this->getClassMetadata();
     $identifier = $this->getObjectIdentifier($object);
     $identifier = $identifier[$class->identifier[0]];
     $this->cache->delete($identifier);
 }
开发者ID:basuritas-php,项目名称:skeleton-mapper,代码行数:7,代码来源:CacheObjectPersister.php

示例5: deleteItem

 /**
  * {@inheritdoc}
  */
 public function deleteItem($key)
 {
     if (!is_string($key)) {
         throw new InvalidArgumentException('Passed key is invalid');
     }
     return $this->cache->delete($key);
 }
开发者ID:aequasi,项目名称:psr-6-cache,代码行数:10,代码来源:CachePoolItem.php

示例6: stop

 /**
  * {@inheritdoc}
  */
 public function stop($token)
 {
     if (!$this->exists($token)) {
         return;
     }
     $this->dataCache->delete($token);
 }
开发者ID:sulu,项目名称:sulu,代码行数:10,代码来源:Preview.php

示例7: internalRemoveItem

 /**
  * {@inheritDoc}
  */
 protected function internalRemoveItem(&$normalizedKey)
 {
     $key = $this->getOptions()->getNamespace() . $normalizedKey;
     if (!$this->cache->contains($key)) {
         return false;
     }
     return $this->cache->delete($key);
 }
开发者ID:antoinealej,项目名称:HomeStuff,代码行数:11,代码来源:DoctrineCacheStorage.php

示例8: persistConfig

 /**
  * @param PersistConfigEvent $event
  */
 public function persistConfig(PersistConfigEvent $event)
 {
     $event->getConfigManager()->calculateConfigChangeSet($event->getConfig());
     $change = $event->getConfigManager()->getConfigChangeSet($event->getConfig());
     if ($event->getConfig()->getId()->getScope() == 'email' && isset($change['available_in_template'])) {
         $this->cache->delete($this->cacheKey);
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:11,代码来源:ConfigSubscriber.php

示例9: ok

 /**
  * Set the state.
  *
  * @param bool        $ok
  * @param string|null $name
  */
 public function ok($ok, $name = null)
 {
     $ok = (bool) $ok;
     $key = $this->getCacheKey($name);
     if ($ok === true) {
         $this->cache->delete($key);
     } else {
         $this->cache->save($key, 1, $this->ttl);
     }
 }
开发者ID:trademachines,项目名称:guzzle5-circuit-breaker,代码行数:16,代码来源:State.php

示例10: persistConfig

 /**
  * @param PersistConfigEvent $event
  */
 public function persistConfig(PersistConfigEvent $event)
 {
     $config = $event->getConfig();
     if ($config->getId()->getScope() !== 'email') {
         return;
     }
     $change = $event->getConfigManager()->getConfigChangeSet($config);
     if (isset($change['available_in_template'])) {
         $this->cache->delete($this->cacheKey);
     }
 }
开发者ID:northdakota,项目名称:platform,代码行数:14,代码来源:ConfigSubscriber.php

示例11: preFlush

 /**
  * @param PreFlushConfigEvent $event
  */
 public function preFlush(PreFlushConfigEvent $event)
 {
     $config = $event->getConfig('email');
     if (null === $config || $event->isEntityConfig()) {
         return;
     }
     $changeSet = $event->getConfigManager()->getConfigChangeSet($config);
     if (isset($changeSet['available_in_template'])) {
         $this->cache->delete($this->cacheKey);
     }
 }
开发者ID:ramunasd,项目名称:platform,代码行数:14,代码来源:EntityConfigListener.php

示例12: reset

 public function reset($class = null)
 {
     if ($class === null) {
         if ($this->cacheProvider instanceof \Doctrine\Common\Cache\FlushableCache) {
             $this->cacheProvider->flushAll();
         }
         return parent::reset($class);
     }
     $id = $class . '#info';
     $this->cacheProvider->delete($id);
     return parent::reset($class);
 }
开发者ID:johnarben2468,项目名称:sampleffuf-core,代码行数:12,代码来源:CacheContainer.php

示例13: invalidate

 /** @inheritdoc */
 public function invalidate($restaurantId)
 {
     if ($this->cache->contains($restaurantId)) {
         $cached = $this->cache->fetch($restaurantId)['cached']->getTimestamp();
         $now = (new \DateTime())->getTimestamp();
         if ($now - $cached < 60) {
             throw new EnhanceYourCalmException();
         }
         $this->cache->delete($restaurantId);
         return true;
     }
     return false;
 }
开发者ID:tomaskadlec,项目名称:lunch_guy,代码行数:14,代码来源:CachedApplication.php

示例14: removePathAndFilter

 protected function removePathAndFilter($path, $filter)
 {
     $indexKey = $this->generateIndexKey($this->generateCacheKey($path, $filter));
     if (!$this->cache->contains($indexKey)) {
         return;
     }
     $index = $this->cache->fetch($indexKey);
     if (null === $path) {
         foreach ($index as $eachCacheKey) {
             $this->cache->delete($eachCacheKey);
         }
         $index = array();
     } else {
         $cacheKey = $this->generateCacheKey($path, $filter);
         if (false !== ($indexIndex = array_search($cacheKey, $index))) {
             unset($index[$indexIndex]);
             $this->cache->delete($cacheKey);
         }
     }
     if (empty($index)) {
         $this->cache->delete($indexKey);
     } else {
         $this->cache->save($indexKey, $index);
     }
 }
开发者ID:sanchojaf,项目名称:oldmytriptocuba,代码行数:25,代码来源:CacheResolver.php

示例15: removeRolePermission

 /**
  * {@inheritdoc}
  */
 public function removeRolePermission(Role $role, Permission $permission)
 {
     $this->driver->removeRolePermission($role, $permission);
     // Invalidate cache
     $cacheId = sprintf('roles/%s', $role->getRoleName());
     $this->cache->delete($cacheId);
 }
开发者ID:guardianphp,项目名称:lock-cache,代码行数:10,代码来源:DoctrineCacheDriver.php


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