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


PHP CacheBackendInterface::delete方法代码示例

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


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

示例1: onFieldDefinitionDelete

 /**
  * {@inheritdoc}
  */
 public function onFieldDefinitionDelete(FieldDefinitionInterface $field_definition)
 {
     $entity_type_id = $field_definition->getTargetEntityTypeId();
     $bundle = $field_definition->getTargetBundle();
     $field_name = $field_definition->getName();
     // Notify the storage about the field deletion.
     $this->entityTypeManager->getStorage($entity_type_id)->onFieldDefinitionDelete($field_definition);
     // Unset the bundle from the bundle field map key value collection.
     $bundle_field_map = $this->keyValueFactory->get('entity.definitions.bundle_field_map')->get($entity_type_id);
     unset($bundle_field_map[$field_name]['bundles'][$bundle]);
     if (empty($bundle_field_map[$field_name]['bundles'])) {
         // If there are no bundles left, remove the field from the map.
         unset($bundle_field_map[$field_name]);
     }
     $this->keyValueFactory->get('entity.definitions.bundle_field_map')->set($entity_type_id, $bundle_field_map);
     // Delete the cache entry.
     $this->cacheBackend->delete('entity_field_map');
     // If the field map is initialized, update it as well, so that calls to it
     // do not have to rebuild it again.
     if ($field_map = $this->entityFieldManager->getFieldMap()) {
         unset($field_map[$entity_type_id][$field_name]['bundles'][$bundle]);
         if (empty($field_map[$entity_type_id][$field_name]['bundles'])) {
             unset($field_map[$entity_type_id][$field_name]);
         }
         $this->entityFieldManager->setFieldMap($field_map);
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:30,代码来源:FieldDefinitionListener.php

示例2: onRequestSent

 /**
  * Responds after a request has finished, but before it is sent to the client.
  *
  * @param \Guzzle\Common\Event $event
  *   The Guzzle event object.
  */
 public function onRequestSent(Event $event)
 {
     $request = $event['request'];
     $response = $event['response'];
     // Handle permanent redirects by setting the redirected URL so that the
     // client can grab it quickly.
     $redirect = FALSE;
     $url = $old_url = $request->getUrl();
     if ($previous_response = $response->getPreviousResponse()) {
         if ($previous_response->getStatusCode() == 301 && ($location = $previous_response->getLocation())) {
             $response->getParams()->set('feeds.redirect', $location);
             $redirect = TRUE;
             $url = $request->getUrl();
         }
     }
     $cache_hit = $response->getStatusCode() == 304;
     if ($redirect) {
         // Delete the old cache entry.
         $this->cacheBackend->delete($this->getCacheKey($old_url));
         // Not sure if the repeated requests are smart enough to find the
         // redirect, so cache the old URL with the new response.
         static::$downloadCache[$old_url] = $response;
     }
     if ($redirect || !$cache_hit) {
         $cache = new \stdClass();
         $cache->headers = array_change_key_case($response->getHeaders()->toArray());
         // @todo We should only cache for certain status codes.
         $cache->code = $response->getStatusCode();
         $this->cacheBackend->set($this->getCacheKey($url), $cache);
     }
     // Set in-page download cache.
     static::$downloadCache[$url] = $response;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:39,代码来源:CachePlugin.php

示例3: clear

 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     $this->reset();
     if ($this->tags) {
         Cache::invalidateTags($this->tags);
     } else {
         $this->cache->delete($this->getCid());
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:CacheCollector.php

示例4: clear

 /**
  * {@inheritdoc}
  */
 public function clear()
 {
     $this->reset();
     if ($this->tags) {
         Cache::deleteTags($this->tags);
     } else {
         $this->cache->delete($this->cid);
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:12,代码来源:CacheCollector.php

示例5: clearCachedDefinitions

 /**
  * {@inheritdoc}
  */
 public function clearCachedDefinitions()
 {
     if ($this->cacheBackend) {
         if ($this->cacheTags) {
             // Use the cache tags to clear the cache.
             Cache::invalidateTags($this->cacheTags);
         } else {
             $this->cacheBackend->delete($this->cacheKey);
         }
     }
     $this->definitions = NULL;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:15,代码来源:DefaultPluginManager.php

示例6: rename

 /**
  * {@inheritdoc}
  */
 public function rename($name, $new_name)
 {
     // If the cache was the first to be deleted, another process might start
     // rebuilding the cache before the storage is renamed.
     if ($this->storage->rename($name, $new_name)) {
         $this->cache->delete($this->getCacheKey($name));
         $this->cache->delete($this->getCacheKey($new_name));
         $this->findByPrefixCache = array();
         return TRUE;
     }
     return FALSE;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:15,代码来源:CachedStorage.php

示例7: rename

 /**
  * Implements Drupal\Core\Config\StorageInterface::rename().
  */
 public function rename($name, $new_name)
 {
     // If the cache was the first to be deleted, another process might start
     // rebuilding the cache before the storage is renamed.
     if ($this->storage->rename($name, $new_name)) {
         $this->cache->delete($name);
         $this->cache->delete($new_name);
         Cache::deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
         $this->findByPrefixCache = array();
         return TRUE;
     }
     return FALSE;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:16,代码来源:CachedStorage.php

示例8: expireFiles

 /**
  * Submit handler that explicitly clears cache_example_files_count from cache.
  */
 public function expireFiles($form, &$form_state)
 {
     // Clear cached data. This function will delete cached object from cache
     // bin.
     //
     // The first argument is cache id to be deleted. Since we've provided it
     // explicitly, it will be removed whether or not it has an associated
     // expiration time. The second argument (required here) is the cache bin.
     // Using cache_clear_all() explicitly in this way
     // forces removal of the cached item.
     $this->cacheBackend->delete('cache_example_files_count');
     // Display message to the user.
     drupal_set_message($this->t('Cached data key "cache_example_files_count" was cleared.'), 'status');
 }
开发者ID:viljaste,项目名称:viljaste.xyz,代码行数:17,代码来源:CacheExampleForm.php

示例9: resetImplementations

 /**
  * {@inheritdoc}
  */
 public function resetImplementations()
 {
     $this->implementations = NULL;
     $this->hookInfo = NULL;
     $this->alterFunctions = NULL;
     // We maintain a persistent cache of hook implementations in addition to the
     // static cache to avoid looping through every module and every hook on each
     // request. Benchmarks show that the benefit of this caching outweighs the
     // additional database hit even when using the default database caching
     // backend and only a small number of modules are enabled. The cost of the
     // $this->cacheBackend->get() is more or less constant and reduced further
     // when non-database caching backends are used, so there will be more
     // significant gains when a large number of modules are installed or hooks
     // invoked, since this can quickly lead to
     // \Drupal::moduleHandler()->implementsHook() being called several thousand
     // times per request.
     $this->cacheBackend->set('module_implements', array());
     $this->cacheBackend->delete('hook_info');
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:22,代码来源:ModuleHandler.php

示例10: onFeedDeleteMultiple

 /**
  * {@inheritdoc}
  */
 public function onFeedDeleteMultiple(array $feeds)
 {
     foreach ($feeds as $feed) {
         $this->cache->delete($this->getCacheKey($feed));
     }
 }
开发者ID:Tawreh,项目名称:mtg,代码行数:9,代码来源:HttpFetcher.php

示例11: delete

 /**
  * {@inheritdoc}
  */
 protected function delete($name)
 {
     $this->cache->delete($name);
     unlink($this->fileStorage->getFilePath($name));
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:8,代码来源:CachedStorageTest.php

示例12: clearCaptchaPlacementCacheSubmit

 /**
  * Submit callback; clear CAPTCHA placement cache.
  *
  * @param array $form
  *   Form structured array.
  * @param FormStateInterface $form_state
  *   Form state structured array.
  */
 public function clearCaptchaPlacementCacheSubmit(array $form, FormStateInterface $form_state)
 {
     $this->cacheBackend->delete('captcha_placement_map_cache');
     drupal_set_message($this->t('Cleared the CAPTCHA placement cache.'));
 }
开发者ID:Wylbur,项目名称:gj,代码行数:13,代码来源:CaptchaSettingsForm.php

示例13: clearCache

 /**
  * {@inheritdoc}
  */
 public function clearCache()
 {
     $this->map = NULL;
     $this->cache->delete('commerce_product.line_item_type_map');
 }
开发者ID:alexburrows,项目名称:cream-2.x,代码行数:8,代码来源:LineItemTypeMap.php

示例14: delete

 /**
  * {@inheritdoc}
  */
 public function delete($cid)
 {
     return $this->cacheBackend->delete($cid);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:7,代码来源:CacheBackendWrapper.php

示例15: clearCachedDefinitions

 /**
  * {@inheritdoc}
  */
 public function clearCachedDefinitions()
 {
     $this->definitions = NULL;
     $this->schemaStorage->reset();
     $this->cache->delete($this::CACHE_ID);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:9,代码来源:TypedConfigManager.php


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