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