Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
250
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
140
Optimize or Die Tryin'
damln
1
210
Rails YAML vuln.
damln
1
220
Controllers suck.
damln
1
190
Rails et Heroku
damln
3
330
Capucine
damln
1
130
Other Decks in Programming
See All in Programming
テストやOSS開発に役立つSetup PHP Action
matsuo_atsushi
0
110
イベントストーミングのはじめかた / Getting Started with Event Storming
nrslib
1
770
アーキテクチャと考える迷子にならない開発者テスト
irof
9
3.4k
複数人でのCLI/Infrastructure as Codeの暮らしを良くする
shmokmt
5
1.8k
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
210
GeistFabrik and AI-augmented software development
adewale
PRO
0
220
レイトレZ世代に捧ぐ、今からレイトレを始めるための小径
ichi_raven
0
480
dotfiles 式年遷宮 令和最新版
masawada
1
230
JEP 496 と JEP 497 から学ぶ耐量子計算機暗号入門 / Learning Post-Quantum Crypto Basics from JEP 496 & 497
mackey0225
2
510
All(?) About Point Sets
hole
0
230
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
260
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
8
2.9k
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Automating Front-end Workflow
addyosmani
1371
200k
Designing Experiences People Love
moore
142
24k
Faster Mobile Websites
deanohume
310
31k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
A Tale of Four Properties
chriscoyier
162
23k
How GitHub (no longer) Works
holman
316
140k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
What's in a price? How to price your products and services
michaelherold
246
12k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
690
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
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