File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,6 @@ gem 'json'
1111gem 'rubocop' , '~> 1.37' , group : 'development'
1212gem 'rubocop-performance' , '~> 1.15' , group : 'development'
1313gem 'thin' , :platforms => :ruby
14+
15+ gem "redis" , "~> 5.3"
16+ gem "connection_pool" , "~> 2.4"
Original file line number Diff line number Diff line change @@ -25,6 +25,31 @@ def initialize(log, config)
2525 opts [ :base_uri ] = polling [ :baseUri ] unless polling [ :baseUri ] . nil?
2626 opts [ :payload_filter_key ] = polling [ :filter ] unless polling [ :filter ] . nil?
2727 opts [ :poll_interval ] = polling [ :pollIntervalMs ] / 1_000.0 unless polling [ :pollIntervalMs ] . nil?
28+ else
29+ opts [ :use_ldd ] = true
30+ end
31+
32+ if config [ :persistentDataStore ]
33+ store_config = { }
34+ store_config [ :prefix ] = config [ :persistentDataStore ] [ :store ] [ :prefix ] if config [ :persistentDataStore ] [ :store ] [ :prefix ]
35+
36+ case config [ :persistentDataStore ] [ :cache ] [ :mode ]
37+ when 'off'
38+ store_config [ :expiration ] = 0
39+ when 'infinite'
40+ # NOTE: We don't actually support infinite cache mode, so we'll just set it to nil for now. This uses a default
41+ # 15 second expiration time in the SDK, which is long enough to pass any test.
42+ store_config [ :expiration ] = nil
43+ when 'ttl'
44+ store_config [ :expiration ] = config [ :persistentDataStore ] [ :cache ] [ :ttl ]
45+ end
46+
47+ case config [ :persistentDataStore ] [ :store ] [ :type ]
48+ when 'redis'
49+ store_config [ :redis_url ] = config [ :persistentDataStore ] [ :store ] [ :dsn ]
50+ store = LaunchDarkly ::Integrations ::Redis . new_feature_store ( store_config )
51+ opts [ :feature_store ] = store
52+ end
2853 end
2954
3055 if config [ :events ]
Original file line number Diff line number Diff line change 4545 'evaluation-hooks' ,
4646 'omit-anonymous-contexts' ,
4747 'client-prereq-events' ,
48+ 'persistent-data-store-redis' ,
4849 ] ,
4950 } . to_json
5051end
You can’t perform that action at this time.
0 commit comments