Class: Farce::Strict::LRUMap

Inherits:
Abstract::LRUMap show all
Includes:
Farce::Shareable::Delegated
Defined in:
lib/farce/strict/lru_map.rb

Overview

A Ractor-shareable LRU map that stores shareable values directly. Keys must be shareable, except equality-mode mutable strings that can be snapshotted.

Instance Method Summary collapse

Methods included from Farce::Shareable

#initialize, #ractor_shareable?

Methods inherited from Abstract::BoundedMap

#[], #[]=, #clear, #compare_keys_by_identity?, #compare_values_by_identity?, #delete, #each, #each_key, #each_value, #fetch, #getkey, #initialize, #key?, #keys, #max_size, #max_size=, #prune, #shift, #size, #store_if_absent, #values

Methods included from Abstract::DuplicableMap

#compact, #compact_blank, #deep_dup, #duplicable?, #except, #flatten, #invert, #merge, #reject, #reverse_merge, #select, #slice, #stringify_keys, #symbolize_keys, #to_proc, #transform_keys, #transform_values, #with_indifferent_access

Methods inherited from Abstract::Map

#[], #[]=, #as_extended_json, #as_json, #assert_valid_keys, #assoc, #bson_type, #clear, #compare_by_identity?, #compare_keys_by_identity?, #compare_values_by_identity?, #deconstruct_keys, #delete, #dig, #each, #each_key, #each_pair, #each_value, #empty?, #fetch, #fetch_values, #getkey, #has_key?, #key, #key?, #keys, #length, #rassoc, #size, #store, #store_if_absent, #to_a, #to_bson, #to_bson_normalized_value, #to_cbor, #to_h, #to_hash, #to_json, #to_msgpack, #to_query, #to_s, #value?, #values_at, #weak_keys?, #weak_values?

Instance Method Details

#shareable_keys? ⇒ Boolean

Note:

Some maps may still accept non-shareable keys or values, but convert them into shareable representations. This method will still return true for such maps.

Returns Whether the map requires keys to be Ractor-shareable.

Returns:

  • (Boolean) —

    Whether the map requires keys to be Ractor-shareable



13
# File 'lib/farce/strict/lru_map.rb', line 13

def shareable_keys? = true

#shareable_values? ⇒ Boolean

Returns Whether the map requires values to be Ractor-shareable.

Returns:

  • (Boolean) —

    Whether the map requires values to be Ractor-shareable



16
# File 'lib/farce/strict/lru_map.rb', line 16

def shareable_values? = true