public PrivateTempStore::set($key, $value)
Stores a particular key/value pair in this PrivateTempStore.
Parameters
string $key: The key of the data to store.
mixed $value: The data to store.
File
- core/modules/user/src/PrivateTempStore.php, line 116
Class
- PrivateTempStore
- Stores and retrieves temporary data for a given owner.
Namespace
Drupal\user
Code
public function set($key, $value) { $key = $this->createkey($key); 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->getOwner(), '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.