码迷,mamicode.com
首页 > Web开发 > 详细

redis cluster php 客户端 predis

时间:2016-12-05 19:56:28      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:tar   cluster   cli   git   href   tools   string   下载   option   

php有redis的扩展,目前来说,还不支持redis cluster,推荐一下predis,功能比较全,从单个,到主从,到cluster都是支持的。效率怎么样,要靠自己去测试一下。

 

1,下载predis

https://github.com/nrk/predis

2,predis 事例

  1. <?php  
  2.   
  3. require ‘autoload.php‘;  
  4.   
  5. $servers = array(  
  6.  ‘tcp://192.168.10.219:6379‘,  
  7.  ‘tcp://192.168.10.219:6380‘,  
  8.  ‘tcp://192.168.10.219:6381‘,  
  9.  ‘tcp://192.168.10.220:6382‘,  
  10.  ‘tcp://192.168.10.220:6383‘,  
  11.  ‘tcp://192.168.10.220:6384‘,  
  12. );  
  13.   
  14. $options = array(‘cluster‘ => ‘redis‘);  
  15.   
  16. $client = new Predis\Client($servers, $options);  
  17.   
  18. $client->set("test", "tank");  
  19. $result = $client->get("test");  
  20. var_dump($result);  

 

redis cluster php 客户端 predis

标签:tar   cluster   cli   git   href   tools   string   下载   option   

原文地址:http://www.cnblogs.com/archoncap/p/6134798.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!