Redis Cache Adapter Config - setLibOptions is broken #4576

Closed
Tomdarkness opened this Issue Jun 2, 2013 · 1 comment

Projects

None yet

1 participant

@Tomdarkness

When using the Redis cache adapter it is not possible to use the setLibOptions function in the config. For example:

use Zend\Cache\Storage\Adapter\RedisOptions;
use Zend\Cache\Storage\Adapter\Redis;

$redis_options = new RedisOptions();

$redis_options->setLibOptions(array(
       \Redis::OPT_SERIALIZER => \Redis::SERIALIZER_PHP
));

$redis_cache = new Redis($redis_options);

As soon as you attempt to use the cache you'll get:

Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away' in /mnt/project/vendor/zendframework/zendframework/library/Zend/Cache/Storage/Adapter/RedisResourceManager.php on line 70

This is because you can't call setOption until you've connected to the Redis server.

@Tomdarkness

Submitted pull request #4577 which solves this by moving the setOption calls to after the connection to the Redis server is established.

@weierophinney weierophinney added a commit that closed this issue Jun 11, 2013
@weierophinney weierophinney Merge branch 'hotfix/4603'
Close #4603
Fixes #4576
Fixes #4577
b0da7f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment