predis的主从用法

来源:互联网 发布:高级ios程序员招聘 编辑:程序博客网 时间:2024/06/06 07:00
</pre><pre name="code" class="php">
<?php require_once("./application/third_party/Predis/Autoloader.php");Predis\Autoloader::register();$parameters = ['tcp://192.168.0.105:6379?alias=master', 'tcp://192.168.0.106:6379?alias=slave-01'];$options    = ['replication' => true]; #此参数为true,则preids每次查询语句都会打向slave-01,写入语句会打向master$client = new Predis\Client($parameters, $options);echo $client->get("name");echo $client->set("name", "leon7");?>

0 0
原创粉丝点击