@@ -23,6 +23,7 @@ class SplitConfig
23
23
# @option opts [Int] :impressions_queue_size Size of the impressions queue in the memory repository. Once reached, newer impressions will be dropped
24
24
# @option opts [Int] :impressions_bulk_size Max number of impressions to be sent to the backend on each post
25
25
# @option opts [#log] :impression_listener this object will capture all impressions and process them through `#log`
26
+ # @option opts [Boolean] :ignore_nil (true) The value to enable or disable caching nil values.
26
27
# @option opts [Int] :cache_ttl Time to live in seconds for the memory cache values when using Redis.
27
28
# @option opts [Int] :max_cache_size Max number of items to be held in the memory cache before prunning when using Redis.
28
29
# @return [type] SplitConfig with configuration options
@@ -70,6 +71,7 @@ def initialize(opts = {})
70
71
@machine_name = SplitConfig . machine_hostname ( @ip_addresses_enabled , opts [ :machine_name ] , opts [ :cache_adapter ] || SplitConfig . default_cache_adapter )
71
72
@machine_ip = SplitConfig . machine_ip ( @ip_addresses_enabled , opts [ :machine_ip ] , opts [ :cache_adapter ] || SplitConfig . default_cache_adapter )
72
73
74
+ @ignore_nil = opts [ :ignore_nil ] || SplitConfig . ignore_nil
73
75
@cache_ttl = opts [ :cache_ttl ] || SplitConfig . cache_ttl
74
76
@max_cache_size = opts [ :max_cache_size ] || SplitConfig . max_cache_size
75
77
@@ -221,6 +223,7 @@ def initialize(opts = {})
221
223
attr_accessor :machine_ip
222
224
attr_accessor :machine_name
223
225
226
+ attr_accessor :ignore_nil
224
227
attr_accessor :cache_ttl
225
228
attr_accessor :max_cache_size
226
229
@@ -591,6 +594,15 @@ def self.transport_debug
591
594
false
592
595
end
593
596
597
+ #
598
+ # The default ignore_nil value
599
+ #
600
+ #
601
+ # @return [boolean]
602
+ def self . ignore_nil
603
+ true
604
+ end
605
+
594
606
#
595
607
# The default cache time to live
596
608
#
@@ -599,13 +611,15 @@ def self.cache_ttl
599
611
5
600
612
end
601
613
614
+ #
602
615
# The default max cache size
603
616
#
604
617
# @return [int]
605
618
def self . max_cache_size
606
619
500
607
620
end
608
621
622
+ #
609
623
# The default max key size
610
624
#
611
625
# @return [int]
0 commit comments