dcb9 / yii2-phpredis

Redis Cache and Session for Yii2
40 stars 15 forks source link

RedisException Redis server went away #4

Open baizhiqiang opened 7 years ago

baizhiqiang commented 7 years ago

what is the problem ?? Does not the Connection should extends Componets??

dcb9 commented 7 years ago

I think this problem without reference to the component. I have found the same issue as you:

https://github.com/phpredis/phpredis/issues/374 http://www.dear521.com/home/blog/index/id/38.html

luciuz commented 6 years ago

@dcb9 You should run $this->redis->open(); not in a Cache class but in a Connection init method.

dcb9 commented 6 years ago

Thanks for your comment. @luciuz

I think that is not good programming pattern. Connection wraps the Redis library, and it should only provides functions.

The Cache class and Session class are the caller, that call open() function had better be in the caller in my opinion.