123456789_123456789_123456789_123456789_123456789_

Class: Concurrent::Collection::MriMapBackend

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: Concurrent::Collection::NonConcurrentMapBackend
Defined in: lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb

Class Method Summary

NonConcurrentMapBackend - Inherited

.new

WARNING: all public methods of the class must operate on the @backend directly without calling each other.

Instance Method Summary

Constructor Details

.new(options = nil, &default_proc) ⇒ MriMapBackend

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 12

def initialize(options = nil, &default_proc)
  super(options, &default_proc)
  @write_lock = Mutex.new
end

Instance Method Details

#[]=(key, value)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 17

def []=(key, value)
  @write_lock.synchronize { super }
end

#clear

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 61

def clear
  @write_lock.synchronize { super }
end

#compute(key)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 33

def compute(key)
  @write_lock.synchronize { super }
end

#compute_if_absent(key)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 21

def compute_if_absent(key)
  if NULL != (stored_value = @backend.fetch(key, NULL)) # fast non-blocking path for the most likely case
    stored_value
  else
    @write_lock.synchronize { super }
  end
end

#compute_if_present(key)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 29

def compute_if_present(key)
  @write_lock.synchronize { super }
end

#delete(key)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 53

def delete(key)
  @write_lock.synchronize { super }
end

#delete_pair(key, value)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 57

def delete_pair(key, value)
  @write_lock.synchronize { super }
end

#get_and_set(key, value)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 49

def get_and_set(key, value)
  @write_lock.synchronize { super }
end

#merge_pair(key, value)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 37

def merge_pair(key, value)
  @write_lock.synchronize { super }
end

#replace_if_exists(key, new_value)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 45

def replace_if_exists(key, new_value)
  @write_lock.synchronize { super }
end

#replace_pair(key, old_value, new_value)

[ GitHub ]

  
# File 'lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb', line 41

def replace_pair(key, old_value, new_value)
  @write_lock.synchronize { super }
end