public function loadByIdentifier($identifier)
{
// Get identifier to id cache if there is one (avoids caching an object several times)
$cache = $this->cache->getItem('contentType', 'identifier', $identifier);
$typeId = $cache->get();
if ($cache->isMiss()) {
$this->logger->logCall(__METHOD__, array('type' => $identifier));
$type = $this->persistenceHandler->contentTypeHandler()->loadByIdentifier($identifier);
$cache->set($type->id)->save();
// Warm contentType cache in case it's not set
$this->cache->getItem('contentType', $type->id)->set($type)->save();
} else {
// Reuse load() if we have id (it should be cached anyway)
$type = $this->load($typeId);
}
return $type;
}