miyazakiresistance¶ ↑
DESCRIPTION:¶ ↑
MiyazakiResistance is a library like ActiveRecord to use Tokyo Tyrant. MiyazakiResistance support Master/Slave. If Slave server down, it separates automatically. MiyazakiResistance support Dual Master(Active/Standby). If Active server down, Standby server become Active.
SYNOPSIS:¶ ↑
require 'miyazakiresistance'
class Example < MiyazakiResistance::Base
  server :localhost, 1975, :write
  server :slave_host, 1975, :standby
  timeout 1
  column :name, :string
  column :age, :number
  column :birthday, :date
  column :created_at, :datetime
end
work = Example.new
work.name = "tsukasa"
work.age = 34
work.birthday => Date.today
work.save
Example.create(:name => "oishi", :age => 14, :birthday => Date.today)
Example.count
Example.count(:conditions => ["name = ?", "oishi"])
Example.find(1)
Example.find([1,2])
Example.find(:first)
Example.find(:all)
Example.find(:all, :conditions => ["name = ? age = ?", "tsukasa", 34], :order => "created_at DESC", :offset => 1, :limit => 1)
Example.find_by_name("tsukasa")
Example.find_all_by_name_and_age("tsukasa", 34)
Example.first
Example.delete_all(["created_at > ?", Time.local(2009,11,15)])
* You can write in config file
require 'miyazakiresistance'
class Example < MiyazakiResistance::Base
  server_config Rails.env, "log/miyazakiresistance.yml"
  timeout 60
  column :name, :string
  column :age, :integer
  column :birthday, :date
  column :created_at, :datetime
end
'in log/miyazakiresistance.log'
developemnt:
  set_server:
    - server: localhost
      port: 1975
role: write
- server: localhost port: 1978
role: readonly
REQUIREMENTS:¶ ↑
Tokyo Tyrant
INSTALL:¶ ↑
- 
sudo gem install miyazakiresistance
 
LICENSE:¶ ↑
Miyazakiresistance is released under the MIT license.