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
Redis with Ruby
Search
Damian Le Nouaille
April 04, 2012
Programming
4
260
Redis with Ruby
Damian Le Nouaille
April 04, 2012
Tweet
Share
More Decks by Damian Le Nouaille
See All by Damian Le Nouaille
Re-Think your workflow with a piano
damln
0
150
Optimize or Die Tryin'
damln
1
220
Rails YAML vuln.
damln
1
220
Rails et Heroku
damln
3
340
Capucine
damln
1
140
Other Decks in Programming
See All in Programming
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
130
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
270
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.3k
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
190
今から始めるClaude Code超入門
448jp
8
8.6k
CSC307 Lecture 09
javiergs
PRO
1
830
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.8k
Oxlint JS plugins
kazupon
1
860
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
2026年 エンジニアリング自己学習法
yumechi
0
130
Fluid Templating in TYPO3 14
s2b
0
130
Featured
See All Featured
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Design in an AI World
tapps
0
140
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
170
Fireside Chat
paigeccino
41
3.8k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
640
A Modern Web Designer's Workflow
chriscoyier
698
190k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
160
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Transcript
None
REDIS Redis is an open source, advanced key- value store.
It is often referred to as a data structure server since keys can contain strings, hashes,lists, sets and sorted sets. gem ‘redis’
USE Cache Session (cookies) gem ‘redis-rails’ App::Application.config.session_store :redis_store, :servers =>
"redis://127.0.0.1:6379/1"
Commands $redis = new Redis(:host => ‘127.0.0.7’, :port => 6379,
:db => 0) $redis.set(‘my_key’, ‘awesome’) $redis.get(‘my_key’) => ‘awesome’ $redis.del(‘my_key’)
ENVIRONMENT Resque (+ Scheduler) Ohm EventMachine PubSub
Resque (+Scheduler) Fast ² Queue YAML - Cron gem ‘resque’
gem ‘resque-scheduler’, git: 'git://github.com/bvandenbos/resque-scheduler'
Ohm ORM Flexible Extensible gem ‘ohm’ gem ‘ohm-contrib’
Ohm (model) class User < Ohm::Model attribute :name attribute :nickname
include Ohm::Validations extend ActiveModel::Naming include ActiveModel::AttributeMethods index :name collection :messages, Message end
Ohm (model) class User < Ohm::Model def persisted? false end
def to_hash super.merge({:name => self.name}) end end
Ohm (model) class Message < Ohm::Model attribute :content include Ohm::Validations
extend ActiveModel::Naming include ActiveModel::AttributeMethods index :content reference :user, User end
EventMachine Node.js for Ruby em-WebSocket em-redis gem ‘eventmachine’ gem ‘em-redis’
PubSub $redis = new Redis(:host => ‘127.0.0.7’, :port => 6379,
:db => 0) $redis.publish(‘my_channel’, ‘content’) $redis.subscribe(‘my_channel’) do |on| on.message do |channel, msg| puts msg end end $redis.publish(‘my_channel.*’, ‘content’)
PRODUCTION Debian / OSX Heroku Easy (foreman)
@ damln www.dln.name