function MongoDbStore::save
Throws
LockExpiredException when save is called on an expired lock
Overrides PersistingStoreInterface::save
File
-
vendor/
symfony/ lock/ Store/ MongoDbStore.php, line 222
Class
- MongoDbStore
- MongoDbStore is a StoreInterface implementation using MongoDB as a storage engine. Support for MongoDB server >=2.2 due to use of TTL indexes.
Namespace
Symfony\Component\Lock\StoreCode
public function save(Key $key) : void {
$key->reduceLifetime($this->initialTtl);
try {
$this->upsert($key, $this->initialTtl);
} catch (BulkWriteException $e) {
if ($this->isDuplicateKeyException($e)) {
throw new LockConflictedException('Lock was acquired by someone else.', 0, $e);
}
throw new LockAcquiringException('Failed to acquire lock.', 0, $e);
}
if ($this->options['gcProbability'] > 0.0 && (1.0 === $this->options['gcProbability'] || random_int(0, \PHP_INT_MAX) / \PHP_INT_MAX <= $this->options['gcProbability'])) {
$this->createTtlIndex();
}
$this->checkNotExpired($key);
}