php中lpush(),lPush 命令/方法/函数

Description

Adds the string value to the head (left) of the list. Creates the list if the key didn't exist. If the key exists and is not a list, FALSE is returned.

添加一个字符串值到LIST容器的顶部(左侧),如果KEY不存在,曾创建一个LIST容器,如果KEY存在并且不是一个LIST容器,那么返回FLASE。

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.

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

Examples

$redis->delete('key1');

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

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

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值