@@ -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_empty_cache (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_empty_cache = opts [ :ignore_empty_cache ] || SplitConfig . ignore_empty_cache
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_empty_cache
224
227
attr_accessor :cache_ttl
225
228
attr_accessor :max_cache_size
226
229
@@ -591,6 +594,14 @@ def self.transport_debug
591
594
false
592
595
end
593
596
597
+ #
598
+ # The default ignore_empty_cache value
599
+ #
600
+ # @return [boolean]
601
+ def self . ignore_empty_cache
602
+ true
603
+ end
604
+
594
605
#
595
606
# The default cache time to live
596
607
#
@@ -599,13 +610,15 @@ def self.cache_ttl
599
610
5
600
611
end
601
612
613
+ #
602
614
# The default max cache size
603
615
#
604
616
# @return [int]
605
617
def self . max_cache_size
606
618
500
607
619
end
608
620
621
+ #
609
622
# The default max key size
610
623
#
611
624
# @return [int]
0 commit comments