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

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