'Guava BloomFilter how to expire once a day

I am using guava bloom filter to remove duplicate message in the service for receiving log. Is there a way for bloom filter to expire like guava cache does?



Solution 1:[1]

You can't even remove from Guava's BloomFilter, let alone automatically expire entries.

Solution 2:[2]

If you need remove functionality consider using a Counting Bloom Filter.

Solution 3:[3]

As suggested by Tavian Barnes, one solution here might be to create a class that wraps a BloomFilter and (once a day, or however often you want) atomically replaces that BloomFilter with a new one and repopulates it.

Solution 4:[4]

Consider using Sliding Bloom Filters

Check this, This can solve your problem

https://programming.guide/sliding-bloom-filter.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Louis Wasserman
Solution 2 Andrejs
Solution 3 ColinD
Solution 4 Innovation