Class: Prefab::EvaluatedKeysAggregator
- Inherits:
-
Object
- Object
- Prefab::EvaluatedKeysAggregator
- Includes:
- PeriodicSync
- Defined in:
- lib/prefab/evaluated_keys_aggregator.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(client:, max_keys:, sync_interval:) ⇒ EvaluatedKeysAggregator
constructor
A new instance of EvaluatedKeysAggregator.
- #push(key) ⇒ Object
Methods included from PeriodicSync
#log_internal, #on_prepare_data, #pool, #prepare_data, #start_periodic_sync, #sync
Constructor Details
#initialize(client:, max_keys:, sync_interval:) ⇒ EvaluatedKeysAggregator
Returns a new instance of EvaluatedKeysAggregator.
11 12 13 14 15 16 17 18 19 |
# File 'lib/prefab/evaluated_keys_aggregator.rb', line 11 def initialize(client:, max_keys:, sync_interval:) @max_keys = max_keys @client = client @name = 'evaluated_keys_aggregator' @data = Concurrent::Set.new start_periodic_sync(sync_interval) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/prefab/evaluated_keys_aggregator.rb', line 9 def data @data end |
Instance Method Details
#push(key) ⇒ Object
21 22 23 24 25 |
# File 'lib/prefab/evaluated_keys_aggregator.rb', line 21 def push(key) return if @data.size >= @max_keys @data.add(key) end |