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

快捷菜单 返回顶部

php操作redis

返回上层

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

Description

Adds the string value to the head (left) of the list if the list exists.

添加一个VALUE到LIST容器的顶部(左侧)如果这个LIST存在的话。


Parameters

key

value String, value to push in key


Return value

LONG The new length of the list in case of success, FALSE in case of Failure.

如果ADD成功, 返回LIST容器最新的长度。失败则返回FALSE。


Examples

$redis->delete('key1');

$redis->lPushx('key1', 'A'); // returns 0

$redis->lPush('key1', 'A'); // returns 1

$redis->lPushx('key1', 'B'); // returns 2

$redis->lPushx('key1', 'C'); // returns 3

/* key1 now points to the following list: [ 'A', 'B', 'C' ] */


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

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

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

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