Class: SplitIoClient::Cache::Stores::SegmentStore

Inherits:
Object
  • Object
show all
Defined in:
lib/cache/stores/segment_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(segments_repository, config, api_key, metrics, sdk_blocker = nil) ⇒ SegmentStore

Returns a new instance of SegmentStore.



7
8
9
10
11
12
13
# File 'lib/cache/stores/segment_store.rb', line 7

def initialize(segments_repository, config, api_key, metrics, sdk_blocker = nil)
  @segments_repository = segments_repository
  @config = config
  @api_key = api_key
  @metrics = metrics
  @sdk_blocker = sdk_blocker
end

Instance Attribute Details

#segments_repositoryObject (readonly)

Returns the value of attribute segments_repository.



5
6
7
# File 'lib/cache/stores/segment_store.rb', line 5

def segments_repository
  @segments_repository
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
# File 'lib/cache/stores/segment_store.rb', line 15

def call
  if ENV['SPLITCLIENT_ENV'] == 'test'
    store_segments
  else
    @sdk_blocker.segments_thread = Thread.new do
      @config.block_until_ready ? blocked_store : unblocked_store
    end
  end
end