class MemcacheSettings in Memcache API and Integration 8.2
Class for holding Memcache related config.
Hierarchy
- class \Drupal\memcache\MemcacheSettings
Expanded class hierarchy of MemcacheSettings
4 files declare their use of MemcacheSettings
- DriverBase.php in src/
Driver/ DriverBase.php - MemcachedConnection.php in src/
Connection/ MemcachedConnection.php - MemcacheDriverFactory.php in src/
Driver/ MemcacheDriverFactory.php - MemcacheSettingsTest.php in tests/
src/ Unit/ MemcacheSettingsTest.php
1 string reference to 'MemcacheSettings'
1 service uses MemcacheSettings
File
- src/
MemcacheSettings.php, line 10
Namespace
Drupal\memcacheView source
class MemcacheSettings {
/**
* Array with the settings.
*
* @var array
*/
protected $settings = [];
/**
* Constructor.
*
* @param \Drupal\Core\Site\Settings $settings
* The site settings instance.
*/
public function __construct(Settings $settings) {
$this->settings = $settings
->get('memcache', []);
}
/**
* Returns a memcache setting.
*
* Settings can be set in settings.php in the $settings['memcache'] array and
* requested by this function. Settings should be used over configuration for
* read-only, possibly low bootstrap configuration that is environment
* specific.
*
* @param string $name
* The name of the setting to return.
* @param mixed $default
* (optional) The default value to use if this setting is not set.
*
* @return mixed
* The value of the setting, the provided default if not set.
*/
public function get($name, $default = NULL) {
return isset($this->settings[$name]) ? $this->settings[$name] : $default;
}
/**
* Returns all Memcache settings.
*
* @return array
* All settings.
*/
public function getAll() {
return $this->settings;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MemcacheSettings:: |
protected | property | Array with the settings. | |
MemcacheSettings:: |
public | function | Returns a memcache setting. | |
MemcacheSettings:: |
public | function | Returns all Memcache settings. | |
MemcacheSettings:: |
public | function | Constructor. |