Class: MudisConfig
- Inherits:
-
Object
- Object
- MudisConfig
- Defined in:
- lib/mudis_config.rb
Overview
MudisConfig holds all configuration values for Mudis, and provides defaults that can be overridden via Mudis.configure.
Instance Attribute Summary collapse
-
#buckets ⇒ Object
Returns the value of attribute buckets.
-
#compress ⇒ Object
Returns the value of attribute compress.
-
#default_ttl ⇒ Object
Returns the value of attribute default_ttl.
-
#hard_memory_limit ⇒ Object
Returns the value of attribute hard_memory_limit.
-
#max_bytes ⇒ Object
Returns the value of attribute max_bytes.
-
#max_ttl ⇒ Object
Returns the value of attribute max_ttl.
-
#max_value_bytes ⇒ Object
Returns the value of attribute max_value_bytes.
-
#persistence_enabled ⇒ Object
Returns the value of attribute persistence_enabled.
-
#persistence_format ⇒ Object
Returns the value of attribute persistence_format.
-
#persistence_path ⇒ Object
Returns the value of attribute persistence_path.
-
#persistence_safe_write ⇒ Object
Returns the value of attribute persistence_safe_write.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
Instance Method Summary collapse
-
#initialize ⇒ MudisConfig
constructor
rubocop:disable Metrics/MethodLength.
Constructor Details
#initialize ⇒ MudisConfig
rubocop:disable Metrics/MethodLength
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mudis_config.rb', line 20 def initialize # rubocop:disable Metrics/MethodLength @serializer = JSON # Default serialization strategy @compress = false # Whether to compress values with Zlib @max_value_bytes = nil # Max size per value (optional) @hard_memory_limit = false # Enforce max_bytes as hard cap @max_bytes = 1_073_741_824 # 1 GB default max cache size @buckets = nil # use nil to signal fallback to ENV or default @max_ttl = nil # Max TTL for cache entries (optional) @default_ttl = nil # Default TTL for cache entries (optional) # Persistence settings @persistence_enabled = false # Whether persistence is enabled @persistence_path = "mudis_data" # Default path for persistence files @persistence_format = :json # Default persistence file format @persistence_safe_write = true # Whether to use safe write for persistence end |
Instance Attribute Details
#buckets ⇒ Object
Returns the value of attribute buckets.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def buckets @buckets end |
#compress ⇒ Object
Returns the value of attribute compress.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def compress @compress end |
#default_ttl ⇒ Object
Returns the value of attribute default_ttl.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def default_ttl @default_ttl end |
#hard_memory_limit ⇒ Object
Returns the value of attribute hard_memory_limit.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def hard_memory_limit @hard_memory_limit end |
#max_bytes ⇒ Object
Returns the value of attribute max_bytes.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def max_bytes @max_bytes end |
#max_ttl ⇒ Object
Returns the value of attribute max_ttl.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def max_ttl @max_ttl end |
#max_value_bytes ⇒ Object
Returns the value of attribute max_value_bytes.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def max_value_bytes @max_value_bytes end |
#persistence_enabled ⇒ Object
Returns the value of attribute persistence_enabled.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def persistence_enabled @persistence_enabled end |
#persistence_format ⇒ Object
Returns the value of attribute persistence_format.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def persistence_format @persistence_format end |
#persistence_path ⇒ Object
Returns the value of attribute persistence_path.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def persistence_path @persistence_path end |
#persistence_safe_write ⇒ Object
Returns the value of attribute persistence_safe_write.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def persistence_safe_write @persistence_safe_write end |
#serializer ⇒ Object
Returns the value of attribute serializer.
6 7 8 |
# File 'lib/mudis_config.rb', line 6 def serializer @serializer end |