I'm trying to set a Memcached option (disable compression) in the config file, but Yii2 keeps throwing an error. What am I doing wrong?
Here is the config:
'cache' => [
/* 'class' => 'yii\caching\FileCache', */
'class' => 'yii\caching\MemCache',
'servers' => [
[
'host' => 'localhost',
'port' => 11211,
],
],
'useMemcached' => true,
'serializer' => false,
'options' => [
'Memcached::OPT_COMPRESSION' => false,
],
],
And the error: 'yii\base\ErrorException' with message 'Memcached::setOptions(): invalid configuration option'
Any ideas?
If I do the same thing in plain PHP, it works just fine:
$memcache = new \Memcached;
$memcache->setOption(\Memcached::OPT_COMPRESSION, false);
$memcache->addServers(
array(
array("HOST" => "127.0.0.1", "PORT" => 11211),
)
);
Try this
'options' => [
\Memcached::OPT_COMPRESSION => false,
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With