libredis-Redis PHP扩展

libredis是一个C语言编写的Redis客户端函数库,作者在自己的底层库基础上实现了一个PHP版本的Redis客户端。

项目地址:libredis on github

下面是作者给出的两个简单实例:

实例一:

$libredis = Libredis();
$connection = $libredis->get_connection("127.0.0.1");
//set a key
$batch = $libredis->create_batch();
$batch->set('hello', 'world');
$batch->execute($connection);
//now fetch the key
$batch = $libredis->create_batch();
$batch->get('hello');
$batch->execute($connection);
while($batch->next_reply($reply_type, $reply_value, $reply_length)) {
      echo $reply_value, PHP_EOL;
}

实例二:(multiple server模式)

$libredis = Libredis();
$connection1 = $libredis->get_connection("127.0.0.1:6379");
$connection2 = $libredis->get_connection("127.0.0.1:6380");
$batch1 = $libredis->create_batch();
$batch1->set('hello', 'world'); //add a 'set' command to batch1
$batch2 = $libredis->create_batch();
$batch2->set('hello2', 'world2');
$executor = $libredis->create_executor();
$executor->add($connection1, $batch1); //associate connection1 with batch1
$executor->add($connection2, $batch2); //associate connection2 with batch2
//execute all batches against their corresponding connections in parallel, with a
//500 ms timeout on the whole operation.
$executor->execute(500);

anyShare赠人玫瑰,手有余香,分享知识,德艺双馨!
          

无觅相关文章插件,快速提升流量

分类 Redis · tag , ,

  1. PHP官方还没有redis的扩展么?感觉这个语法写的与PHP别的扩展习性差距比较大啊

  2. Pingback: http://stateminimumcarinsurance.net

  3. Pingback: sears auto engine oil change coupon 2012

  4. Pingback: read more

  5. Pingback: Furnace & AC Combos

  6. Pingback: ver peliculas gratis online

  7. Pingback: Hope Reichert

  8. Pingback: carpet cleaning denver

  9. Pingback: cheap wall mounts

  10. Pingback: Baby Swing reviews

  11. Pingback: cosmetic dentistry

  12. Pingback: visit

  13. Pingback: website

  14. Pingback: tatuaggi

  15. Pingback: Pure Credit Loans

  16. Pingback: http://compareautocarinsurance.net/

  17. Pingback: retoucheren

  18. Pingback: gmail iniciar sesion

  19. Pingback: bad credit loans

  20. Pingback: Click here

  21. Pingback: here

  22. Pingback: stardoll cheats for clothes

  23. Pingback: buy phen375

  24. Pingback: maillot de foot pas cher

  25. Pingback: louis vuitton shop online