public SharedTempStore::set($key, $value)
Stores a particular key/value pair in this SharedTempStore.
Parameters
string $key: The key of the data to store.
mixed $value: The data to store.
File
- core/modules/user/src/SharedTempStore.php, line 189
Class
- SharedTempStore
- Stores and retrieves temporary data for a given owner.
Namespace
Drupal\user
Code
public function set($key, $value) { if (!$this->lockBackend->acquire($key)) { $this->lockBackend->wait($key); if (!$this->lockBackend->acquire($key)) { throw new TempStoreException("Couldn't acquire lock to update item '$key' in '{$this->storage->getCollectionName()}' temporary storage."); } } $value = (object) array( 'owner' => $this->owner, 'data' => $value, 'updated' => (int) $this->requestStack->getMasterRequest()->server->get('REQUEST_TIME'), ); $this->storage->setWithExpire($key, $value, $this->expire); $this->lockBackend->release($key); }
Please login to continue.