diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index 17a5d3bfdb8618fbed9d0da0a5aac2821af050e7..7e18e5bca1f4ad191abdc62ac9a0e93519a5bc04 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -1113,9 +1113,14 @@ protected function setPersistentCache($entities) { $this->entityTypeId . '_values', 'entity_field_info', ]; + $items = []; foreach ($entities as $id => $entity) { - $this->cacheBackend->set($this->buildCacheId($id), $entity, CacheBackendInterface::CACHE_PERMANENT, $cache_tags); + $items[$this->buildCacheId($id)] = [ + 'data' => $entity, + 'tags' => $cache_tags, + ]; } + $this->cacheBackend->setMultiple($items); } /** diff --git a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php index 185a68eda056e06b159c41095dcad85902db9b77..f256245a6786ac2b78c8f71956c54e0659844d83 100644 --- a/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php @@ -7,7 +7,6 @@ namespace Drupal\Tests\Core\Entity\Sql; -use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\MemoryCache\MemoryCache; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityFieldManager; @@ -1296,8 +1295,13 @@ public function testLoadMultiplePersistentCacheMiss() { ->with([$key]) ->willReturn([]); $this->cache->expects($this->once()) - ->method('set') - ->with($key, $entity, CacheBackendInterface::CACHE_PERMANENT, [$this->entityTypeId . '_values', 'entity_field_info']); + ->method('setMultiple') + ->with([ + $key => [ + 'data' => $entity, + 'tags' => [$this->entityTypeId . '_values', 'entity_field_info'], + ], + ]); $this->entityTypeManager->expects($this->any()) ->method('getActiveDefinition')