Class: Optify::CacheInitOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/optify_ruby/cache_init_options.rb

Overview

Options for initializing the cache.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_size: nil, mode: CacheMode::NOT_THREAD_SAFE) ⇒ CacheInitOptions

Initializes the cache options. Defaults to a non-thread-safe unlimited size cache for backwards compatibility with how this library was originally configured with an unbounded hash as the base. : ( | ?max_size: Integer?, | ?mode: Symbol, | ) -> void

Parameters:

  • mode (defaults to: CacheMode::NOT_THREAD_SAFE)

    A value from ‘CacheMode`.



33
34
35
36
37
38
39
# File 'lib/optify_ruby/cache_init_options.rb', line 33

def initialize(
  max_size: nil,
  mode: CacheMode::NOT_THREAD_SAFE
)
  @max_size = max_size
  @mode = mode
end

Instance Attribute Details

#max_sizeObject (readonly)

: Integer?



17
18
19
# File 'lib/optify_ruby/cache_init_options.rb', line 17

def max_size
  @max_size
end

#modeObject (readonly)

A value from ‘CacheMode`.

: Symbol



22
23
24
# File 'lib/optify_ruby/cache_init_options.rb', line 22

def mode
  @mode
end