@@ -23,6 +23,7 @@ class SplitConfig
2323 # @option opts [Int] :impressions_queue_size Size of the impressions queue in the memory repository. Once reached, newer impressions will be dropped
2424 # @option opts [Int] :impressions_bulk_size Max number of impressions to be sent to the backend on each post
2525 # @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.
2627 # @option opts [Int] :cache_ttl Time to live in seconds for the memory cache values when using Redis.
2728 # @option opts [Int] :max_cache_size Max number of items to be held in the memory cache before prunning when using Redis.
2829 # @return [type] SplitConfig with configuration options
@@ -70,6 +71,7 @@ def initialize(opts = {})
7071 @machine_name = SplitConfig . machine_hostname ( @ip_addresses_enabled , opts [ :machine_name ] , opts [ :cache_adapter ] || SplitConfig . default_cache_adapter )
7172 @machine_ip = SplitConfig . machine_ip ( @ip_addresses_enabled , opts [ :machine_ip ] , opts [ :cache_adapter ] || SplitConfig . default_cache_adapter )
7273
74+ @ignore_nil = opts [ :ignore_nil ] || SplitConfig . ignore_nil
7375 @cache_ttl = opts [ :cache_ttl ] || SplitConfig . cache_ttl
7476 @max_cache_size = opts [ :max_cache_size ] || SplitConfig . max_cache_size
7577
@@ -221,6 +223,7 @@ def initialize(opts = {})
221223 attr_accessor :machine_ip
222224 attr_accessor :machine_name
223225
226+ attr_accessor :ignore_nil
224227 attr_accessor :cache_ttl
225228 attr_accessor :max_cache_size
226229
@@ -591,6 +594,15 @@ def self.transport_debug
591594 false
592595 end
593596
597+ #
598+ # The default ignore_nil value
599+ #
600+ #
601+ # @return [boolean]
602+ def self . ignore_nil
603+ true
604+ end
605+
594606 #
595607 # The default cache time to live
596608 #
@@ -599,13 +611,15 @@ def self.cache_ttl
599611 5
600612 end
601613
614+ #
602615 # The default max cache size
603616 #
604617 # @return [int]
605618 def self . max_cache_size
606619 500
607620 end
608621
622+ #
609623 # The default max key size
610624 #
611625 # @return [int]
0 commit comments