/** * Implements \Drupal\Core\Path\AliasManagerInterface::cacheClear(). */ public function cacheClear($source = NULL) { if ($source) { foreach (array_keys($this->lookupMap) as $lang) { unset($this->lookupMap[$lang][$source]); } } else { $this->lookupMap = array(); } $this->noPath = array(); $this->noAlias = array(); $this->langcodePreloaded = array(); $this->preloadedPathLookups = array(); $this->cache->delete($this->cacheKey); $this->pathAliasWhitelistRebuild($source); }
/** * Writes the cache of relation links. * * @param array $context * Context from the normalizer/serializer operation. */ protected function writeCache($context = array()) { $data = array(); foreach ($this->entityManager->getDefinitions() as $entity_type) { if ($entity_type instanceof ContentEntityTypeInterface) { foreach ($this->entityManager->getBundleInfo($entity_type->id()) as $bundle => $bundle_info) { foreach ($this->entityManager->getFieldDefinitions($entity_type->id(), $bundle) as $field_definition) { $relation_uri = $this->getRelationUri($entity_type->id(), $bundle, $field_definition->getName(), $context); $data[$relation_uri] = array('entity_type' => $entity_type, 'bundle' => $bundle, 'field_name' => $field_definition->getName()); } } } } // These URIs only change when field info changes, so cache it permanently // and only clear it when the fields cache is cleared. $this->cache->set('rest:links:relations', $data, Cache::PERMANENT, array('entity_field_info')); }
/** * Writes the cache of type links. * * @param array $context * Context from the normalizer/serializer operation. */ protected function writeCache($context = array()) { $data = array(); // Type URIs correspond to bundles. Iterate through the bundles to get the // URI and data for them. $entity_types = \Drupal::entityManager()->getDefinitions(); foreach (entity_get_bundles() as $entity_type_id => $bundles) { // Only content entities are supported currently. // @todo Consider supporting config entities. if ($entity_types[$entity_type_id]->isSubclassOf('\\Drupal\\Core\\Config\\Entity\\ConfigEntityInterface')) { continue; } foreach ($bundles as $bundle => $bundle_info) { // Get a type URI for the bundle. $bundle_uri = $this->getTypeUri($entity_type_id, $bundle, $context); $data[$bundle_uri] = array('entity_type' => $entity_type_id, 'bundle' => $bundle); } } // These URIs only change when entity info changes, so cache it permanently // and only clear it when entity_info is cleared. $this->cache->set('rest:links:types', $data, Cache::PERMANENT, array('entity_types')); }