scrapy_redis use cuckoofilter
Project description
Scrapy-Redis-CuckooFilter
这是个scrapy_redis的布谷鸟过滤器版本,项目和 https://github.com/kanadeblisst/scrapy_redis_bf 基本一样
必要条件
需要redis加载了布隆过滤器的插件,默认安装的redis是没有加载的 具体请看:https://redis.io/docs/stack/bloom/quick_start/
安装
使用pip: pip install scrapy-redis-cf
使用
在scrapy项目里的 settings.py添加如下设置:
SCHEDULER = "scrapy_redis_cf.scheduler.Scheduler"
DUPEFILTER_CLASS = "scrapy_redis_cf.dupefilter.RFPDupeFilter"
# 格式:redis://[:password@]host[:port][/database][?[timeout=timeout[d|h|m|s|ms|us|ns]][&database=database]]
REDIS_URL = 'redis://localhost:6379'
# 桶的大小,桶越大错误率越高, 但过滤器填充率越高
# 等于1时错误率最小为0.78%,等于3时为2.35%, 等于2时官网没说我也不知道
# https://redis.io/commands/cf.reserve/
CUCKOOFILTER_BUCKETSIZE = 2
# 去重数量 2 ** 18 ,
# 注意:实际容量要小于这个,因为布谷鸟过滤器很难完全填满
CUCKOOFILTER_CAPACITY_BIT = 18
# 支持扩展容量的次数, 扩展次数越多,错误率越高
CUCKOOFILLTER_EXPANSION = 2
测试
下载该项目,然后运行里面的test spider即可
Github
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scrapy_redis_cf-0.0.1.tar.gz.
File metadata
- Download URL: scrapy_redis_cf-0.0.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9903fdc8316c26563a0b5db849e36c327673226d8026159250877a6def389433
|
|
| MD5 |
cff466925763aa088d6ca01a13bbb666
|
|
| BLAKE2b-256 |
f3b7d67f624846c539b3ac0440f86dbe1927e3aeded505aeab1620821f76bf9a
|
File details
Details for the file scrapy_redis_cf-0.0.1-py3-none-any.whl.
File metadata
- Download URL: scrapy_redis_cf-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff47b22759130a2478a665ad8cc0e55fa4bbbbb7e229fef0e4d8c73ca3f5d3a5
|
|
| MD5 |
2f3d67c18de1cf54d2e1d2feb46286c0
|
|
| BLAKE2b-256 |
63ce6970a618ed105ad22e28039b93de8ba63e317ebc6d01c1278adaa474b1be
|