Class: MudisConfig

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeMudisConfig

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

#bucketsObject

Returns the value of attribute buckets.



6
7
8
# File 'lib/mudis_config.rb', line 6

def buckets
  @buckets
end

#compressObject

Returns the value of attribute compress.



6
7
8
# File 'lib/mudis_config.rb', line 6

def compress
  @compress
end

#default_ttlObject

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_limitObject

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_bytesObject

Returns the value of attribute max_bytes.



6
7
8
# File 'lib/mudis_config.rb', line 6

def max_bytes
  @max_bytes
end

#max_ttlObject

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_bytesObject

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_enabledObject

Returns the value of attribute persistence_enabled.



6
7
8
# File 'lib/mudis_config.rb', line 6

def persistence_enabled
  @persistence_enabled
end

#persistence_formatObject

Returns the value of attribute persistence_format.



6
7
8
# File 'lib/mudis_config.rb', line 6

def persistence_format
  @persistence_format
end

#persistence_pathObject

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_writeObject

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

#serializerObject

Returns the value of attribute serializer.



6
7
8
# File 'lib/mudis_config.rb', line 6

def serializer
  @serializer
end