Class: Wayfarer::Frontiers::MemoryBloomfilter Private
- Inherits:
-
MemoryFrontier
- Object
- Frontier
- MemoryFrontier
- Wayfarer::Frontiers::MemoryBloomfilter
- Defined in:
- lib/wayfarer/frontiers/memory_bloomfilter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
An in-memory bloomfilter.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Frontier
Instance Method Summary collapse
- #cache(*uris) ⇒ Object private
- #cached?(uri) ⇒ Boolean private
-
#free ⇒ Object
private
Frees up memory.
-
#initialize(config) ⇒ MemoryBloomfilter
constructor
private
A new instance of MemoryBloomfilter.
Methods inherited from MemoryFrontier
#current_uris, #stage, #staged?, #staged_uris
Methods inherited from Frontier
#current_uris, #cycle, #filter_staged_uris!, #reset_staged_uris!, #stage, #staged?, #staged_uris, #swap!
Constructor Details
#initialize(config) ⇒ MemoryBloomfilter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MemoryBloomfilter.
10 11 12 13 |
# File 'lib/wayfarer/frontiers/memory_bloomfilter.rb', line 10 def initialize(config) @filter = BloomFilter::Native.new(config.bloomfilter_opts) super(config) end |
Instance Method Details
#cache(*uris) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/wayfarer/frontiers/memory_bloomfilter.rb', line 16 def cache(*uris) uris.each { |uri| @filter.insert(uri) } end |
#cached?(uri) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/wayfarer/frontiers/memory_bloomfilter.rb', line 21 def cached?(uri) @filter.include?(uri) end |
#free ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Frees up memory.
26 27 28 29 |
# File 'lib/wayfarer/frontiers/memory_bloomfilter.rb', line 26 def free @filter.clear super end |