1 class Video < Ohm::Model 2 attribute :url 3 attribute :created_at 4 set :tags 5 6 index :url # 検索対象には全てindexを作成する 7 index :tags # 検索対象には全てindexを作成する 8 end pkeyのidが勝手に定義される redisで利用可能なvalueの型は、文字列と集合 Ohmでは文字列型を attribute で定義する Ohmでは集合型を set で定義する Ohmではさらに独自の list(順序付き集合), counter(増減のみ操作可能な数値) 型が利用可能 使用例 1 video = Video.new(:url=>"http://www.you...", :tags=>"愛理") 2 video.save 3 video.tag