Skip to content

Commit a02f02b

Browse files
iainmckayNyholm
authored andcommitted
Allows passing of options to the memcached extension (#75)
1 parent ee9a514 commit a02f02b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Factory/MemcachedFactory.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ public function getAdapter(array $config)
4444
$client->addServer($server['host'], $port);
4545
}
4646

47+
foreach ($config['driver_options'] as $constant => $value) {
48+
$client->setOption(constant($constant), $value);
49+
}
50+
4751
$pool = new MemcachedCachePool($client);
4852

4953
if (null !== $config['pool_namespace']) {
@@ -64,12 +68,14 @@ protected static function configureOptionResolver(OptionsResolver $resolver)
6468
'port' => 11211,
6569
'pool_namespace' => null,
6670
'redundant_servers' => [],
71+
'driver_options' => [],
6772
]);
6873

6974
$resolver->setAllowedTypes('persistent_id', ['string', 'null']);
7075
$resolver->setAllowedTypes('host', ['string']);
7176
$resolver->setAllowedTypes('port', ['string', 'int']);
7277
$resolver->setAllowedTypes('pool_namespace', ['string', 'null']);
7378
$resolver->setAllowedTypes('redundant_servers', ['array']);
79+
$resolver->setAllowedTypes('driver_options', ['array']);
7480
}
7581
}

0 commit comments

Comments
 (0)