Sha256: b295509ae66537dd4bcdbd086f07d34fe87ba6afae2079aff9c1fc8ddffc7b9a

Contents?: true

Size: 520 Bytes

Versions: 9

Compression:

Stored size: 520 Bytes

Contents

require "bench"
require_relative "../lib/ohm"

Ohm.redis = Redic.new("redis://127.0.0.1:6379/15")
Ohm.flush

class Event < Ohm::Model
  attribute :name
  attribute :location

  index :name
  index :location

  def validate
    assert_present :name
    assert_present :location
  end
end

class Sequence
  def initialize
    @value = 0
  end

  def succ!
    Thread.exclusive { @value += 1 }
  end

  def self.[](name)
    @@sequences ||= Hash.new { |hash, key| hash[key] = Sequence.new }
    @@sequences[name]
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
ohm-2.3.0 benchmarks/common.rb
ohm-2.2.1 benchmarks/common.rb
sohm-0.9.0 benchmarks/common.rb
sohm-0.0.1 benchmarks/common.rb
ohm-2.2.0 benchmarks/common.rb
ohm-2.1.0 benchmarks/common.rb
ohm-2.0.1 benchmarks/common.rb
ohm-2.0.0 benchmarks/common.rb
ohm-2.0.0.rc2 benchmarks/common.rb