Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
MiyazakiResistanceを作ってみたよ
Search
Tsukasa OISHI
July 17, 2009
Programming
0
820
MiyazakiResistanceを作ってみたよ
Tsukasa OISHI
July 17, 2009
Tweet
Share
More Decks by Tsukasa OISHI
See All by Tsukasa OISHI
SLI/SLO をストリーム アラインドチームに導入した話
tsukasa_oishi
0
89
JITをたどるとそこはYARVの中
tsukasa_oishi
0
530
The Cacher in the Rye
tsukasa_oishi
1
5.6k
ISeqで遊ぼう
tsukasa_oishi
0
4.9k
Rubyを30倍速くした話
tsukasa_oishi
0
1k
はてブ砲をくらったときのお話
tsukasa_oishi
0
1.8k
食べログで動いている自作ライブラリのお話
tsukasa_oishi
0
290
奥さんとプログラミングを両立させる方法
tsukasa_oishi
0
46
Other Decks in Programming
See All in Programming
SIMD Parallel Programming with the Vector API
josepaumard
0
220
Kotlin Multiplatform at Stable and Beyond (Android Makers 2024)
zsmb
0
440
Domain-Driven Transformation
hschwentner
2
1.5k
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
380
Introducing Kotlin Multiplatform in an existing mobile app - Workshop Edition | AndroidMakers Paris
prof18
0
140
PHPの次期バージョンはこの時期どうなっているのか - Internalsの開発体制について - PHPカンファレンス小田原
youkidearitai
PRO
1
220
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
7
970
"config" ってなんだ? / What is "config"?
okashoi
0
250
敵対的ポイフル
futabato
0
130
Anthropic Cookbook のおすすめレシピ
schroneko
7
1.1k
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
670
Site Reliability Engineering for GMO
pyama86
8
1.1k
Featured
See All Featured
Designing Experiences People Love
moore
136
23k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
228
16k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
275
13k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
117
18k
Atom: Resistance is Futile
akmur
260
25k
In The Pink: A Labor of Love
frogandcode
138
21k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
358
22k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
22
1.6k
GitHub's CSS Performance
jonrohan
1025
450k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
7
1.3k
What’s in a name? Adding method to the madness
productmarketing
PRO
17
2.7k
Transcript
Miyazaki Resistance を作ってみたよ I've developed MiyazakiResistance
おおいし つかさ Tsukasa OISHI
食べログ グルメサイト プログラマ Tabelog.com Review site of great restaurants Programmer
iPhoneアプリ ver2.0 が出ました I've released iPhone application of Tabelog ver
2.0
本題 Main
Miyazaki Resistance?
ActiveRecord のように Tokyo Tyrantを 使うことが できます Library like ActiveRecord to
use Tokyo Tyrant
Tokyo Tyrant?
Tokyo Cabinetと やりとりするための ネットワーク インターフェース The Package of network interface
to Tokyo Cabinet.
Tokyo Cabinet?
Key Value Strage
Table構造 【Key】 id 【Value】 article_id : integer count : integer
created_at : datetime
記事ID100の 昨日の アクセス数を 取得する Search access count of article-ID 100
yesterday.
Ruby API
TTとの接続 rdb = TokyoTyrant::RDBTBL.new rdb.open(“localhost”, 1975)
クエリの作成 query = TokyoTyrant::RDBQRY.new(rdb) query.addcond(“created_at”, TokyoTyrant::RDBQRY::QCNUMEQ, Time.local(2009, 7, 16).to_i) query.addcond(“article_id”,
TokyoTyrant::RDBQRY::QCNUMEQ, 100)
クエリの作成 query = TokyoTyrant::RDBQRY.new(rdb) query.addcond(“created_at”, TokyoTyrant::RDBQRY::QCNUMEQ, Time.local(2009, 7, 16).to_i) query.addcond(“article_id”,
TokyoTyrant::RDBQRY::QCNUMEQ, 100)
データの取得 article_100_count = query.search.first
メンドくさい... orz troublesomeness...orz
いいもの なのに もったいない! Mottainai!
Miyazaki Resistance!
ArticleCount.find( :first, :conditions => [“restaurant_id = ? created_at = ?”,
100, Time.local(2009, 7, 16) ) 簡単
ArticleCount class ArticleCount < MiyazakiResistance::Base set_server :localhost, 1975, :write set_column
:restaurant_id, :integer set_column :count, :integer set_column :created_at, :datetime end
Replication
set_server :master, 1975, :write set_server :slave1, 1975, :readonly set_server :slave2,
1975, :readonly
DualMaster
set_server :m1, 1975, :write set_server :m2, 1975, :standby
食べログでも 使っているよ ・各レストランのアクセスカウント ・デュアルマスタ構成 ・約1.8億PV
gem install tsukasaoishi- miyazakiresistance
おしまい thanks!