Redis PHP Set集合實現消息隊列

<?php
   //連接本地的 Redis 服務
   $redis = new Redis();
   $redis->connect('127.0.0.1', 6379);
   //存儲數據到列表中
   $redis->lpush("tutorial-list", "Redis");
   $redis->lpush("tutorial-list", "Mongodb");
   $redis->lpush("tutorial-list", "Mysql");
   // 獲取存儲的數據並輸出
   $arList = $redis->lrange("tutorial-list", 0 ,5);
   print_r($arList);
?>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章