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
260
4
Share
Redis with Ruby
Damian Le Nouaille
April 04, 2012
More Decks by Damian Le Nouaille
See All by Damian Le Nouaille
Re-Think your workflow with a piano
damln
0
160
Optimize or Die Tryin'
damln
1
220
Rails YAML vuln.
damln
1
220
Rails et Heroku
damln
3
340
Capucine
damln
1
150
Other Decks in Programming
See All in Programming
実践CRDT
tamadeveloper
0
390
AIエージェントで業務改善してみた
taku271
0
500
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
340
PHPで TLSのプロトコルを実装してみる
higaki_program
0
740
おれのAgentic Coding 2026/03
tsukasagr
1
140
Nuxt Server Components
wattanx
0
260
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
980
How Swift's Type System Guides AI Agents
koher
0
190
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
340
事業会社でのセキュリティ長期インターンについて
masachikaura
0
230
飯MCP
yusukebe
0
490
CDK Deployのための ”反響定位”
watany
1
510
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
Between Models and Reality
mayunak
3
260
The Curse of the Amulet
leimatthew05
1
11k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
27
3.4k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
710
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
680
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Building an army of robots
kneath
306
46k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
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