class ActiveSupport::Cache::FileStore
def lock_file(file_name, &block) # :nodoc:
Lock a file for a block so only one process can modify it at a time.
def lock_file(file_name, &block) # :nodoc: if File.exist?(file_name) File.open(file_name, 'r+') do |f| begin f.flock File::LOCK_EX yield ensure f.flock File::LOCK_UN end end else yield end end