class Bootsnap::LoadPathCache::Store

def dump_data

def dump_data
  # Change contents atomically so other processes can't get invalid
  # caches if they read at an inopportune time.
  tmp = "#{@store_path}.#{Process.pid}.#{(rand * 100_000).to_i}.tmp"
  mkdir_p(File.dirname(tmp))
  exclusive_write = File::Constants::CREAT | File::Constants::EXCL | File::Constants::WRONLY
  # `encoding:` looks redundant wrt `binwrite`, but necessary on windows
  # because binary is part of mode.
  File.open(tmp, mode: exclusive_write, encoding: Encoding::BINARY) do |io|
    MessagePack.dump(@data, io)
  end
  File.rename(tmp, @store_path)
rescue Errno::EEXIST
  retry
rescue SystemCallError
end