GithubHelp home page GithubHelp logo

tsukasaoishi / miyazakiresistance Goto Github PK

View Code? Open in Web Editor NEW
57.0 3.0 3.0 48 KB

MiyazakiResistance is a library like ActiveRecord to use Tokyo Tyrant.

Home Page: http://www.kaeruspoon.net/keywords/MiyazakiResistance

Ruby 100.00%

miyazakiresistance's Introduction

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.

miyazakiresistance's People

Contributors

tsukasaoishi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.