Class: FastExists::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/fast_exists/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fast_exists/configuration.rb', line 19

def initialize
  @backend = :memory
  @false_positive_rate = 0.001
  @expected_elements = 1_000_000
  @auto_sync = true
  @instrumentation = true
  @metrics = true
  @redis = nil
  @file_path = nil
  @logger = defined?(Rails) && Rails.respond_to?(:logger) ? Rails.logger : nil

  # Multi-tenant enterprise configuration
  @multi_tenant = false
  @tenant_strategy = :adaptive
  @tenant_thresholds = {
    tiny: 10_000,
    small: 100_000,
    medium: 1_000_000
  }
  @key_prefix = "fast_exists"
end

Instance Attribute Details

#auto_syncObject

Returns the value of attribute auto_sync.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def auto_sync
  @auto_sync
end

#backendObject

Returns the value of attribute backend.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def backend
  @backend
end

#expected_elementsObject

Returns the value of attribute expected_elements.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def expected_elements
  @expected_elements
end

#false_positive_rateObject

Returns the value of attribute false_positive_rate.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def false_positive_rate
  @false_positive_rate
end

#file_pathObject

Returns the value of attribute file_path.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def file_path
  @file_path
end

#instrumentationObject

Returns the value of attribute instrumentation.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def instrumentation
  @instrumentation
end

#key_prefixObject

Returns the value of attribute key_prefix.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def key_prefix
  @key_prefix
end

#loggerObject

Returns the value of attribute logger.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def logger
  @logger
end

#metricsObject

Returns the value of attribute metrics.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def metrics
  @metrics
end

#multi_tenantObject

Returns the value of attribute multi_tenant.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def multi_tenant
  @multi_tenant
end

#redisObject

Returns the value of attribute redis.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def redis
  @redis
end

#tenant_strategyObject

Returns the value of attribute tenant_strategy.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def tenant_strategy
  @tenant_strategy
end

#tenant_thresholdsObject

Returns the value of attribute tenant_thresholds.



5
6
7
# File 'lib/fast_exists/configuration.rb', line 5

def tenant_thresholds
  @tenant_thresholds
end

Instance Method Details

#reset!Object



41
42
43
# File 'lib/fast_exists/configuration.rb', line 41

def reset!
  initialize
end