Login
网站首页 > 文章中心 > 其它

redis 命令都在这了

作者:小编 更新时间:2023-08-16 13:56:48 浏览量:394人看过

DUMP?key导出key的值

EXPIRE?key seconds设置一个key的过期的秒数

EXPIREAT?key timestamp设置一个UNIX时间戳的过期时间

KEYS?pattern查找所有匹配给定的模式的键

MIGRATE?host port key destination-db timeout [COPY] [REPLACE]原子性的将key从redis的一个实例移到另一个实例

MOVE?key db移动一个key到另一个数据库

PERSIST?key移除key的过期时间

PEXPIRE?key milliseconds设置key的有效时间以毫秒为单位

PEXPIREAT?key milliseconds-timestamp设置key的到期UNIX时间戳以毫秒为单位

PTTL?key获取key的有效毫秒数

RANDOMKEY?返回一个随机的key

RENAME?key newkey将一个key重命名

RENAMENX?key newkey重命名一个key,新的key必须是不存在的key

RESTORE?key ttl serialized-value [REPLACE]Create a key using the provided serialized value, previously obtained using DUMP.

TTL?key获取key的有效时间(单位:秒)

TYPE?key获取key的存储类型

WAIT?numslaves timeoutWait for the synchronous replication of all the write commands sent in the context of the current connection

SCAN?cursor [MATCH pattern] [COUNT count]增量迭代key

APPEND?key value追加一个值到key上

BITCOUNT?key [start end]统计字符串指定起始位置的字节数

BITFIELD?key [GET type offset] [SET type offset value] [INCRBY type offset increment] [OVERFLOW WRAP|SAT|FAIL]Perform arbitrary bitfield integer operations on strings

BITPOS?key bit [start] [end]Find first bit set or clear in a string

DECR?key整数原子减1

DECRBY?key decrement原子减指定的整数

GET?key返回key的value

GETBIT?key offset返回位的值存储在关键的字符串值的偏移量.

GETRANGE?key start end获取存储在key上的值的一个子字符串

GETSET?key value设置一个key的value,并获取设置前的值

INCR?key执行原子加1操作

INCRBY?key increment执行原子增加一个整数

INCRBYFLOAT?key increment执行原子增加一个浮点数

PSETEX?key milliseconds valueSet the value and expiration in milliseconds of a key

SET?key value [EX seconds] [PX milliseconds] [NX|XX]设置一个key的value值

SETBIT?key offset valueSets or clears the bit at offset in the string value stored at key

SETEX?key seconds value设置key-value并设置过期时间(单位:秒)

SETNX?key value设置的一个关键的价值,只有当该键不存在

SETRANGE?key offset valueOverwrite part of a string at key starting at the specified offset

STRLEN?key获取指定key值的长度

BRPOPLPUSH?source destination timeout弹出一个列表的值,将它推到另一个列表,并返回它;或阻塞,直到有一个可用

LINDEX?key index获取一个元素,通过其索引列表

LINSERT?key BEFORE|AFTER pivot value在列表中的另一个元素之前或之后插入一个元素

LLEN?key获得队列(List)的长度

LPOP?key从队列的左边出队一个元素

LPUSHX?key value当队列存在时,从队到左边入队一个元素

LRANGE?key start stop从列表中获取指定返回的元素

LREM?key count value从列表中删除元素

LSET?key index value设置队列里面一个元素的值

LTRIM?key start stop修剪到指定范围内的清单

RPOP?key从队列的右边出队一个元

RPOPLPUSH?source destination删除列表中的最后一个元素,将其追加到另一个列表

RPUSHX?key value从队列的右边入队一个元素,仅队列存在时有效

PUBLISH?channel message发布一条消息到频道

SCRIPT DEBUG?YES|SYNC|NOSet the debug mode for executed scripts.

SCRIPT FLUSH?删除服务器缓存中所有Lua脚本.

SCRIPT KILL?杀死当前正在运行的 Lua 脚本.

SCRIPT LOAD?script从服务器缓存中装载一个Lua脚本.

BGREWRITEAOF?异步重写追加文件命令

BGSAVE?异步保存数据集到磁盘上

CLIENT GETNAME?获得当前连接名称

CLIENT ID?Returns the client ID for the current connection

CLIENT REPLY?ON|OFF|SKIPInstruct the server whether to reply to commands

CLIENT SETNAME?connection-name设置当前连接的名字

CLIENT UNBLOCK?client-id [TIMEOUT|ERROR]Unblock a client blocked in a blocking command from a different connection

COMMAND?Get array of Redis command details

COMMAND COUNT?Get total number of Redis commands

COMMAND GETKEYS?Extract keys given a full Redis command

CONFIG GET?parameter获取配置参数的值

CONFIG REWRITE?从写内存中的配置文件

CONFIG SET?parameter value设置配置文件

CONFIG RESETSTAT?复位再分配使用info命令报告的统计

DBSIZE?返回当前数据库里面的keys数量

DEBUG OBJECT?key获取一个key的debug信息

DEBUG SEGFAULT?使服务器崩溃命令

FLUSHALL?清空所有数据库命令

FLUSHDB?清空当前的数据库命令

INFO?[section]获得服务器的详细信息

LASTSAVE?获得最后一次同步磁盘的时间

MEMORY DOCTOR?Outputs memory problems report

MEMORY HELP?Show helpful text about the different subcommands

MEMORY-MALLOC-STATS?Show allocator internal stats

MEMORY-PURGE?Ask the allocator to release memory

MEMORY-STATS?Show memory usage details

MEMORY-USAGE?key [SAMPLES count]Estimate the memory usage of a key

MONITOR?实时监控服务器

REPLICAOF?host portMake the server a replica of another instance, or promote it as master.

ROLE?Return the role of the instance in the context of replication

SAVE?同步数据到磁盘上

SHUTDOWN?[NOSAVE] [SAVE]关闭服务

SLAVEOF?host port指定当前服务器的主服务器

SLOWLOG?subcommand [argument]管理再分配的慢查询日志

SYNC?用于复制的内部命令

TIME?返回当前服务器时间

SCARD?key获取集合里面的元素数量

SISMEMBER?key member确定一个给定的值是一个集合的成员

SMEMBERS?key获取集合里面的所有元素

SMOVE?source destination member移动集合里面的一个元素到另一个集合

SPOP?key [count]删除并获取一个集合里面的元素

SRANDMEMBER?key [count]从集合里面随机获取一个元素

SSCAN?key cursor [MATCH pattern] [COUNT count]迭代set里面的元素

ZCARD?key获取一个排序的集合中的成员数量

ZCOUNT?key min max返回分数范围内的成员数量

ZINCRBY?key increment member增量的一名成员在排序设置的评分

ZLEXCOUNT?key min max返回成员之间的成员数量

ZPOPMAX?key [count]Remove and return members with the highest scores in a sorted set

ZPOPMIN?key [count]Remove and return members with the lowest scores in a sorted set

ZRANGE?key start stop [WITHSCORES]根据指定的index返回,返回sorted set的成员列表

ZRANGEBYLEX?key min max [LIMIT offset count]返回指定成员区间内的成员,按字典正序排列, 分数必须相同.

ZREVRANGEBYLEX?key max min [LIMIT offset count]返回指定成员区间内的成员,按字典倒序排列, 分数必须相同

ZRANGEBYSCORE?key min max [WITHSCORES] [LIMIT offset count]返回有序集合中指定分数区间内的成员,分数由低到高排序.

ZRANK?key member确定在排序集合成员的索引

ZREMRANGEBYLEX?key min max删除名称按字典由低到高排序成员之间所有成员.

ZREMRANGEBYRANK?key start stop在排序设置的所有成员在给定的索引中删除

ZREMRANGEBYSCORE?key min max删除一个排序的设置在给定的分数所有成员

ZREVRANGE?key start stop [WITHSCORES]在排序的设置返回的成员范围,通过索引,下令从分数高到低

ZREVRANGEBYSCORE?key max min [WITHSCORES] [LIMIT offset count]返回有序集合中指定分数区间内的成员,分数由高到低排序.

ZREVRANK?key member确定指数在排序集的成员,下令从分数高到低

ZSCORE?key member获取成员在排序设置相关的比分

ZSCAN?key cursor [MATCH pattern] [COUNT count]迭代sorted sets里面的元素

XGROUP?[CREATE key groupname id-or-$] [SETID key id-or-$] [DESTROY key groupname] [DELCONSUMER key groupname consumername]Create, destroy, and manage consumer groups.

XINFO?[CONSUMERS key groupname] [GROUPS key] [STREAM key] [HELP]Get information on streams and consumer groups

XLEN?keyReturn the number of entires in a stream

XPENDING?key group [start end count] [consumer]Return information and entries from a stream consumer group pending entries list, that are messages fetched but never acknowledged.

XRANGE?key start end [COUNT count]Return a range of elements in a stream, with IDs matching the specified IDs interval

XREVRANGE?key end start [COUNT count]Return a range of elements in a stream, with IDs matching the specified IDs interval, in reverse order (from greater to smaller IDs) compared to XRANGE

DISCARD?丢弃所有 MULTI 之后发的命令

EXEC?执行所有 MULTI 之后发的命令

MULTI?标记一个事务块开始

UNWATCH?取消事务命令

HEXISTS?key field判断field是否存在于hash中

HGET?key field获取hash中field的值

HGETALL?key从hash中读取全部的域和值

HINCRBY?key field increment将hash中指定域的值增加给定的数字

HINCRBYFLOAT?key field increment将hash中指定域的值增加给定的浮点数

HKEYS?key获取hash的所有字段

HLEN?key获取hash里所有字段的数量

HSET?key field value设置hash里面一个字段的值

HSETNX?key field value设置hash的一个字段,只有当这个字段不存在时有效

HSTRLEN?key field获取hash里面指定field的长度

HVALS?key获得hash的所有值

HSCAN?key cursor [MATCH pattern] [COUNT count]迭代hash里面的元素

GEORADIUS?key longitude latitude radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count]查询指定半径内所有的地理空间元素的集合.

GEORADIUSBYMEMBER?key member radius m|km|ft|mi [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count]查询指定半径内匹配到的最大距离的一个地理空间元素.

AUTH?password验证服务器命令

ECHO?message回显输入的字符串

PING?Ping 服务器

QUIT?关闭连接,退出

SELECT?index选择新数据库

SWAPDB?index indexSwaps two Redis databases

CLUSTER COUNT-FAILURE-REPORTS?node-idReturn the number of failure reports active for a given node

CLUSTER COUNTKEYSINSLOT?slotReturn the number of local keys in the specified hash slot

CLUSTER FAILOVER?[FORCE|TAKEOVER]Forces a slave to perform a manual failover of its master.

CLUSTER FORGET?node-idRemove a node from the nodes table

CLUSTER GETKEYSINSLOT?slot countReturn local key names in the specified hash slot

CLUSTER INFO?Provides info about Redis Cluster node state

CLUSTER KEYSLOT?keyReturns the hash slot of the specified key

CLUSTER MEET?ip portForce a node cluster to handshake with another node

CLUSTER NODES?Get Cluster config for the node

CLUSTER REPLICAS?node-idList replica nodes of the specified master node

CLUSTER REPLICATE?node-idReconfigure a node as a slave of the specified master node

CLUSTER RESET?[HARD|SOFT]Reset a Redis Cluster node

CLUSTER SAVECONFIG?Forces the node to save cluster state on disk

CLUSTER SET-CONFIG-EPOCH?config-epochSet the configuration epoch in a new node

CLUSTER SETSLOT?slot IMPORTING|MIGRATING|STABLE|NODE [node-id]Bind an hash slot to a specific node

CLUSTER SLAVES?node-idList slave nodes of the specified master node

CLUSTER SLOTS?Get array of Cluster slot to node mappings

READONLY?Enables read queries for a connection to a cluster slave node

READWRITE?Disables read queries for a connection to a cluster slave node

以上就是土嘎嘎小编为大家整理的redis 命令都在这了相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章