Redis HyperLogLog PFSELFTEST Command
Created|Updated|Redis Tutorial
|Post Views:
Syntax
The basic syntax of the PFSELFTEST command is as follows:
1 | PFSELFTEST |
The PFSELFTEST command is an internal command. It is meant to be used for developing and testing Redis.
Available Since
Version 2.8.9 or later.
Time Complexity
N/A
ACL Categories
@hyperloglog, @admin, @slow, @dangerous
Return Value
Returns OK.
Example
1 | 127.0.0.1:6379> PFSELFTEST |
Author: Johnson Lin
Copyright Notice: All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.
Related Articles
2024-10-12
Redis Set SMOVE Command
The Redis SMOVE command moves the specified member element from the source set to the destination set. SMOVE operation is an atomic. If the source set does not exist or does not contain the specified member, the command does nothing and returns 0. Otherwise, the member is removed from the source set and added to the destination set. If the destination set already contains the member, the SMOVE command simply removes the member from the source set without adding it to the destination set again...
2024-10-19
Redis Bitmaps
In Redis, a bitmap is a data structure that represents a sequence of bits (0s and 1s). Each bit in the bitmap can be either on (1) or off (0), allowing it to represent binary data in a compact form. This is particularly useful when you need to handle large sets of boolean data, as bitmaps allow you to store information in a very space-efficient way. For example, if you have a system tracking whether users have completed a daily task, a bitmap can efficiently store whether each user has comple...
2023-06-06
Redis BITCOUNT 命令
语法1BITCOUNT key [start end [BYTE | BIT]] 可用版本 ≥ 2.6.0 时间复杂度 $O(N)$ ACL类别 @read, @bitmap, @slow 计算给定字符串中,被设置为 1 的比特位的数量。 默认情况下,给定的整个字符串都会被进行计数,通过指定额外的 start 和 end 参数,可以让计数只在特定的位上进行。 start 和 end 参数的设置和 GETRANGE key start end 命令类似,都可以使用负数值: 比如 -1 表示最后一个字节,-2 表示倒数第二个字节,以此类推。 不存在的 key 被当成是空字符串来处理,因此对一个不存在的 key 进行 BITCOUNT 操作,结果为 0 。 默认情况下,参数 start 和 end 指定一个字节索引。我们可以使用一个附加参数 BIT 来指定一个比特索引。所以 0 是第一位,1 是第二位,以此类推。对于负值,-1 是最后一位,-2 是倒数第二位,依此类推。 返回值返回一个整数,表示被设置为 1 的位的数量。 示例 1对一个不存在的 key 进行 BITCOUNT 操作:...
2023-06-02
Redis GETEX 命令
语法12GETEX key [EX seconds | PX milliseconds | EXAT unix-time-seconds | PXAT unix-time-milliseconds | PERSIST] 可用版本 ≥ 6.2.0 时间复杂度 $O(1)$ ACL 类别 @write, @string, @fast 获取 key 的值,并可以选择设置其过期时间。GETEX 与 GET 类似,但它是一个带有额外选项的写命令。 选项GETEX 命令支持以下选项来修改它的行为: EX seconds — 设置指定的过期时间,单位是秒。 PX milliseconds — 设置指定的过期时间,单位是毫秒。 EXAT timestamp-seconds — 设置指定的 Unix 时间,key 将在该时间过期,单位是秒。 PXAT timestamp-milliseconds — 设置指定的 Unix 时间,key 将在该时间过期,单位是毫秒。 PERSIST — 删除 key 的过期时间,即 key 永不过期。 返回值返回 key 的值,如果 key 不存在,则返回 nil...
2024-10-09
Redis Set SISMEMBER Command
The Redis SISMEMBER command checks if a given element is a member of the set. SyntaxThe basic syntax of the SISMEMBER command is as follows: 1SISMEMBER key member It returns if member is a member of the set stored at key. Available SinceRedis version >= 1.0.0 Time ComplexityO(1) ACL Categories@read, @set, @fast Return Value 0 if the element is not a member of the set, or when the key does not exist. 1 if the element is a member of the set. Example123456127.0.0.1:6379> SADD key1 a b c d...
2023-06-03
Redis MSET 命令
语法1MSET key value [key value ...] 可用版本 ≥ 1.0.1 时间复杂度 $O(N)$ 其中 N 是要设置的 key 的数量。 ACL类别 @write, @string, @slow 将给定的键设置为它们各自的值。MSET 用新的值替换现有的值,就像普通的 SET 一样。如果你不想覆盖现有的值,请参阅 MSETNX。 MSET 是原子性的,所以所有给定的键都是一次性设置的。也就是说,客户端不可能看到一些键被更新而另一些键没有变化。 返回值总是返回 OK,因为 MSET 命令永远不会失败。 示例123456redis> MSET key1 "Hello" key2 "World""OK"redis> GET key1"Hello"redis> GET key2"World" (END)