3 namespace Drupal\memcache;
5 use Drupal\Core\Site\Settings;
8 * Class for holding Memcache related config.
10 class MemcacheSettings {
13 * Array with the settings.
17 protected $settings = [];
22 * @param \Drupal\Core\Site\Settings $settings
23 * The site settings instance.
25 public function __construct(Settings $settings) {
26 $this->settings = $settings->get('memcache', []);
30 * Returns a memcache setting.
32 * Settings can be set in settings.php in the $settings['memcache'] array and
33 * requested by this function. Settings should be used over configuration for
34 * read-only, possibly low bootstrap configuration that is environment
38 * The name of the setting to return.
39 * @param mixed $default
40 * (optional) The default value to use if this setting is not set.
43 * The value of the setting, the provided default if not set.
45 public function get($name, $default = NULL) {
46 return isset($this->settings[$name]) ? $this->settings[$name] : $default;
50 * Returns all Memcache settings.
55 public function getAll() {
56 return $this->settings;