我正在使用 redis-cli 学习 HyperLogLogs 示例
The redis-cli examples show how you can use HyperLogLog commands to record and count unique user visits to a website.
The command PFADD adds one or many strings to a HyperLogLog. PFADD returns 1 if the cardinality was changed and 0 if it remains the same:
尽管如此,当我按照说明操作时它会报错:
127.0.0.1:6379> PFADD visits:2015-01-01 "carl" "max" "hugo" "arthur"
(error) WRONGTYPE Key is not a valid HyperLogLog string value.
最佳答案
错误是,即使简洁,也非常有用 - 您正在尝试使用不是 HLL 的现有 key (即 visits:2015-01-01
)。
现有 key 可能是某种字符串,但如果您DEL visits:2015-01-01
,您应该能够PFADD
到它。
关于redis - (错误)WRONGTYPE 键不是有效的 HyperLogLog 字符串值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51857302/