= ActiveTokyoCabinet

Copyright (c) 2010 SUGAWARA Genki <sgwr_dts@yahoo.co.jp>

== Description

ActiveTokyoCabinet is a library for using TokyoCabinet under ActiveRecord.

ActiveTokyoCabinet depend on TokyoCabinet.

see http://1978th.net/tokyocabinet/ .

== Project Page

http://rubyforge.org/projects/activetokyocabi

== Install

gem install zipruby

== Example
=== database.yml

    development:
      adapter: tokyocabinet
      database: path_of_database_directory
                               # ~~~~~~~~~

=== Model

    class Hello < ActiveRecord::Base
      include ActiveTokyoCabinet::TDB
    
      # define schema information.
      # (string, int, float)
      string :name
      int    :age
    end

=== Example Controller

    class HelloController < ApplicationController
      def index
        (20..35).each do |i|
          hello = Hello.new
          hello.name = 'yamada'
          hello.age  = 20
          hello.save!
        end
    
        p Hello.find(:all, 
                     :conditions => ["name = ? and age > ?", "yamada", 25],
                     :order => 'age desc', :limit => 5, :offset => 3)
    
        hello = Hello.find(1)
        hello.name = 'sato'
        hello.save!
    
        p Hello.find(:first, :conditions => ["name = ?", "tanaka"])
    
        hello = Hello.find(2)
        hello.destroy
    
        p Hello.find(:all)
    
        Hello.delete_all(["name = ? and age <= ?", "yamada", 30])
    
        p Hello.find(:all)
    
        render :text => 'hello'
      end
    end
