core/lib/Drupal/Core/Cache/PhpBackend.php | 2 +- core/modules/book/src/BookManager.php | 12 +++++++----- .../comment/tests/src/Unit/Entity/CommentLockTest.php | 4 ++-- core/modules/locale/locale.module | 2 +- core/modules/locale/src/LocaleLookup.php | 2 +- core/modules/views/src/ViewsData.php | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/core/lib/Drupal/Core/Cache/PhpBackend.php b/core/lib/Drupal/Core/Cache/PhpBackend.php index 26117f3..26eaf7e 100644 --- a/core/lib/Drupal/Core/Cache/PhpBackend.php +++ b/core/lib/Drupal/Core/Cache/PhpBackend.php @@ -140,7 +140,7 @@ public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array 'expire' => $expire, 'tags' => $tags, ); - Cache::validateTags($item['tags']); + Cache::validateTags($item->tags); $this->writeItem($this->normalizeCid($cid), $item); } diff --git a/core/modules/book/src/BookManager.php b/core/modules/book/src/BookManager.php index ad906ed..a5ef6d1 100644 --- a/core/modules/book/src/BookManager.php +++ b/core/modules/book/src/BookManager.php @@ -451,7 +451,7 @@ public function deleteFromBook($nid) { } $this->updateOriginalParent($original); $this->books = NULL; - \Drupal::cache('data')->deleteTags(array('bid' => $original['bid'])); + \Drupal::cache('data')->deleteTags(array('bid:' . $original['bid'])); } /** @@ -666,7 +666,7 @@ protected function doBookTreeBuild($bid, array $parameters = array()) { $this->bookTreeCollectNodeLinks($data['tree'], $data['node_links']); // Cache the data, if it is not already in the cache. - \Drupal::cache('data')->set($tree_cid, $data, Cache::PERMANENT, array('bid' => $bid)); + \Drupal::cache('data')->set($tree_cid, $data, Cache::PERMANENT, array('bid:' . $bid)); $trees[$tree_cid] = $data; } @@ -802,9 +802,11 @@ public function saveBookLink(array $link, $new) { $query->condition('nid', $link['nid']); $query->execute(); } + $cache_tags = []; foreach ($affected_bids as $bid) { - \Drupal::cache('data')->deleteTags(array('bid' => $bid)); + $cache_tags[] = 'bid:' . $bid; } + \Drupal::cache('data')->deleteTags($cache_tags); return $link; } @@ -1124,10 +1126,10 @@ public function bookSubtreeData($link) { // Cache the data, if it is not already in the cache. if (!\Drupal::cache('data')->get($tree_cid)) { - \Drupal::cache('data')->set($tree_cid, $data, Cache::PERMANENT, array('bid' => $link['bid'])); + \Drupal::cache('data')->set($tree_cid, $data, Cache::PERMANENT, array('bid:' . $link['bid'])); } // Cache the cid of the (shared) data using the book and item-specific cid. - \Drupal::cache('data')->set($cid, $tree_cid, Cache::PERMANENT, array('bid' => $link['bid'])); + \Drupal::cache('data')->set($cid, $tree_cid, Cache::PERMANENT, array('bid:' . $link['bid'])); } // Check access for the current user to each item in the tree. $this->bookTreeCheckAccess($data['tree'], $data['node_links']); diff --git a/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php b/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php index a540a7e..aef189e 100644 --- a/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php +++ b/core/modules/comment/tests/src/Unit/Entity/CommentLockTest.php @@ -81,10 +81,10 @@ public function testLocks() { ->will($this->returnValue((object) array('value' => NULL))); $comment->expects($this->once()) ->method('getCacheTag') - ->will($this->returnValue(array('comment' => array($cid)))); + ->will($this->returnValue(array('comment:' . $cid))); $comment->expects($this->once()) ->method('getListCacheTags') - ->will($this->returnValue(array('comments' => TRUE))); + ->will($this->returnValue(array('comments'))); $storage = $this->getMock('Drupal\comment\CommentStorageInterface'); // preSave() should acquire the lock. (This is what's really being tested.) diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index 11ffc27..aa42fc6 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -1073,7 +1073,7 @@ function _locale_refresh_translations($langcodes, $lids = array()) { } } // Clear locale cache. - Cache::deleteTags(array('locale' => TRUE)); + Cache::deleteTags(array('locale')); } /** diff --git a/core/modules/locale/src/LocaleLookup.php b/core/modules/locale/src/LocaleLookup.php index 2f03bc3..8aa1809 100644 --- a/core/modules/locale/src/LocaleLookup.php +++ b/core/modules/locale/src/LocaleLookup.php @@ -94,7 +94,7 @@ public function __construct($langcode, $context, StringStorageInterface $string_ $this->cache = $cache; $this->lock = $lock; - $this->tags = array('locale' => TRUE); + $this->tags = array('locale'); } /** diff --git a/core/modules/views/src/ViewsData.php b/core/modules/views/src/ViewsData.php index 9dbef6b..cfbf254 100644 --- a/core/modules/views/src/ViewsData.php +++ b/core/modules/views/src/ViewsData.php @@ -310,6 +310,6 @@ public function clear() { $this->storage = array(); $this->allStorage = array(); $this->fullyLoaded = FALSE; - Cache::deleteTags(array('views_data' => TRUE)); + Cache::deleteTags(array('views_data')); } }