當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。