允许从左边或者右边推入或者弹出
list数据可以重复
lpop就是从左边pop
rpop就是从右边pop
push同理
无序存储不同元素
sort set的value必须是全局唯一
如果2条记录的score是一样的 那么就按value的字典顺序排列先后
<?php $redis = new \Redis(); $redis->connect("127.0.0.1",8089); //string $redis->delete("string1"); $redis->set("string1","var1"); $val = $redis->get("string1"); var_dump($val); $redis->set("string1", 4); $redis->incr("string1", 2); $val = $redis->get("string1"); var_dump($val); ?>
常用于队列(订单操作等高并发处理)
<?php $redis = new \Redis(); $redis->connect("127.0.0.1",8089); $redis->delete("list1"); $redis->lPush("list1","A"); $redis->lPush("list1","B"); $redis->lPush("list1","C"); $val = $redis->rPop("list1"); var_dump($val); ?> ~
<?php $redis = new \Redis(); $redis->connect("127.0.0.1",8089); $redis->delete('driver1'); $redis->hSet("driver1","name","leokim"); $redis->hSet("driver1","age","100"); $redis->hSet("driver1","gender","1"); $val = $redis->hMGet("driver1",array("name","age")); var_dump($val); ?>
结算分数排行