Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MongoDbStore.php

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\Store

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal