diff --git a/core/lib/Drupal/Core/TempStore/PrivateTempStore.php b/core/lib/Drupal/Core/TempStore/PrivateTempStore.php index 8e4999f8e8..1ee90f4bbd 100644 --- a/core/lib/Drupal/Core/TempStore/PrivateTempStore.php +++ b/core/lib/Drupal/Core/TempStore/PrivateTempStore.php @@ -8,25 +8,17 @@ use Symfony\Component\HttpFoundation\RequestStack; /** - * Stores and retrieves temporary data for a given owner. + * Stores and retrieves private temporary data for a given owner. * - * A PrivateTempStore can be used to make temporary, non-cache data available - * across requests. The data for the PrivateTempStore is stored in one - * key/value collection. PrivateTempStore data expires automatically after a - * given timeframe. + * The data for the PrivateTempStore is stored in one key/value collection. + * PrivateTempStore data expires automatically after a given timeframe. * - * The PrivateTempStore is different from a cache, because the data in it is not - * yet saved permanently and so it cannot be rebuilt. Typically, the - * PrivateTempStore might be used to store work in progress that is later saved - * permanently elsewhere, e.g. autosave data, multistep forms, or in-progress - * changes to complex configuration that are not ready to be saved. + * If you want to be able to share data between users or use it for locking, use + * SharedTempStore. * - * The PrivateTempStore differs from the SharedTempStore in that all keys are - * ensured to be unique for a particular user and users can never share data. If - * you want to be able to share data between users or use it for locking, use - * \Drupal\Core\TempStore\SharedTempStore. + * @see \Drupal\Core\TempStore\SharedTempStore */ -class PrivateTempStore implements TempStoreInterface { +class PrivateTempStore implements PrivateTempStoreInterface { /** * The key/value storage object used for this data. @@ -99,13 +91,6 @@ public function get($key) { } } - /** - * {@inheritdoc} - */ - public function getIfOwner($key) { - return $this->get($key); - } - /** * {@inheritdoc} */ @@ -127,13 +112,6 @@ public function set($key, $value) { $this->lockBackend->release($key); } - /** - * {@inheritdoc} - */ - public function setIfOwner($key, $value) { - $this->set($key, $value); - } - /** * {@inheritdoc} */ @@ -170,13 +148,6 @@ public function delete($key) { return TRUE; } - /** - * {@inheritdoc} - */ - public function deleteIfOwner($key) { - return $this->delete($key); - } - /** * Ensures that the key is unique for a user. * diff --git a/core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php b/core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php index b80b825b49..d45042e711 100644 --- a/core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php +++ b/core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php @@ -76,7 +76,7 @@ public function __construct(KeyValueExpirableFactoryInterface $storage_factory, * The collection name to use for this key/value store. This is typically * a shared namespace or module name, e.g. 'views', 'entity', etc. * - * @return \Drupal\Core\TempStore\PrivateTempStore + * @return \Drupal\Core\TempStore\PrivateTempStoreInterface * An instance of the key/value store. */ public function get($collection) { diff --git a/core/lib/Drupal/Core/TempStore/PrivateTempStoreInterface.php b/core/lib/Drupal/Core/TempStore/PrivateTempStoreInterface.php new file mode 100644 index 0000000000..d21ec735a2 --- /dev/null +++ b/core/lib/Drupal/Core/TempStore/PrivateTempStoreInterface.php @@ -0,0 +1,25 @@ +getOwner(). - * - * @param string $key - * The key of the data to retrieve. - * - * @return mixed - * The data associated with the key, or NULL if the key does not exist. - */ - public function getIfOwner($key); - - /** - * Stores a particular key/value pair in this TempStore. + * Stores a particular key/value pair in the store. * * @param string $key * The key of the data to store. @@ -41,23 +28,6 @@ public function getIfOwner($key); */ public function set($key, $value); - /** - * Stores a particular key/value pair in this TempStore. - * - * Only stores the given key/value pair if it does not exist yet or is owned - * by $this->getOwner(). - * - * @param string $key - * The key of the data to store. - * @param mixed $value - * The data to store. - * - * @return bool - * TRUE if the data was set, or FALSE if it already exists and is not owned - * by $this->user. - */ - public function setIfOwner($key, $value); - /** * Returns the metadata associated with a particular key/value pair. * @@ -78,18 +48,4 @@ public function getMetadata($key); */ public function delete($key); - /** - * Deletes data from the store for a given key and releases the lock on it. - * - * Only delete the given key if it is owned by $this->getOwner(). - * - * @param string $key - * The key of the data to delete. - * - * @return bool - * TRUE if the object was deleted or does not exist, FALSE if it exists but - * is not owned by $this->getOwner(). - */ - public function deleteIfOwner($key); - }