diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index 8a2d414..774ea05 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -175,6 +175,12 @@ public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array /** * Calculate a consistent-length cache ID. + * + * @param string $cid + * A cache ID of any length. + * + * @return string + * A base64 encoded hash of the cache ID. */ protected static function cidhash($cid) { return rtrim(base64_encode(hash('sha256', $cid, TRUE)), '='); @@ -580,14 +586,14 @@ public function schemaDefinition() { 'description' => 'Storage for the cache API.', 'fields' => array( 'cidhash' => array( - 'description' => 'Hash of the human-readable cid.', + 'description' => 'Hash of the human-readable cache ID.', 'type' => 'varchar', 'length' => $hash_length, // Use a more optimal data type for MySQL. 'mysql_type' => "BINARY($hash_length)", ), 'cid' => array( - 'description' => 'Original (human-readable) Cache ID.', + 'description' => 'Original (human-readable) cache ID.', 'type' => 'varchar', 'length' => 1000, 'not null' => TRUE, diff --git a/core/lib/Drupal/Core/Cache/PhpBackend.php b/core/lib/Drupal/Core/Cache/PhpBackend.php index dfc1560..73153c9 100644 --- a/core/lib/Drupal/Core/Cache/PhpBackend.php +++ b/core/lib/Drupal/Core/Cache/PhpBackend.php @@ -53,10 +53,11 @@ public function get($cid, $allow_invalid = FALSE) { } /** - * Fetch a cache entry using a hashed cache ID. + * Fetch a cache item using a hashed cache ID. * * @param string $cidhash - * The value after applying Crypt::hashBase64() to the original cache ID. + * The hashed version of the original cache ID after applying + * Crypt::hashBase64(). * @param bool $allow_invalid * (optional) If TRUE, a cache item may be returned even if it is expired or * has been invalidated. @@ -187,10 +188,11 @@ public function invalidate($cid) { } /** - * Invalidate one cache entry. + * Invalidate one cache item. * * @param string $cidhash - * The value after applying Crypt::hashBase64() to the original cache ID. + * The hashed version of the original cache ID after applying + * Crypt::hashBase64(). */ protected function invalidatebyHash($cidhash) { if ($item = $this->getByHash($cidhash)) { @@ -276,7 +278,8 @@ public function removeBin() { * Writes a cache item to PhpStorage. * * @param string $cidhash - * The hashed cache ID of the data to store. + * The hashed version of the original cache ID after applying + * Crypt::hashBase64(). * @param \stdClass $item * The cache item to store. */ diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php index 07b1dac..35635e8 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/GenericCacheBackendUnitTestBase.php @@ -384,7 +384,7 @@ public function testSetMultiple() { public function testDeleteMultiple() { $backend = $this->getCacheBackend(); - // Calling delete with an empty list should not cause an error. + // Calling deleteMultiple() with an empty array should not cause an error. $backend->deleteMultiple(array()); // Set numerous testing keys. @@ -518,7 +518,8 @@ function testInvalidate() { $ret = $backend->getMultiple($cids); $this->assertEqual(count($ret), 4, 'Four items returned.'); - // Calling invalidate with an empty list should not cause an error. + // Calling invalidateMultiple() with an empty array should not cause an + // error. $backend->invalidateMultiple(array()); $backend->invalidate('test1');