lSize

Description

Returns the size of a list identified by Key. If the list didn't exist or is empty, the command returns 0. If the data type identified by Key is not a list, the command return FALSE.

根据KEY返回该KEY代表的LIST的长度,如果这个LIST不存在或者为空,那么ISIZE返回0,如果指定的KEY的数据类型不是LIST或者不为空,那么返回FALSE。所以在这里多说一句,当用ISize返回判断值的时候,===就有用处了,这里FLASE和0是两个概念了。

Parameters

Key

Return value

LONG The size of the list identified by Key exists.

如果KEY存在并且为LIST且有元素,那么返回KEY的长度,为空或者不存在返回0。

BOOL FALSE if the data type identified by Key is not list

如果KEY的数据类型不为空或者LIST,则返回FALSE。

Example $redis->rPush('key1', 'A');

$redis->rPush('key1', 'B');

$redis->rPush('key1', 'C'); /* key1 => [ 'A', 'B', 'C' ] */

$redis->lSize('key1');/* 3 */

$redis->rPop('key1');

$redis->lSize('key1');/* 2 */

lIndex, lGet

Description

Return the specified element of the list stored at the specified key. 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ... Return FALSE in case of a bad index or a key that doesn't point to a list.

根据索引值返回指定KEY LIST中的元素。0为第一个元素,1为第二个元素。-1为倒数第一个元素,-2为倒数第二个元素。如果指定了一个不存在的索引值,则返回FLASE。

Parameters

key index

Return value

String the element at this index

Bool FALSE if the key identifies a non-string data type, or no value corresponds to this index in the list Key.

Example $redis->rPush('key1', 'A');

$redis->rPush('key1', 'B');

$redis->rPush('key1', 'C'); /* key1 => [ 'A', 'B', 'C' ] */

$redis->lGet('key1', 0); /* 'A' */

$redis->lGet('key1', -1); /* 'C' */

$redis->lGet('key1', 10); /* `FALSE` */

lSet

Description

Set the list at index with the new value.

根据索引值设置新的VAULE

Parameters

key index value

Return value

BOOL TRUE if the new value is setted. FALSE if the index is out of range, or data type identified by key is not a list.

如果设置成功返回TURE,如果KEY所指向的不是LIST,或者索引值超出LIST本身的长度范围,则返回flase。

Iset函数刚像是UPDATE或者EDIT的概念,而不是INSERT或者ADD的概念,顾只能在LIST本身的长度范围内,而不能超出。

Example $redis->rPush('key1', 'A');

$redis->rPush('key1', 'B');

$redis->rPush('key1', 'C'); /* key1 => [ 'A', 'B', 'C' ] */

$redis->lGet('key1', 0); /* 'A' */

$redis->lSet('key1', 0, 'X');

$redis->lGet('key1', 0); /* 'X' */

lRange, lGetRange

Description

Returns the specified elements of the list stored at the specified key in the range [start, end]. start and stop are interpretated as indices: 0 the first element, 1 the second ... -1 the last element, -2 the penultimate ...

取得指定索引值范围内的所有元素。

Parameters

key start end

Return value

Array containing the values in specified range.

Example $redis->rPush('key1', 'A');

$redis->rPush('key1', 'B');

$redis->rPush('key1', 'C');

$redis->lRange('key1', 0, -1); /* array('A', 'B', 'C') */

lTrim, listTrim

Description

Trims an existing list so that it will contain only a specified range of elements.

它将截取LIST中指定范围内的元素组成一个新的LIST并指向KEY。简短解说就是截取LIST。

这个可不是JS,或者PHP中清空空格的意思。

Parameters

key start stop

Return value

Array

Bool return FALSE if the key identify a non-list value.

Example $redis->rPush('key1', 'A');

$redis->rPush('key1', 'B');

$redis->rPush('key1', 'C');

$redis->lRange('key1', 0, -1); /* array('A', 'B', 'C') */

$redis->lTrim('key1', 0, 1);

$redis->lRange('key1', 0, -1); /* array('A', 'B') */

lRem, lRemove

Description

Removes the first count occurences of the value element from the list. If count is zero, all the matching elements are removed. If count is negative, elements are removed from tail to head.

IRem,IRemove函数,首先要去判断count参数,如果count参数为0,那么所有符合删除条件的元素都将被移除。如果count参数为整数,将从左至右删除count个符合条件的元素,如果为负数则从右至左删除count个符合条件的元素。

Note: The argument order is not the same as in the Redis documentation. This difference is kept for compatibility reasons.

函数参数的顺序不一定要一致,这样做是为了保持兼容性。

Parameters

key

value

count

Return value

LONG the number of elements to remove

BOOL FALSE if the value identified by key is not a list.

Example $redis->lPush('key1', 'A');

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

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

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

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

$redis->lRange('key1', 0, -1); /* array('A', 'A', 'C', 'B', 'A') */

$redis->lRem('key1', 'A', 2); /* 2 */

$redis->lRange('key1', 0, -1); /* array('C', 'B', 'A') */

lInsert

Description

Insert value in the list before or after the pivot value. the parameter options specify the position of the insert (before or after). If the list didn't exists, or the pivot didn't exists, the value is not inserted.

在指定LIST中的指定中枢VALUE的左侧或者右侧插入VALUE。如果这个LIST不存在,或者这个pivot(key position)不存在,那么这个VALUE不会被插入。

Parameters

key position Redis::BEFORE | Redis::AFTER pivot value

Return value

The number of the elements in the list, -1 if the pivot didn't exists.

Example $redis->delete('key1');

$redis->lInsert('key1', Redis::AFTER, 'A', 'X'); /* 0 */

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

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

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

$redis->lInsert('key1', Redis::BEFORE, 'C', 'X'); /* 4 */

$redis->lRange('key1', 0, -1); /* array('A', 'B', 'X', 'C') */

$redis->lInsert('key1', Redis::AFTER, 'C', 'Y'); /* 5 */

$redis->lRange('key1', 0, -1); /* array('A', 'B', 'X', 'C', 'Y') */

$redis->lInsert('key1', Redis::AFTER, 'W', 'value'); /* -1 */

lpush rpush 区别_php-redis中文参考手册_list容器相关_lPush_rPush_lPushx_rPu...相关推荐

  1. 下载Hibernate中文参考手册2.1版

    下载Hibernate中文参考手册 下载Hibernate中文参考手册 PDF版本下载 下载Hibernate-2.1.2 下载Hibernate-extension-2.0.2 转载于:https: ...

  2. STM系列单片机中文参考手册下载方法

    在使用STM单片机编程的时候有时候需要查阅芯片手册,英文手册查阅起来比较麻烦,而搜索中文手册时,好多网站下载时需要注册或者需要积分,下载起来比较麻烦.现在就来说一下,如何在官方网站下载各个系列单片机的 ...

  3. STM32中文参考手册下载地址

    STM32中文参考手册下载地址 进入官网后点击"设计资源" 选择你要下载的芯片的手册 然后找到有"完整的存储器和外设信息"字眼的文档进行下载 很多人下载的下面这 ...

  4. STM32中文参考手册_V10

    STM32中文参考手册_V10 链接:https://pan.baidu.com/s/1AZXyanPyiazpVvVrJwXvRg 提取码:uwi5

  5. STM32F0/F1/F2/F3/F4/F7编程数据中英文手册(所有型号中文参考手册)

    STM32F0/F1/F2/F3/F4/F7编程数据中英文手册(所有型号中文参考手册) 免费获取STM32所有手册 ST官方免费的资料不应该共享的吗?怎么还欺负人,明码标价.进入官方,第一个就是. 感 ...

  6. ATmega8/16/32/64/128中文参考手册

    文章目录 ATmega8中文参考手册 ATmega16中文参考手册 ATmega32中文参考手册 ATmega64中文参考手册 ATmega128中文参考手册 ATmega8中文参考手册 ATmega ...

  7. MySQL中文参考手册--1.MySQL的一般信息

    MySQL中文参考手册--1.MySQL的一般信息 0 译者序 MySQL是一个精巧的SQL数据库管理系统,虽然它不是开放源代码的产品,但在某些情况下你可以自由使用.由于它的强大功能.灵活性.丰富的应 ...

  8. jQuery EasyUI 1.9.4中文参考手册 离线chm格式

    jquery-easyui1.9.4中文参考手册是一套关于jQuery EasyUI的参考帮助文档,在线帮助文档进行整理,生成chm文件,便于开发时或者离线对easyi控件的属性.文法.事件等内容的查 ...

  9. STM32F103中文参考手册(754页)

    一.STM32F103中文参考手册(754页) 链接:https://pan.baidu.com/s/13SftqpR4Dgu3pxHOH-Oqyg 提取码:6666 链接永久有效,欢迎广大电子爱好者 ...

  10. html中文手文档,HTML5 中文参考手册(打印版)

    HTML5 中文参考手册整理成方便打印出来参阅的pdf文档. HTML4与HTML5标签及描述简表 标签 描述 4 5 定义注释. 4 5 定义文档类型. 4 5 定义超链接. 4 5 定义缩写. 4 ...

最新文章

  1. 中国太阳能热水器市场营销模式探析与品牌格局调研报告2022版
  2. Python 链接汇总
  3. 学习笔记(08):Python网络编程并发编程-实现服务端可以对多个客户端提供服务
  4. 预处理器sass_Sass — Web的预处理器装饰
  5. php强大的函数,PHP最强大的随机字符串生成函数
  6. 使用vue写扫雷游戏
  7. dokcer 容器启动报错
  8. andrioid .9.png图片的制作
  9. 机器学习笔记(三十):基尼系数、CART
  10. pyqt qdialog 默认按钮_QT编程的QDialog对话框右上角的问号按钮如何取消呢
  11. 2018年的43个最佳网络监控工具
  12. 数字音频功放芯片型号与应用介绍
  13. 安卓开发颜色以及对应代码(转载)
  14. 推荐系统三十六式(刑无刀)学习笔记(二)
  15. qtablewidget翻页禁止_PyQt—QTableWidget实现翻页功能
  16. python 代理ip池_GitHub - xuan525/proxy_pool: Python爬虫代理IP池(proxy pool)
  17. 《黑客秘笈——渗透测试实用指南》—第1章1.1节搭建渗透测试主机
  18. 学习Cortex-M:三种关中断方式
  19. JS逆向——裁判文书网(详细图文步骤)
  20. 剑指 Offer II 076. 数组中的第 k 大的数字

热门文章

  1. win7下crtl+scroll会触发蓝屏重启(滑稽脸)
  2. 淘宝双十一喵果总动员之喵树大挑战玩法攻略
  3. 过去一年对我帮助最大的三本书
  4. 10大漏洞评估和渗透测试工具
  5. 直接收藏-超级好用的国内色彩搭配网站
  6. 三星有钱还是阿里有钱?
  7. 微信小程序实现登录功能
  8. AGV机器人核心部件——驱动轮
  9. telink ble mesh 介绍
  10. 谈谈Fragment的用法之Fragment实现Tab切换中的那些事