diff --git a/README.md b/README.md index 1b40987..b26206d 100644 --- a/README.md +++ b/README.md @@ -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 ], diff --git a/src/Pool.php b/src/Pool.php index 8cbfbfc..9cfcfef 100644 --- a/src/Pool.php +++ b/src/Pool.php @@ -307,11 +307,9 @@ 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']); }