LREM key count value
LREM key count value
Available since 1.0.0.
Time complexity: O(N) where N is the length of the list.
Removes the first count occurrences of elements equal to value from the list stored at key. The count argument influences the operation in the following ways:
count > 0: Remove elements equal tovaluemoving from head to tail.count < 0: Remove elements equal tovaluemoving from tail to head.count = 0: Remove all elements equal tovalue.
For example, LREM list -2 "hello" will remove the last two occurrences of"hello" in the list stored at list.
Note that non-existing keys are treated like empty lists, so when key does not exist, the command will always return 0.
Return value
Integer reply: the number of removed elements.
Examples
(integer) 1
redis> RPUSH mylist "hello"
(integer) 2
redis> RPUSH mylist "foo"
(integer) 3
redis> RPUSH mylist "hello"
(integer) 4
redis> LREM mylist -2 "hello"
(integer) 2
redis> LRANGE mylist 0 -1
1) "hello"
2) "foo"
redis>
LREM key count value的更多相关文章
- 超大批量删除redis中无用key+配置
目前线上一个单实例redis中无用的key太多,决定删除一部分. 1.删除指定用户的key,使用redis的pipeline 根据一定条件把需要删除的用户统计出来,放到一个表里面,表为 del_use ...
- 查询相应的key
一.key pattern 查询相应的key (1)redis允许模糊查询key 有3个通配符 *.?.[] (2)randomkey:返回随机key (3)type key:返回key存储的类型 ...
- Redis 命令,键(key),字符串(String),哈希(Hash),列表(List),集合(Set)(二)
Redis 命令 Redis 命令用于在 redis 服务上执行操作. 要在 redis 服务上执行命令需要一个 redis 客户端.Redis 客户端在我们之前下载的的 redis 的安装包中. ...
- 三、Redis基本操作——List
小喵的唠叨话:前面我们介绍了Redis的string的数据结构的原理和操作.当时我们提到Redis的键值对不仅仅是字符串.而这次我们就要介绍Redis的第二个数据结构了,List(链表).由于List ...
- redis参考文档
本文为之前整理的关于redis的文档,放到博客上一份,也方便我以后查阅. redis简介 Redis是一个开源的.高性能的.基于键值对的缓存与存储系统, 通过提供多种键值数据类型来适应不同场景下的缓存 ...
- 《Redis入门指南(第二版)》读书思考总结之Redis五大数据类型
热身:系统级命令 1. 获得符合规则的键名列表 KEYS pattern 模式匹配 产品的缓存:product+"."+....; => keys product* 订单的 ...
- Redis的入门及注意事项
1.redis简介 Remote Dictionary Server Redis 与其他 key - value 缓存产品有以下三个特点: Redis支持数据的持久化,可以将内存中的数据保存在磁盘中, ...
- MongoDB和Redis-NoSQL数据库-文档型-内存型
1NoSQL简述 CAP(Consistency,Availabiity,Partitiontolerance)理论告诉我们,一个分布式系统不可能满足一致性,可用性和分区容错性这三个需求,最多只能同时 ...
- Redis-cli命令最新总结
资料来源: http://redisdoc.com/ http://redis.io/commands 连接操作相关的命令 默认直接连接 远程连接-h 192.168.1.20 -p 6379 pi ...
随机推荐
- 如何在已安装vs2010的基础上安装sql2008
以前老受到别人写的这类东西的帮助,所以这次决定自己试下,第一次发这种,写得不好莫怪. 涉略sql2008一个多星期了.怎么说呢?Transact-SQL的编程虽然不如C++,java等高级 ...
- BS开发平台,一小时搞定功能强大的统计分析页面
BS开发平台,一小时搞定功能强大的统计分析页面,拥有强大的功能和详细的权限控制. 1.组织数据,分析需求(实际耗时大约20分钟) 2.建立需要的业务数据表(大致10分钟)3. 运行代码工具,生产需要 ...
- 关于ContentProvider的批量操作
今天看公司代码,发现在批量插入通话记录和联系人的时候,用了一个 ArrayList<ContentProviderOperation> ops = new ArrayList<Con ...
- poj1417 true liars(并查集 + DP)详解
这个题做了两天了.首先用并查集分类是明白的, 不过判断是否情况唯一刚开始用的是搜索.总是超时. 后来看别人的结题报告, 才恍然大悟判断唯一得用DP. 题目大意: 一共有p1+p2个人,分成两组,一组p ...
- AJAX与servlet的信息交互
<%@ page language="java" import="java.util.*" pageEncoding="gb2312" ...
- windows8 8.1 安装完 ubuntu无法挂载 ntfs分区 解决方法
windows8 8.1 安装完 ubuntu无法挂载 ntfs分区 解决方法: 最近安装完发现8.1系统后,ubuntu无法加载以前的ntfs分区了,特别是我添加到了/etc/fstab里面了 导致 ...
- c# linq 基础知识点
1.Where与TakeWhile,Where和sql中的where一样,返回所有满足条件的元素,而TakeWhile判断原理类似于while语句,从头逐个判断,只要条件为真就一直返回检索到的元素,只 ...
- OC与Swift的区别一(文件结构)
1.文件后缀名 oc的文件后缀名为:头文件.h 主体文件.m swift文件后缀名为:.swift 2. 代码分隔符 oc中使用分号;作为代码分隔符 swift中无需使用代码分隔符,以行作为代码分隔 ...
- easyui-helloworld
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- (hdu)5652 India and China Origins 二分+dfs
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5652 Problem Description A long time ago there ...