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


PHP CacheBackendInterface::invalidate方法代码示例

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


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

示例1: invalidateCache

 /**
  * Invalidate the cache.
  */
 protected function invalidateCache()
 {
     // Invalidate the cache to make sure that other requests immediately see the
     // deletion before this request is terminated.
     $this->cache->invalidate($this->getCid());
     $this->cacheInvalidated = TRUE;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:CacheCollector.php

示例2: invalidate

 /**
  * {@inheritdoc}
  */
 public function invalidate($cid)
 {
     $cid = $this->decorate($cid);
     return $this->decorated->invalidate($cid);
 }
开发者ID:sedurzu,项目名称:ildeposito8,代码行数:8,代码来源:CacheBackendDecorator.php

示例3: clearCountryList

 /**
  * Submit callback for 'Clear supported country list' button
  */
 public function clearCountryList()
 {
     $this->cache->invalidate('location:supported-countries');
     drupal_set_message(t('Location supported country list cleared.'));
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:8,代码来源:DmapsUtilForm.php

示例4: enableEntityTypes

 /**
  * {@inheritdoc}
  *
  * @todo Ensure nothing breaks if the migration is run twice.
  */
 public function enableEntityTypes()
 {
     $entity_types = $this->getSupportedEntityTypes();
     $migration = $this->createMigration();
     $migration->installDependencies();
     // For data integrity and consistency reasons we need to finish each
     // migration step for all entity types before moving on to the next step.
     $has_data = [];
     // Walk through and verify that the original storage is in good order.
     // Flakey contrib modules or mocked tests where some schemas aren't properly
     // installed should be ignored.
     foreach ($entity_types as $entity_type_id => $entity_type) {
         $storage = $this->entityManager->getStorage($entity_type_id);
         $has_data[$entity_type_id] = FALSE;
         try {
             if ($storage->hasData()) {
                 $has_data[$entity_type_id] = TRUE;
             }
         } catch (\Exception $e) {
             // Don't bother with this entity type any more.
             unset($entity_types[$entity_type_id]);
         }
     }
     // Migrate content to temporary storage.
     foreach ($entity_types as $entity_type_id => $entity_type) {
         if ($has_data[$entity_type_id]) {
             $migration->migrateContentToTemp($entity_type);
         }
     }
     // Because of the way the Entity API treats entity definition updates we
     // need to ensure each storage is empty before we can apply the new
     // definition.
     foreach ($entity_types as $entity_type_id => $entity_type) {
         if ($has_data[$entity_type_id]) {
             $storage = $this->entityManager->getStorage($entity_type_id);
             $migration->emptyOldStorage($entity_type, $storage);
         }
     }
     // Nasty workaround until {@link https://www.drupal.org/node/2549143 there
     // is a better way to invalidate caches in services}.
     // For some reason we have to clear cache on the "global" service as opposed
     // to the injected one. Services in the dark corners of Entity API won't see
     // the same result otherwise. Very strange.
     \Drupal::entityManager()->clearCachedDefinitions();
     foreach ($entity_types as $entity_type_id => $entity_type) {
         $cid = "entity_base_field_definitions:{$entity_type_id}:" . $this->languageManager->getCurrentLanguage()->getId();
         $this->cache->invalidate($cid);
     }
     self::migrationIsActive(TRUE);
     $migration->applyNewStorage();
     // Definitions will now be updated. So fetch the new ones.
     $entity_types = $this->getSupportedEntityTypes();
     foreach ($entity_types as $entity_type_id => $entity_type) {
         // Drop unique key from uuid on each entity type.
         $base_table = $entity_type->getBaseTable();
         $uuid_key = $entity_type->getKey('uuid');
         $this->connection->schema()->dropUniqueKey($base_table, $entity_type_id . '_field__' . $uuid_key . '__value');
         // Migrate from the temporary storage to the new shiny home.
         if ($has_data[$entity_type_id]) {
             $migration->migrateContentFromTemp($entity_type);
         }
         // Mark the migration for this particular entity type as done even if no
         // actual content was migrated.
         $this->state->set("multiversion.migration_done.{$entity_type_id}", TRUE);
     }
     // Clean up after us.
     $migration->uninstallDependencies();
     self::migrationIsActive(FALSE);
     // Mark the whole migration as done. Any entity types installed after this
     // will not need a migration since they will be created directly on top of
     // the Multiversion storage.
     $this->state->set('multiversion.migration_done', TRUE);
     // Another nasty workaround because the cache is getting skewed somewhere.
     // And resetting the cache on the injected state service does not work.
     // Very strange.
     \Drupal::state()->resetCache();
     return $this;
 }
开发者ID:sedurzu,项目名称:ildeposito8,代码行数:83,代码来源:MultiversionManager.php

示例5: invalidate

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


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