sgflt

Crates.iosgflt
lib.rssgflt
version0.1.0
sourcesrc
created_at2024-01-09 11:53:27.267469
updated_at2024-01-09 11:53:27.267469
descriptionDuplicate value filtering
homepage
repositoryhttps://github.com/woshihaoren4/single_filter
max_upload_size
id1093838
size41,510
teshin (woshihaoren4)

documentation

README

single_filter

Filter duplicate keys

quick start

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);

batch

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();

expansion strategy

  • set_strategy_fixed : Expand to a fixed size
  • set_strategy_ladder : Use fixed policies to expand capacity
  • set_strategy_function : User-defined expansion mode

other

grpc service and docker image need to be improved

Commit count: 0

cargo fmt