Class: ConfigCat::PollingMode

Inherits:
Object
  • Object
show all
Defined in:
lib/configcat/pollingmode.rb

Class Method Summary collapse

Class Method Details

.auto_poll(poll_interval_seconds: 60, max_init_wait_time_seconds: 5) ⇒ Object

Creates a configured auto polling configuration.

:param poll_interval_seconds: sets at least how often this policy should fetch the latest configuration and refresh the cache. :param max_init_wait_time_seconds: sets the maximum waiting time between initialization and the first config acquisition in seconds. :return [AutoPollingMode]



8
9
10
11
12
13
# File 'lib/configcat/pollingmode.rb', line 8

def self.auto_poll(poll_interval_seconds: 60, max_init_wait_time_seconds: 5)
  poll_interval_seconds = 1 if poll_interval_seconds < 1
  max_init_wait_time_seconds = 0 if max_init_wait_time_seconds < 0

  AutoPollingMode.new(poll_interval_seconds, max_init_wait_time_seconds)
end

.lazy_load(cache_refresh_interval_seconds: 60) ⇒ Object

Creates a configured lazy loading polling configuration.

:param cache_refresh_interval_seconds: sets how long the cache will store its value before fetching the latest from the network again. :return [LazyLoadingMode]



19
20
21
22
23
# File 'lib/configcat/pollingmode.rb', line 19

def self.lazy_load(cache_refresh_interval_seconds: 60)
  cache_refresh_interval_seconds = 1 if cache_refresh_interval_seconds < 1

  LazyLoadingMode.new(cache_refresh_interval_seconds)
end

.manual_pollObject

Creates a configured manual polling configuration. :return [ManualPollingMode]



27
28
29
# File 'lib/configcat/pollingmode.rb', line 27

def self.manual_poll
  ManualPollingMode.new
end