public function setIfNotExists($key,
$value) { $value =
(object) [ 'owner' =>
$this->owner,
'data' =>
$value,
'updated' =>
(int) $this->requestStack->
getMainRequest()->server->
get('REQUEST_TIME'
),
];
$this->
ensureAnonymousSession();
$set =
$this->storage->
setWithExpireIfNotExists($key,
$value,
$this->expire
);
return $set;
} /**
* Stores a particular key/value pair in this SharedTempStore.
*
* Only stores the given key/value pair if it does not exist yet or is owned
* by $this->owner.
*
* @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.
*
* @throws \Drupal\Core\TempStore\TempStoreException
* Thrown when a lock for the backend storage could not be acquired.
*/