Crates.io | sgflt |
lib.rs | sgflt |
version | 0.1.0 |
source | src |
created_at | 2024-01-09 11:53:27.267469 |
updated_at | 2024-01-09 11:53:27.267469 |
description | Duplicate value filtering |
homepage | |
repository | https://github.com/woshihaoren4/single_filter |
max_upload_size | |
id | 1093838 |
size | 41,510 |
Filter duplicate keys
In a distributed environment, filter a single key.
let strategy =
BloomExpandStrategy::build_from_redis("biz02", "redis://:root@127.0.0.1/")
.unwrap();
let pool = FiltersPool::from(strategy);
let exists = pool.contain("user001","key001".into()).await.unwrap();
assert_eq!(exists,false);
pool.insert("user001","key001".into()).await.unwrap();
let exists = pool.contain("user001","key001".into()).await.unwrap();
assert_eq!(exists,true);
In a recommendation system, you can call the system in batches, but this method has concurrency problems for the same group.
pool.batch_contain(group, keys).await.unwrap();
pool.batch_insert(group, keys).await.unwrap();
grpc service and docker image need to be improved