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
170
Optimize or Die Tryin'
damln
1
230
Rails YAML vuln.
damln
1
230
Rails et Heroku
damln
3
350
Capucine
damln
1
150
Other Decks in Programming
See All in Programming
AI Agent と正しく分析するための環境作り
yoshyum
2
460
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
1.1k
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
3
810
PHPer、Cloudflare に引っ越す
suguruooki
2
190
Firefoxにコントリビューションして得られた学び
ken7253
2
160
PHPでローカル環境用のSSL/TLS証明書を発行することはできるのか? #phpconkagawa
akase244
0
360
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
3.1k
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
3
870
「なんか〇〇ライブラリで脆弱性あるみたいなんだけど。。。」から始める脆弱性対応 / First Steps in Vulnerability Response
mackey0225
2
120
Terraform言語の静的解析 / static analysis of Terraform language
wata727
1
140
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
110
GitHubCopilotCLIをはじめよう.pdf
htkym
0
330
Featured
See All Featured
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
690
Designing for humans not robots
tammielis
254
26k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
460
Joys of Absence: A Defence of Solitary Play
codingconduct
1
360
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
790
The Cult of Friendly URLs
andyhume
79
6.9k
The SEO Collaboration Effect
kristinabergwall1
1
450
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
280
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
250
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
My Coaching Mixtape
mlcsv
0
130
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
350
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