class GraphQL::Execution::Lazy::LazyMethodMap::ConcurrentishMap
Mock the Concurrent::Map API
def []=(key, value)
def []=(key, value) @semaphore.synchronize { @storage[key] = value } end
def compute_if_absent(key)
def compute_if_absent(key) @semaphore.synchronize { @storage.fetch(key) { @storage[key] = yield } } end
def copy_storage
def copy_storage @semaphore.synchronize { @storage.dup } end
def initialize
def initialize @semaphore = Mutex.new # Access to this hash must always be managed by the mutex # since it may be modified at runtime @storage = {} end
def initialize_copy(other)
def initialize_copy(other) @semaphore = Mutex.new @storage = other.copy_storage end