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
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
240
Rails et Heroku
damln
3
350
Capucine
damln
1
150
Other Decks in Programming
See All in Programming
Hatena Engineer Seminar #37「言語モデルの活用に関する研究」
slashnephy
0
550
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
230
アルゴリズムは何を圧縮しているのか ─ Haskell から育った「圧縮代数」というメンタルモデル
naoya
16
3.6k
作るコストが小さくなった時代 幸せに働くために改めて考えたいこと 〜エンジニアとして価値を出し続けるために注視している二分野〜
yuppeeng
0
120
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
360
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
860
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
400
What's New in Android 2026
veronikapj
0
200
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
180
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
220
JAWS-UG横浜 #102 AWSサ終供養LT会 成仏できない AWS サービスたち 〜本日、三体供養します〜
maroon1st
0
240
PHPだって関数型したい 〜できること、できないこと〜 / fp-in-php
jsoizo
1
250
Featured
See All Featured
Are puppies a ranking factor?
jonoalderson
1
3.7k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
460
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.3k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
280
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.6k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
270
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.1k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.5k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
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