class Concurrent::Map

def fetch_or_store(key, default_value = NULL)

Experimental RBS support (using type sampling data from the type_fusion project).

type Concurrent__Map_fetch_or_store_key = Array[Integer] | String | Sprockets::Preprocessors::DefaultSourceMap | Class | Sprockets::DirectiveProcessor | Integer | Array[]
type Concurrent__Map_fetch_or_store_return_value = ActiveModel::Type::String | nil | File::Stat | String | Sprockets::Asset | ActiveModel::Type::Integer | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Timestamp | Concurrent::Map | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Jsonb | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Date | ActiveRecord::Type::Text | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::TimestampWithTimeZone | ActiveModel::Type::Boolean | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Inet | ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array | ActiveRecord::Type::DateTime | Array[] | Array[String] | Array[NilClass] | ActiveRecord::ConnectionAdapters::SQLite3Adapter::SQLite3Integer

def fetch_or_store: (Concurrent__Map_fetch_or_store_key key, ?(Object | Concurrent::Map) default_value) -> Concurrent__Map_fetch_or_store_return_value

This signature was generated using 809 samples from 6 applications.

Returns:
  • (Object) - the value or default value

Other tags:
    Yieldreturn: - default value

Other tags:
    Yieldparam: key -

Other tags:
    Yield: - default value for a key

Parameters:
  • default_value (Object) --
  • key (Object) --
def fetch_or_store(key, default_value = NULL)
  fetch(key) do
    put(key, block_given? ? yield(key) : (NULL == default_value ? raise_fetch_no_key : default_value))
  end
end