diff --git a/core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php b/core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php index 92924a1..1a460ad 100644 --- a/core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/FileReadOnlyStorage.php @@ -64,9 +64,9 @@ public function delete($name) { } /** - * Returns the full path where the file is or should be stored. + * {@inheritdoc} */ - protected function getFullPath($name) { + public function getFullPath($name) { return $this->directory . '/' . $name; } @@ -87,13 +87,6 @@ public function deleteAll() { /** * {@inheritdoc} */ - public function getPath($name) { - return $this->getFullPath($name); - } - - /** - * {@inheritdoc} - */ public function listAll() { $names = array(); if (file_exists($this->directory)) { diff --git a/core/lib/Drupal/Component/PhpStorage/FileStorage.php b/core/lib/Drupal/Component/PhpStorage/FileStorage.php index 0eb2502..78f1222 100644 --- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/FileStorage.php @@ -195,17 +195,10 @@ public function delete($name) { } /** - * Returns the full path where the file is or should be stored. - */ - protected function getFullPath($name) { - return $this->directory . '/' . $name; - } - - /** * {@inheritdoc} */ - public function getPath($name) { - return $this->getFullPath($name); + public function getFullPath($name) { + return $this->directory . '/' . $name; } /** diff --git a/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php b/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php index e1b0649..1f6a682 100644 --- a/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php +++ b/core/lib/Drupal/Component/PhpStorage/PhpStorageInterface.php @@ -89,7 +89,7 @@ public function deleteAll(); * The full file path for the provided name. Return FALSE if the * implementation needs to prevent access to the file. */ - public function getPath($name); + public function getFullPath($name); /** * Lists all the files in the storage. diff --git a/core/lib/Drupal/Core/Cache/PhpBackend.php b/core/lib/Drupal/Core/Cache/PhpBackend.php index 71349c0..23ed324 100644 --- a/core/lib/Drupal/Core/Cache/PhpBackend.php +++ b/core/lib/Drupal/Core/Cache/PhpBackend.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\Core\Cache\PhpBackend. + * Contains \Drupal\Core\Cache\PhpBackend. */ namespace Drupal\Core\Cache; @@ -16,6 +16,11 @@ * Stores cache items in a PHP file using a storage that implements * Drupal\Component\PhpStorage\PhpStorageInterface. * + * This is fast because of PHP's opcode caching mechanism. Once a file's + * content is stored in PHP's opcode cache, including it doesn't require + * reading the contents from a filesystem. Instead, PHP will use the already + * compiled opcodes stored in memory. + * * @ingroup cache */ class PhpBackend implements CacheBackendInterface { @@ -44,7 +49,7 @@ public function __construct($bin) { * {@inheritdoc} */ public function get($cid, $allow_invalid = FALSE) { - if ($file = $this->storage()->getPath($cid)) { + if ($file = $this->storage()->getFullPath($cid)) { $cache = @include $file; } if (isset($cache)) { @@ -87,6 +92,8 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) { * * @param object $cache * An item loaded from cache_get() or cache_get_multiple(). + * @param bool $allow_invalid + * If FALSE, the method returns FALSE if the cache item is not valid. * * @return mixed * The item with data as appropriate or FALSE if there is no diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/PhpBackendUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Cache/PhpBackendUnitTest.php index 6258550..82c877c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Cache/PhpBackendUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/PhpBackendUnitTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\system\Tests\Cache\PhpBackendUnitTest. + * Contains \Drupal\system\Tests\Cache\PhpBackendUnitTest. */ namespace Drupal\system\Tests\Cache;