Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Redis Cache Adapter Config - setLibOptions is broken #4576

Closed
tom-pryor opened this issue Jun 2, 2013 · 1 comment
Closed

Redis Cache Adapter Config - setLibOptions is broken #4576

tom-pryor opened this issue Jun 2, 2013 · 1 comment
Milestone

Comments

@tom-pryor
Copy link

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.

@tom-pryor
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant