redis - (错误)WRONGTYPE 键不是有效的 HyperLogLog 字符串值

标签 redis

我正在使用 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:

enter image description here

尽管如此,当我按照说明操作时它会报错:

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/

相关文章:

sqlite - 用于存储基于大型集合/数组的数据的高写入并发后端?

Redis 原子弹出并添加到排序集,相当于 BRPOPLPUSH

django - 带有随 secret 码的Redis AUTH

python - 如何使用 redis 存储和检索字典

node.js - Node Js : Redis job is not completing after finish its task

scala - 将订户建模为 Akka Actor 的正确方法

node.js - 使用 redis-mock 进行 Nodejs 单元测试导致 ECONNREFUSED

c# - Service Stack Redis 连接的线程安全

redis - Symfony3 分析器存储

sql - 制作 Redis 集合以进行快速查找