public function DatabaseStorageExpirable::setWithExpire in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php \Drupal\Core\KeyValueStore\DatabaseStorageExpirable::setWithExpire()
- 9 core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php \Drupal\Core\KeyValueStore\DatabaseStorageExpirable::setWithExpire()
File
- core/
lib/ Drupal/ Core/ KeyValueStore/ DatabaseStorageExpirable.php, line 120
Class
- DatabaseStorageExpirable
- Defines a default key/value store implementation for expiring items.
Namespace
Drupal\Core\KeyValueStoreCode
public function setWithExpire($key, $value, $expire) {
try {
$this
->doSetWithExpire($key, $value, $expire);
} catch (\Exception $e) {
// If there was an exception, then try to create the table.
if ($this
->ensureTableExists()) {
$this
->doSetWithExpire($key, $value, $expire);
}
else {
throw $e;
}
}
}