redis演练(2) 最全redis命令列表

本文涉及的产品
云数据库 Redis 版,社区版 2GB
推荐场景:
搭建游戏排行榜
简介:

下面列表是本人通过程序搜集的help命令整理的聚合列表,希望为redis填把火。

COMMAND summary since group
DEL key  [key ...]  Delete a key  1.0.0  generic
EXISTS  key [key ...]  Determine if a key exists  1.0.0  generic
EXPIRE  key seconds  Set a key's time to live  in  seconds  1.0.0  generic
KEYS  pattern  Find all keys matching the  given  pattern  1.0.0  generic
PEXPIRE  key milliseconds  Set a key's time to live  in  milliseconds  2.6.0  generic
RENAME  key newkey  Rename a key  1.0.0  generic
RENAMENX  key newkey  Rename a key, only if the  new key  does not exist  1.0.0  generic
SORT key  [BY pattern] [LIMIT offset  count] [GET pattern [GET pattern ...]]  [ASC|DESC] [ALPHA] [STORE tination]  Sort the elements in a  list, set  or sorted set  1.0.0  generic
TTL key  Get the time to live for a  key  1.0.0  generic
TYPE key  Determine the type stored  at key  1.0.0  generic
HDEL  key field [field ...]  Delete one or more hash  fields  2.0.0  hash
HEXISTS  key field  Determine if a hash field  exists  2.0.0  hash
HGET  key field  Get the value of a hash  field  2.0.0  hash
HGETALL  key  Get all the fields and  values in a  hash  2.0.0  hash
HINCRBY  key field increment  Increment the integer  value of a  hash field by the given number  2.0.0  hash
HKEYS  key  Get all the fields in a  hash  2.0.0  hash
HLEN  key  Get the number of fields  in a hash  2.0.0  hash
HMGET  key field [field ...]  Get the values of all the  given  hash fields  2.0.0  hash
HMSET  key field value [field value ...]  Set multiple hash fields  to  multiple values  2.0.0  hash
HSET  key field value  Set the string value of a  hash  field  2.0.0  hash
HVALS  key  Get all the values in a  hash  2.0.0  hash
LINDEX  key index  Get an element from a list  by its  index  1.0.0  list
LLEN  key  Get the length of a list  1.0.0  list
LPOP  key  Remove and get the first  element  in a list  1.0.0  list
LPUSH  key value [value ...]  Prepend one or multiple  values to  a list  1.0.0  list
LRANGE  key start stop  Get a range of elements  from a  list  1.0.0  list
LREM key  count value  Remove elements from a  list  1.0.0  list
LSET  key index value  Set the value of an  element in a  list by its index  1.0.0  list
LTRIM  key start stop  Trim a list to the  specified range  1.0.0  list
RPOP  key  Remove and get the last  element in  a list  1.0.0  list
RPOPLPUSH  source destination  Remove the last element in  a list,  prepend it to another list and return it  1.2.0  list
RPUSH  key value [value ...]  Append one or multiple  values to a  list  1.0.0  list
SADD  key member [member ...]  Add one or more members to  a set  1.0.0  set
SCARD  key  Get the number of members  in a set  1.0.0  set
SDIFF  key [key ...]  Subtract multiple sets  1.0.0  set
SDIFFSTORE  destination key [key ...]  Subtract multiple sets and  store  the resulting set in a key  1.0.0  set
SINTER  key [key ...]  Intersect multiple sets  1.0.0  set
SINTERSTORE  destination key [key ...]  Intersect multiple sets  and store  the resulting set in a key  1.0.0  set
SISMEMBER  key member  Determine if a given value  is a  member of a set  1.0.0  set
SMEMBERS  key  Get all the members in a  set  1.0.0  set
SMOVE  source destination member  Move a member from one set  to  another  1.0.0  set
SPOP key  [count]  Remove and return one or  multiple  random members from a set  1.0.0  set
SRANDMEMBER  key [count]  Get one or multiple random  members  from a set  1.0.0  set
SREM  key member [member ...]  Remove one or more members  from a  set  1.0.0  set
SUNION  key [key ...]  Add multiple sets  1.0.0  set
SUNIONSTORE  destination key [key ...]  Add multiple sets and  store the  resulting set in a key  1.0.0  set
ZADD  key [NX|XX] [CH] [INCR] score member  [score member ...]  Add one or more members to  a  sorted set, or update its score if it already exists  1.2.0  sorted_set
ZCARD  key  Get the number of members  in a  sorted set  1.2.0  sorted_set
ZCOUNT  key min max  Count the members in a  sorted set  with scores within the given values  2.0.0  sorted_set
ZINCRBY  key increment member  Increment the score of a  member in  a sorted set  1.2.0  sorted_set
ZRANGE  key start stop [WITHSCORES]  Return a range of members  in a  sorted set, by index  1.2.0  sorted_set
ZRANGEBYSCORE  key min max [WITHSCORES]  [LIMIT offset count]  Return a range of members  in a  sorted set, by score  1.0.5  sorted_set
ZRANK  key member  Determine the index of a  member in  a sorted set  2.0.0  sorted_set
ZREM  key member [member ...]  Remove one or more members  from a  sorted set  1.2.0  sorted_set
ZREMRANGEBYSCORE  key min max  Remove all members in a  sorted set  within the given scores  1.2.0  sorted_set
ZREVRANGE  key start stop [WITHSCORES]  Return a range of members  in a  sorted set, by index, with scores ordered from high to low  1.2.0  sorted_set
ZSCORE  key member  Get the score associated  with the  given member in a sorted set  1.2.0  sorted_set
DECR  key  Decrement the integer  value of a  key by one  1.0.0  string
DECRBY  key decrement  Decrement the integer  value of a  key by the given number  1.0.0  string
GET key  Get the value of a key  1.0.0  string
GETSET  key value  Set the string value of a  key and  return its old value  1.0.0  string
INCR  key  Increment the integer  value of a  key by one  1.0.0  string
INCRBY  key increment  Increment the integer  value of a  key by the given amount  1.0.0  string
MGET  key [key ...]  Get the values of all the  given  keys  1.0.0  string
MSET  key value [key value ...]  Set multiple keys to  multiple  values  1.0.1  string
MSETNX  key value [key value ...]  Set multiple keys to  multiple  values, only if none of the keys exist  1.0.1  string
SET key  value [EX seconds] [PX  milliseconds] [NX|XX]  Set the string value of a  key  1.0.0  string
SETEX  key seconds value  Set the value and  expiration of a  key  2.0.0  string
SETNX  key value  Set the value of a key,  only if  the key does not exist  1.0.0  string
MULTI  Mark the start of a  transaction  block  1.2.0  transactions


每个命令不复杂,难点就是命令太多,但还需要自己花时间一行行的敲,一个个的实验。




本文转自 randy_shandong 51CTO博客,原文链接:http://blog.51cto.com/dba10g/1843602,如需转载请自行联系原作者

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore     ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库 ECS 实例和一台目标数据库 RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
8天前
|
NoSQL Shell Redis
2、Redis列表
2、Redis列表
|
8天前
|
NoSQL Redis 数据库
10- 你们用过Redis的事务吗 ? 事务的命令有哪些 ?
```markdown Redis事务包括MULTI、EXEC、DISCARD、WATCH四个命令。虽具备事务功能,但在实际开发中使用较少。 ```
46 7
|
8天前
|
NoSQL Redis 数据库
Redis中的常用命令非常丰富,涵盖了各种数据类型的基本操作以及服务器管理和维护的相关指令
【5月更文挑战第15天】Redis常用命令包括通用(如PING、SELECT)、键操作(KEYS、EXISTS、DEL)、字符串(SET、GET)、哈希(HSET、HGET)、列表(LPUSH、LPOP)、集合(SADD、SMEMBERS)和有序集合(ZADD、ZRANGE)等。这些命令用于数据操作及服务器管理,满足不同场景需求。了解更多命令,建议参考Redis官方文档。
20 2
|
8天前
|
存储 缓存 NoSQL
【技术分享】求取列表需求的redis缓存方案
【技术分享】求取列表需求的redis缓存方案
36 0
|
8天前
|
存储 NoSQL Redis
Redis基础命令集详解
Redis基础命令集详解
16 1
|
8天前
|
存储 NoSQL Redis
Redis 常用命令
Redis 常用命令
18 0
|
8天前
|
存储 NoSQL Redis
深入浅出Redis(零):Redis常用命令的使用
深入浅出Redis(零):Redis常用命令的使用
|
8天前
|
存储 NoSQL 关系型数据库
深入浅出Redis(十二):Redis的排序命令Sort
深入浅出Redis(十二):Redis的排序命令Sort
|
8天前
|
NoSQL Linux Redis
Redis的介绍,以及Redis的安装(本机windows版,虚拟机Linux版)和Redis常用命令的介绍
Redis的介绍,以及Redis的安装(本机windows版,虚拟机Linux版)和Redis常用命令的介绍
31 0
|
8天前
|
存储 NoSQL 定位技术
Redis常用数据类型及常用命令
这些是Redis中常用的数据类型和命令。Redis还提供了许多其他命令和功能,用于数据存储、操作和查询。你可以根据需要选择适当的数据类型和命令来满足你的应用程序需求。
30 4