在线工具
网站地图    收藏    合作   
<

快捷菜单 返回顶部

php操作redis

返回上层

List数据类型函数 - rpoplpush - 命令/方法/函数

Pops a value from the tail of a list, and pushes it to the front of another list. Also return this value.

从源LIST的最后弹出一个元素,并且把这个元素从目标LIST的顶部(左侧)压入目标LIST。


Parameters

Key: srckey

Key: dstkey


Return value

STRING The element that was moved in case of success, FALSE in case of failure.


Example

$redis->delete('x', 'y');


$redis->lPush('x', 'abc');

$redis->lPush('x', 'def');

$redis->lPush('y', '123');

$redis->lPush('y', '456');


// move the last of x to the front of y.

var_dump($redis->rpoplpush('x', 'y'));

var_dump($redis->lRange('x', 0, -1));

var_dump($redis->lRange('y', 0, -1));


Output:

string(3) "abc"

array(1) {

  [0]=>

  string(3) "def"

}

array(3) {

  [0]=>

  string(3) "abc"

  [1]=>

  string(3) "456"

  [2]=>

  string(3) "123"

}


来源:https://www.daixiaorui.com/

自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com