Module: MultiJson::OptionsCache Private

Defined in:
lib/multi_json/options_cache.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Thread-safe LRU-like cache for merged options hashes

Caches are separated for load and dump operations. Each cache is bounded to prevent unbounded memory growth when options are generated dynamically.

Defined Under Namespace

Classes: Store

Constant Summary collapse

MAX_CACHE_SIZE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Maximum entries before oldest entry is evicted

1000

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.dumpStore (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get the dump options cache

Returns:

  • (Store)

    dump cache store



78
79
80
# File 'lib/multi_json/options_cache.rb', line 78

def dump
  @dump
end

.loadStore (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get the load options cache

Returns:

  • (Store)

    load cache store



84
85
86
# File 'lib/multi_json/options_cache.rb', line 84

def load
  @load
end

Class Method Details

.resetvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Reset both caches



90
91
92
93
# File 'lib/multi_json/options_cache.rb', line 90

def reset
  @dump = Store.new
  @load = Store.new
end