I compiled redis with igbinary support and I’d like to use it with owncloud, I only found an example to use memcached with igbinary, since also redis has similar options I thought that something like this in config.php should work:
'memcache.local' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'localhost',
'port' => 6379,
),
'filelocking.enabled' => true,
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis_options' => array(
// Binary serializer vill be enabled if the igbinary PECL module is available
\Redis::OPT_SERIALIZER => \Redis::SERIALIZER_IGBINARY,
),
I see no errors but will this really activate igbinary serializer?
I was reading this actually, but it’s the same as config.sample.php:
and found the options to use igbinary with memcached since also redis provides similar options I was wondering how hard it would be do the same for redis.
To be correct \Redis::OPT_SERIALIZER and \Redis::SERIALIZER_IGBINARY are options provided by the php_redis module I was wondering if just defining the array in that way will set the option in the php_redis module …
In case it doesn’t work/doesn’t exist I’d turn the question into a feature request
Yes I gave a look at /lib/private/Memcache/Memcached.php and it parses the array, my php-fu is a bit rusty …
I edited ./lib/private/Memcache/Redis.php and forced the option in the constructor this way:
public function __construct($prefix = '') {
parent::__construct($prefix);
if (is_null(self::$cache)) {
self::$cache = \OC::$server->getGetRedisFactory()->getInstance();
self::$cache->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_IGBINARY);
}
}
so the igbinary serializer is always used, I tested owncloud a bit and apparently everything works perfectly with the igbinary option set, I think I might even copy a few lines from Memcached.php and make Redis.php support the option …
Well it’s late here, tomorrow maybe.
Sorry, it doesn’t make sense, just in case someone reads thiss:
Redis.php (unlike Memcache.php) uses json_encode($value); to store the values which is already faster than standard php serialize:
igbinary and msgpack are maybe slightly faster than json_encode but just setting them in the option like I did in in the previous post doesn’t make sense.