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

Breadcrumb

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

function CombinedStore::saveRead

Overrides SharedLockStoreInterface::saveRead

File

vendor/symfony/lock/Store/CombinedStore.php, line 83

Class

CombinedStore
CombinedStore is a PersistingStoreInterface implementation able to manage and synchronize several StoreInterfaces.

Namespace

Symfony\Component\Lock\Store

Code

public function saveRead(Key $key) : void {
    $successCount = 0;
    $failureCount = 0;
    $storesCount = \count($this->stores);
    foreach ($this->stores as $store) {
        try {
            if ($store instanceof SharedLockStoreInterface) {
                $store->saveRead($key);
            }
            else {
                $store->save($key);
            }
            ++$successCount;
        } catch (\Exception $e) {
            $this->logger?->debug('One store failed to save the "{resource}" lock.', [
                'resource' => $key,
                'store' => $store,
                'exception' => $e,
            ]);
            ++$failureCount;
        }
        if (!$this->strategy
            ->canBeMet($failureCount, $storesCount)) {
            break;
        }
    }
    $this->checkNotExpired($key);
    if ($this->strategy
        ->isMet($successCount, $storesCount)) {
        return;
    }
    $this->logger?->info('Failed to store the "{resource}" lock. Quorum has not been met.', [
        'resource' => $key,
        'success' => $successCount,
        'failure' => $failureCount,
    ]);
    // clean up potential locks
    $this->delete($key);
    throw new LockConflictedException();
}

API Navigation

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