diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index 1804fb6..b765cc2 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -65,7 +65,7 @@ public function get($cid, $allow_invalid = FALSE) { public function getMultiple(&$cids, $allow_invalid = FALSE) { $cid_mapping = array(); foreach ($cids as $cid) { - $cid_mapping[$this->ensureCidLength($cid)] = $cid; + $cid_mapping[$this->normalizeCid($cid)] = $cid; } // When serving cached pages, the overhead of using ::select() was found // to add around 30% overhead to the request. Since $this->bin is a @@ -203,7 +203,7 @@ protected function doSet($cid, $data, $expire, $tags) { } $this->connection->merge($this->bin) - ->key('cid', $this->ensureCidLength($cid)) + ->key('cid', $this->normalizeCid($cid)) ->fields($fields) ->execute(); } @@ -291,7 +291,7 @@ public function delete($cid) { * Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple(). */ public function deleteMultiple(array $cids) { - $cids = array_values(array_map(array($this, 'ensureCidLength'), $cids)); + $cids = array_values(array_map(array($this, 'normalizeCid'), $cids)); try { // Delete in chunks when a large array is passed. foreach (array_chunk($cids, 1000) as $cids_chunk) { @@ -364,7 +364,7 @@ public function invalidate($cid) { * Implements Drupal\Core\Cache\CacheBackendInterface::invalideMultiple(). */ public function invalidateMultiple(array $cids) { - $cids = array_values(array_map(array($this, 'ensureCidLength'), $cids)); + $cids = array_values(array_map(array($this, 'normalizeCid'), $cids)); try { // Update in chunks when a large array is passed. foreach (array_chunk($cids, 1000) as $cids_chunk) { @@ -556,7 +556,7 @@ protected function catchException(\Exception $e, $table_name = NULL) { } /** - * Ensures that cache IDs are valid. + * Ensures that cache IDs have a maximum length of 255 characters. * * @param string $cid * The passed in cache ID. @@ -564,7 +564,7 @@ protected function catchException(\Exception $e, $table_name = NULL) { * @return string * A cache ID that is at most 255 characters long. */ - protected function ensureCidLength($cid) { + protected function normalizeCid($cid) { // Nothing to do if the ID length is 255 characters or less. if (strlen($cid) <= 255) { return $cid;