# File lib/moneta/adapters/file.rb, line 64 def increment(key, amount = 1, options = {}) path = store_path(key) FileUtils.mkpath(::File.dirname(path)) ::File.open(path, ::File::RDWR | ::File::CREAT) do |f| Thread.pass until f.flock(::File::LOCK_EX) content = f.read amount += Utils.to_int(content) unless content.empty? content = amount.to_s f.pos = 0 f.write(content) f.truncate(content.bytesize) amount end end