function DatabaseBackendFactory::getMaxRowsForBin

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php \Drupal\Core\Cache\DatabaseBackendFactory::getMaxRowsForBin()
  2. 10 core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php \Drupal\Core\Cache\DatabaseBackendFactory::getMaxRowsForBin()
  3. 11.x core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php \Drupal\Core\Cache\DatabaseBackendFactory::getMaxRowsForBin()

Gets the max rows for the specified cache bin.

Parameters

string $bin: The cache bin for which the object is created.

Return value

int The maximum number of rows for the given bin. Defaults to DatabaseBackend::DEFAULT_MAX_ROWS.

1 call to DatabaseBackendFactory::getMaxRowsForBin()
DatabaseBackendFactory::get in core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php
Gets DatabaseBackend for the specified cache bin.

File

core/lib/Drupal/Core/Cache/DatabaseBackendFactory.php, line 73

Class

DatabaseBackendFactory

Namespace

Drupal\Core\Cache

Code

protected function getMaxRowsForBin($bin) {
    $max_rows_settings = $this->settings
        ->get('database_cache_max_rows');
    // First, look for a cache bin specific setting.
    if (isset($max_rows_settings['bins'][$bin])) {
        $max_rows = $max_rows_settings['bins'][$bin];
    }
    elseif (isset($max_rows_settings['default'])) {
        $max_rows = $max_rows_settings['default'];
    }
    else {
        // Fall back to the default max rows if nothing else is configured.
        $max_rows = DatabaseBackend::DEFAULT_MAX_ROWS;
    }
    return $max_rows;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.