Sha256: fe40f17d9d706a9e89e169f5a8a92270204d10125695cdb23993c95264a88558

Contents?: true

Size: 507 Bytes

Versions: 9

Compression:

Stored size: 507 Bytes

Contents

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

Ohm.connect(:port => 6379, :db => 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 & 1 rubygems

Version Path
ohm-1.4.0 benchmarks/common.rb
ohm-2.0.0.rc1 benchmarks/common.rb
ohm-2.0.0.alpha5 benchmarks/common.rb
ohm-2.0.0.alpha4 benchmarks/common.rb
ohm-2.0.0.alpha3 benchmarks/common.rb
ohm-2.0.0.alpha2 benchmarks/common.rb
ohm-2.0.0.alpha1 benchmarks/common.rb
ohm-1.3.2 benchmarks/common.rb
ohm-1.3.1 benchmarks/common.rb