Skip to content

Instantly share code, notes, and snippets.

@gonzaloserrano
Last active August 29, 2015 14:13
Show Gist options
  • Save gonzaloserrano/e3cd6a4307b7d9c8e26c to your computer and use it in GitHub Desktop.
Save gonzaloserrano/e3cd6a4307b7d9c8e26c to your computer and use it in GitHub Desktop.
phpredis reconnection failing test
<?php
// redis docker containers
$serversList = array(
'redis1',
'redis2',
'redis3',
'redis4',
'redis5',
);
$ra = new RedisArray(
$serversList,
array(
"connect_timeout" => 10,
"retry_timeout" => 3000,
"retry_interval" => 3000
)
);
//$ra = new RedisArray($serversList);
$key = 'key';
$value = 'value';
$i = 0;
while (true) {
echo "\n\n### $i";
for ($j = 0; $j < 5; $j++) {
$_key = $key . $j;
echo "\n" . $ra->_target($_key);
echo " > set: $j";
$ra->set($_key, $j);
echo "\nget: " . $ra->get($_key);
}
sleep(1);
echo "\nsleep\n";
$i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment