英文:
Bloom Filter of MongoDB ids in Redis and Go
问题
我正在处理文章建议。有很多文章。想想YouTube视频建议。为了避免再次建议已经被特定用户看过的文章,我想记住它们。我有很多用户,也想避免历史数据库无限增长的问题。
每篇文章都有一个MongoDB的ObjectId。我使用Redis和Go语言。
我认为布隆过滤器可以解决这个问题,因为在这种情况下,误判是可以接受的。我想避免误判,但这并不是100%必须的。
在这个领域,我不知道任何明智的布隆过滤器替代方案。我应该知道吗?
我找不到Redis在Go语言中的布隆过滤器实现。有人可以建议我是否选择了最佳方案,如何编写自己的实现,或者是否有现有的实现吗?
英文:
I'm working on articles suggestions. There are lots of them. Think about YouTube videos suggestions. To avoid suggesting article once again I'd like to remember which were seen already by particular user. I have lot's of users and I'd like to avoid infinitely growing database of history as well.
Every article has MongoDB ObjectId. I use Redis and Go language.
I think that Bloom Filter could solve this problem, because false positives are ok in this case. I'd like to avoid false negatives, but it's not 100% obligatory.
I don't know any sensible alternative to Bloom Filter in this area. Should I?
I can't find any implementation of Bloom Filter for Redis in Go. Can somebody advice me is it the best choice, how can I write my own or is there any existing implementation?
答案1
得分: 1
对于偶然发现这篇帖子的任何人,如果你在这种情况下使用Redis,那么你可能想使用它的HyperLogLog功能;Antirez在这里详细介绍了它。无需弄清楚如何在Redis中创建布隆过滤器,它内置了一个同样好用的功能(还可以告诉你大约插入了多少项)。
英文:
For anyone stumbling across this post, if you're using Redis in this situation, then you probably want to use its HyperLogLog feature; Antirez wrote about it at length here. No need to figure out how to make a bloom filter in Redis, it has something just as good built in (and it can also tell you approximately how many items have been inserted in it).
答案2
得分: 0
正如 @jumand 提到的,Redis有一个名为RedisBloom的模块,它提供了布隆过滤器、布谷鸟过滤器、Count-Min Sketch和TopK服务。
英文:
As @jumand mentioned, Redis has a module named RedisBloom which provides a Bloom Filter, Cuckoo Filter, Count-Min Sketch and TopK services.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论