public ChainedFastBackendFactory::__construct(Settings $settings = NULL, $consistent_service_name = NULL, $fast_service_name = NULL)
Constructs ChainedFastBackendFactory object.
\Drupal\Core\Site\Settings|NULL $settings: (optional) The settings object.
string|NULL $consistent_service_name: (optional) The service name of the consistent backend factory. Defaults to:
string|NULL $fast_service_name: (optional) The service name of the fast backend factory. Defaults to:
public function __construct(Settings $settings = NULL, $consistent_service_name = NULL, $fast_service_name = NULL) { // Default the consistent backend to the site's default backend. if (!isset($consistent_service_name)) { $cache_settings = isset($settings) ? $settings->get('cache') : array(); $consistent_service_name = isset($cache_settings['default']) ? $cache_settings['default'] : 'cache.backend.database'; } // Default the fast backend to APCu if it's available. if (!isset($fast_service_name) && function_exists('apcu_fetch')) { $fast_service_name = 'cache.backend.apcu'; } $this->consistentServiceName = $consistent_service_name; // Do not use the fast chained backend during installation. In those cases, // we expect many cache invalidations and writes, the fast chained cache // backend performs badly in such a scenario. if (!drupal_installation_attempted()) { $this->fastServiceName = $fast_service_name; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!ChainedFastBackendFactory.php/function/ChainedFastBackendFactory::__construct/8.1.x