Redis PFDEBUG 命令
Created|Updated|Redis教程
|Post Views:
语法
1 | PFDEBUG subcommand key |
可用版本
≥ 2.8.9
时间复杂度
N/A
ACL类别
@write, @hyperloglog, @admin, @slow, @dangerous
PFDEBUG 命令是一个内部命令,用于开发和测试 Redis。
(END)
Author: Johnson Lin
Copyright Notice: All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.
Related Articles
2023-06-03
Redis MGET 命令
语法1MGET key [key ...] 可用版本 ≥ 1.0.0 时间复杂度 $O(N)$ 其中 N 是要检索的 key 的数量。 ACL类别 @read, @string, @fast 返回所有指定 key 的值。对于每个不持有字符串值或不存在的键,将返回特殊值 nil。正因为如此,该操作永远不会失败。 返回值返回一个数组,元素由所有给定的 key 上的值组成。 示例12345678redis> SET key1 "Hello""OK"redis> SET key2 "World""OK"redis> MGET key1 key2 nonexisting1) "Hello"2) "World"3) (nil) (END)
2024-10-17
Redis Set SUNION Command
The Redis SUNION command returns the union of the specified sets. Keys that do not exist are considered to be empty sets. SyntaxThe basic syntax of the SUNION command is as follows: 1SUNION key [key ...] For example: 1234key1 = {a,b,c,d}key2 = {c}key3 = {a,c,e}SUNION key1 key2 key3 = {a,b,c,d,e} Available SinceRedis version >= 1.0.0 Time ComplexityO(N) where N is the total number of elements in all given sets. ACL Categories@read, @set, @slow Return ...

2024-07-30
Effective Ways to Delete Fuzzy Matching Keys in Redis
In Redis, managing keys efficiently is crucial for optimal performance. Sometimes, you might need to delete keys that match a pattern or have a fuzzy match. Here’s how you can achieve this: Using Redis CLI CommandsRedis CLI provides several commands to interact with keys. To delete keys that match a pattern, you can use the KEYS command in combination with the DEL command: 1redis-cli KEYS "pattern*" | xargs redis-cli DEL Replace "pattern*" with your specific pattern. This ...
2023-05-31
Redis APPEND 命令
语法1APPEND key value 可用版本 ≥ 2.0.0 时间复杂度 $O(1)$ 假设附加的值很小,并且已经存在的值是任何大小,摊销后的时间复杂度是O(1),因为Redis使用的动态字符串库会在每次重新分配时将可用空间增加一倍。 如果追加的值比较小,而当前已经存在的值大小任意,那么摊销后的时间复杂度是 $O(1)$,因为 Redis 使用的动态字符串库会在每次重新分配时将可用空间增加一倍。 ACL类别 @write, @string, @fast 如果 key 已经存在并且它的值的数据类型是字符串,APPEND 命令会将 value 追加到该 key 原来的值的末尾。如果 key 不存在, APPEND 就简单地将给定 key 设为 value ,就像执行 SET key value 一样。 返回值返回一个整数,表示追加操作后,key 对应值的字符串长度。 示例 1以下例子示范了如何使用 APPEND 命令在 Redis 中追加字符串。 首先,检查 foo 键是否存在,由于返回 0,说明不存在。 然后,执行 APPEND foo "Rain",向 ...
2023-06-04
Redis SET 命令
语法12SET key value [NX | XX] [GET] [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | KEEPTTL] 可用版本 ≥ 1.0.0 时间复杂度 $O(1)$ ACL类别 @write, @string, @slow 设置 key 保存字符串类型的 value。如果 key 已经持有一个值,它将被覆盖,不管它是什么类型。在成功的 SET 操作中,任何先前与 key 相关的生存时间都会被丢弃。 选项SET 命令支持以下选项: EX seconds — 设置指定的过期时间,单位为秒。 PX milliseconds — 设置指定的过期时间,单位是毫秒。 EXAT timestamp-seconds — 设置指定的 Unix 时间,key 将在该时间过期,单位是秒。 PXAT timestamp-milliseconds — 设置指定的 Unix 时间,以毫秒为单位,key 将在该时间过期。 NX — 只有在 key 不存在的情况...
2023-06-04
Redis SETRANGE 命令
语法1SETRANGE key offset value 可用版本 ≥ 2.2.0 时间复杂度 $O(1)$ 不包含复制新字符串的时间。通常情况下,这个字符串非常小,所以摊销后的复杂度是 $O(1)$。否则,复杂度是 $O(M)$,M 是字符串参数 value 的长度。 ACL类别 @write, @string, @slow 用字符串参数 value 覆盖存储在 key 上的字符串的一部分,覆盖的位置从偏移量 offset 开始。 例如,存储在键 user 原来的字符串值为 Johnson,现在用字符串 LIN 替换该字符串值从偏移量 4 开始之后的所有字符,覆盖后最终的字符串值为 JohnLIN: 12345678redis> SET user "Johnson"OKredis> GET user"Johnson"redis> SETRANGE user 4 "LIN"(integer) 7redis> GET user"JohnLIN" 如果偏移量 offset 大于存...