class ActiveSupport::Cache::MemoryStore

def increment(name, amount = 1, options = nil)

Increment an integer value in the cache.
def increment(name, amount = 1, options = nil)
  synchronize do
    options = merged_options(options)
    if num = read(name, options)
      num = num.to_i + amount
      write(name, num, options)
      num
    else
      nil
    end
  end
end