diff --git a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php index 2cdcdfb..5e532c2 100644 --- a/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php +++ b/core/lib/Drupal/Core/Entity/FieldableDatabaseStorageController.php @@ -60,22 +60,6 @@ class FieldableDatabaseStorageController extends FieldableEntityStorageControlle protected $revisionDataTable; /** - * Whether this entity type should use the static cache. - * - * @var boolean - */ - protected $staticCache; - - /** - * Whether this entity type should use the persistent cache. - * - * Set by entity info. - * - * @var boolean - */ - protected $persistentCache; - - /** * Holds statically cached entities. * * @var array @@ -148,10 +132,6 @@ public function __construct(EntityTypeInterface $entity_type, Connection $databa $this->fieldInfo = $field_info; $this->cacheBackend = $cache; - // Check if the entity type supports caching of loaded entities. - $this->staticCache = $this->entityType->isStaticallyCacheable(); - $this->persistentCache = $this->entityType->isFieldDataCacheable(); - // Check if the entity type supports IDs. if ($this->entityType->hasKey('id')) { $this->idKey = $this->entityType->getKey('id'); @@ -276,7 +256,7 @@ protected function getFromStorage(array $ids = NULL) { protected function getFromStaticCache(&$ids) { $entities = array(); - if ($this->staticCache && $ids) { + if ($this->entityType->isStaticallyCacheable() && $ids) { $entities = array(); // Load any available entities from the internal cache. if (!empty($this->entities)) { @@ -299,7 +279,7 @@ protected function getFromStaticCache(&$ids) { * Entities to store in the cache. */ protected function setStaticCache(array $entities) { - if ($this->staticCache) { + if ($this->entityType->isStaticallyCacheable()) { $this->entities += $entities; } } @@ -315,7 +295,7 @@ protected function setStaticCache(array $entities) { * Array of entities from the entity cache. */ protected function getFromPersistentCache(&$ids) { - if (!$this->persistentCache || empty($ids)) { + if (!$this->entityType->isFieldDataCacheable() || empty($ids)) { return array(); } $entities = array(); @@ -347,7 +327,7 @@ protected function getFromPersistentCache(&$ids) { * Entities to store in the cache. */ protected function setPersistentCache($entities) { - if (!$this->persistentCache) { + if (!$this->entityType->isFieldDataCacheable()) { return; } @@ -393,13 +373,13 @@ public function resetCache(array $ids = NULL) { unset($this->entities[$id]); $cids[] = $this->buildCacheId($id); } - if ($this->persistentCache) { + if ($this->entityType->isFieldDataCacheable()) { $this->cacheBackend->deleteMultiple($cids); } } else { $this->entities = array(); - if ($this->persistentCache) { + if ($this->entityType->isFieldDataCacheable()) { $this->cacheBackend->deleteTags(array($this->entityTypeId . '_values' => TRUE)); } }