Make certain config values optional
This commit is contained in:
parent
45d5465d6b
commit
27d4954ab9
@ -45,6 +45,7 @@ structure is like so:
|
||||
$config = [
|
||||
'driver' => 'null', // null, apcu, redis, memcache, memcached
|
||||
'connection' => [
|
||||
// Optional (For some drivers):
|
||||
// driver setup, see below for the structure for each
|
||||
// driver
|
||||
],
|
||||
|
@ -308,10 +308,8 @@ class Pool implements CacheItemPoolInterface, LoggerAwareInterface {
|
||||
$driver = ucfirst(strtolower($driverConfig['driver']));
|
||||
$class = __NAMESPACE__ . "\\Driver\\${driver}Driver";
|
||||
|
||||
if ( ! array_key_exists('options', $driverConfig))
|
||||
{
|
||||
$driverConfig['options'] = [];
|
||||
}
|
||||
$driverConfig['connection'] = $driverConfig['connection'] ?? [];
|
||||
$driverConfig['options'] = $driverConfig['options'] ?? [];
|
||||
|
||||
return new $class($driverConfig['connection'], $driverConfig['options']);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user