Skip to content

FIX: Setting client options fails with "Server went away"#5

Open
patricknelson wants to merge 2 commits intoandrelohmann:masterfrom
patricknelson:fix-client-options
Open

FIX: Setting client options fails with "Server went away"#5
patricknelson wants to merge 2 commits intoandrelohmann:masterfrom
patricknelson:fix-client-options

Conversation

@patricknelson
Copy link
Copy Markdown

@patricknelson patricknelson commented Mar 20, 2020

When defining a client prefix option for phpredis, there would be an exception Uncaught RedisException: Redis server went away. It looks like this was caused by calling $redis->setOption(Redis::OPT_PREFIX, 'foobar:') before the server connection in $redis->connect(...) was done.

Example configuration:

SS_Cache::add_backend('primary_redis', 'Redis', [
	'server' => [
		'host' => '127.0.0.1,
	],
	'client' => [
		// 👇 Results in an exception.
		'prefix' => 'foobar:',
	],
]);

This pull request just relocates the server config above the client configuration so that setting the prefix will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant