Last active
April 9, 2021 01:30
-
-
Save tillkruss/7f1b25a0045946cf33c8d4fec3e2b459 to your computer and use it in GitHub Desktop.
PhpRedis Cluster Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
var_dump('PhpRedis: '. phpversion('redis')); | |
$redis = new RedisCluster( | |
null, | |
[ | |
'tls://127.0.0.1:7001', | |
'tls://127.0.0.1:7002', | |
], | |
1.0, // timeout | |
1.0, // read timeout | |
false, // persistent | |
'secret password', | |
['verify_peer' => false] | |
); | |
$redis->setOption( | |
RedisCluster::OPT_SLAVE_FAILOVER, | |
RedisCluster::FAILOVER_ERROR | |
); | |
for ($i = 0; $i < 50; $i++) { | |
$relay->set("cluster-test:{$i}", random_bytes(32)); | |
} | |
var_dump('Test key: ' . $redis->get('cluster-test:42')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment