SlideShare a Scribd company logo
1 of 38
Redis on Rails
                           Obie Fernandez




Tuesday, May 22, 2012
Salvatore Sanfilippo
                        aka “antirez”


                        Pieter Noordhuis

Tuesday, May 22, 2012
It’s a sidekick to your regular database!




Tuesday, May 22, 2012
Tuesday, May 22, 2012
Tuesday, May 22, 2012
clues that you
    should consider
    using Redis
   •SQL database seems overkill
   •update-only data (only inserted)
   •non-transactional needs
   •no relations with other tables
Tuesday, May 22, 2012
Why Redis
                and not something
                      else?

Tuesday, May 22, 2012
Redis
                           is
                        blazing
                         fast!
Tuesday, May 22, 2012
Source: http://antirez.com/post/redis-memcached-benchmark.html
Tuesday, May 22, 2012
Redis
                        Durability
Tuesday, May 22, 2012
:REDIS0001<FE>^@^C^RAttendee:27:events^B<C1><A8>^@
                        1335369284<C1><A6>^@
                        1335369244^C^TAttendee:1:events:11^A<C0>J
                        1335364980^@^PAttendee:10:name^SJorge H. Cuadrado
                        C^@ESCConference:8:breakevenpoint<C1><A0>^O^C^TAttendee:1:events:
                        13^B<C0>a
                        1335365085<C0>g
                        1335365112^@^PAttendee:22:name
                        Mark Bates^D^RConference:1:notes^A<C0>^A<C3>=@C^Xthese are my
                        notes, lala ^C@^A^E

                        mo ^^<A0>ESC^LI'll addd som 4^Bore^C^QAttendee:4:events^F<C0>^]
                        1335314963<C0>^_
                        1335314968<C0>D
                        1335335712<C0>E



             RDB
                        1335335715<C0>^S
                        1335314271<C0>^T
                        1335314300^C^RAttendee:16:events^C<C0>k
                        1335365137<C0>^
                        1335365082<C0>V



             files
                        1335365068^B^UAttendee:
                        11:followers^B<C0>^A<C0>^O^D^ZAttendeeRegisteredEvent:
                        65^B^Kattendee_id^A1^Mconference_id^A8^D^
                        AttendeeUnregisteredEvent:64^B^Kattendee_id^A1
                        ^Mconference_id^A8^C^TAttendee:13:events:1^A<C0>a
                        1335365085^D^AttendeeUnregisteredEvent:
                        66^B^Kattendee_id^A1^Mconference_id^A8^D^]
                        AttendeeUnregisteredEvent:
                        170^B^Kattendee_id^B25^Mconference_id^A8^C^UAttendee:21:events:
                        21^M<C1><97>^@
                        1335365767<C1><8F>^@
                        1335365733<C1><92>^@
                        1335365741<C1><9B>^@
                        1335365879<C1><93>^@
                        1335365742<C1><94>^@
                        1335365743<C1><95>^@
                        1335365744<C1><96>^@
                        1335365746<C1><98>^@
                        1335365783<C1><99>^@

Tuesday, May 22, 2012
################################ SNAPSHOTTING
       #################################
       #
       # Save the DB on disk:
       #
       #   save <seconds> <changes>
       #
       #   Will save the DB if both the given number of seconds and
       #   the given number of write operations against the DB occurred.
       #
       #   In the example below the behaviour will be to save:
       #   after 900 sec (15 min) if at least 1 key changed
       #   after 300 sec (5 min) if at least 10 keys changed
       #   after 60 sec if at least 10000 keys changed
       #
       #   Note: you can disable saving at all commenting all the
       #   "save" lines.

       save 900 1
       save 300 10
       save 60 10000




Tuesday, May 22, 2012
Redis AOF
                        (Append Only File)




Tuesday, May 22, 2012
AOF options




Tuesday, May 22, 2012
Redis
                        has lots
                           of
                        features
Tuesday, May 22, 2012
Tuesday, May 22, 2012
Photo Credit: http://www.flickr.com/photos/blingrocks
Tuesday, May 22, 2012
Nest
                Object-oriented Keys for Redis
                github.com/soveran/nest



                    • Creates a Redis connection by default
                    • Calls to_s for key representation
                    • Really simple code / hack it for your needs

Tuesday, May 22, 2012
Tuesday, May 22, 2012
Tuesday, May 22, 2012
Example App
    http://github.com/obie/redis_on_rails




Tuesday, May 22, 2012
Tuesday, May 22, 2012
Adding properties
                         to ActiveRecord
                             Example


Tuesday, May 22, 2012
RedisProps
                Easy annotation of ActiveRecord objects
                http://github.com/obie/redis_props




                           example: facebook_authentication.rb



Tuesday, May 22, 2012
...Redis hash
                           Example


Tuesday, May 22, 2012
Basic Twitter
                        functionality in about
                          60 lines of Ruby


Tuesday, May 22, 2012
Examples
                of intersections
                and unions

Tuesday, May 22, 2012
Tuesday, May 22, 2012
Events - Sorted sets
                             Example


Tuesday, May 22, 2012
SortedSet
                        zunionstore and
                          zinterstore
                           Examples

Tuesday, May 22, 2012
RedisObjects
                Map Redis types directly to Ruby objects
                github.com/nateware/redis-objects
Tuesday, May 22, 2012
RedisObjects
                    •Values
                    •Lists
                    •Sets
                    •SortedSets
                    •Atomic Counters and Locks

Tuesday, May 22, 2012
Atomic Counter
                           Example


Tuesday, May 22, 2012
Testing Tips

                    •Don’t bother mocking out Redis
                    •Select a different database number
                        so you don’t clobber anything

                    •Redis.current.flushdb          is your
                        friend


Tuesday, May 22, 2012
Tuesday, May 22, 2012
Rails
                        Console
                          ♥s
                         Redis
Tuesday, May 22, 2012
Redis
                          makes
                        you more
                         creative
Tuesday, May 22, 2012
Obie Fernandez
     Thanks...                               obiefernandez@gmail.com
                                                 @obie on twitter
     Example Code
     http://github.com/obie/redis_on_rails

     Slides available at my blog
     http://blog.obiefernandez.com

     Redis
     http://redis.io



     Check out DueProps
     http://dueprops.com


Tuesday, May 22, 2012

More Related Content

Viewers also liked

Viewers also liked (13)

Benzene Market Price Report Weekly_Nov 06_2015
Benzene Market Price Report Weekly_Nov 06_2015Benzene Market Price Report Weekly_Nov 06_2015
Benzene Market Price Report Weekly_Nov 06_2015
 
SD WiFi v3基板の説明
SD WiFi v3基板の説明SD WiFi v3基板の説明
SD WiFi v3基板の説明
 
Good morning wishes wallpaper, images, quotes
Good morning wishes wallpaper, images, quotesGood morning wishes wallpaper, images, quotes
Good morning wishes wallpaper, images, quotes
 
Unternehmen 4.0: Warum Digitalisierung?
Unternehmen 4.0: Warum Digitalisierung?Unternehmen 4.0: Warum Digitalisierung?
Unternehmen 4.0: Warum Digitalisierung?
 
Ego
EgoEgo
Ego
 
Fear and hope in the internet of things
Fear and hope in the internet of thingsFear and hope in the internet of things
Fear and hope in the internet of things
 
Expresion corporal para adultos mayores
Expresion corporal para adultos mayoresExpresion corporal para adultos mayores
Expresion corporal para adultos mayores
 
Конкурс «Контент – марафон»
Конкурс «Контент – марафон»Конкурс «Контент – марафон»
Конкурс «Контент – марафон»
 
Signals Plug-In - Digital Technology in the School Curriculum
Signals Plug-In - Digital Technology in the School CurriculumSignals Plug-In - Digital Technology in the School Curriculum
Signals Plug-In - Digital Technology in the School Curriculum
 
Trigonometry
TrigonometryTrigonometry
Trigonometry
 
Ramcharitra manas
Ramcharitra manasRamcharitra manas
Ramcharitra manas
 
Scrum
ScrumScrum
Scrum
 
Digitalisierung im Customer Care Management: Konsequenzen für den Kundenserv...
Digitalisierung im Customer Care Management: Konsequenzen für den Kundenserv...Digitalisierung im Customer Care Management: Konsequenzen für den Kundenserv...
Digitalisierung im Customer Care Management: Konsequenzen für den Kundenserv...
 

Similar to Redis on Rails (RedDotRubyConf 2012)

Node Access in Drupal 7 (and Drupal 8)
Node Access in Drupal 7 (and Drupal 8)Node Access in Drupal 7 (and Drupal 8)
Node Access in Drupal 7 (and Drupal 8)nyccamp
 
Symfony2 and MongoDB
Symfony2 and MongoDBSymfony2 and MongoDB
Symfony2 and MongoDBPablo Godel
 
Mansoura University CSED & Nozom web development sprint
Mansoura University CSED & Nozom web development sprintMansoura University CSED & Nozom web development sprint
Mansoura University CSED & Nozom web development sprintAl Sayed Gamal
 
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)Adam Charnock
 
THE STATE OF GLOBAL INFRASTRUCTURE PERFORMANCE from Structure 2012
THE STATE OF GLOBAL INFRASTRUCTURE PERFORMANCE from Structure 2012THE STATE OF GLOBAL INFRASTRUCTURE PERFORMANCE from Structure 2012
THE STATE OF GLOBAL INFRASTRUCTURE PERFORMANCE from Structure 2012Gigaom
 
Architecting large Node.js applications
Architecting large Node.js applicationsArchitecting large Node.js applications
Architecting large Node.js applicationsSergi Mansilla
 
Day 27 order of operations day 3
Day 27 order of operations day 3Day 27 order of operations day 3
Day 27 order of operations day 3Erik Tjersland
 
Weotta Presentation at SF Bay Area MongoDB User Group Feb 21 2012
Weotta Presentation at SF Bay Area MongoDB User Group Feb 21 2012Weotta Presentation at SF Bay Area MongoDB User Group Feb 21 2012
Weotta Presentation at SF Bay Area MongoDB User Group Feb 21 2012MongoDB
 
Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Max Klymyshyn
 
Como escalar aplicações PHP
Como escalar aplicações PHPComo escalar aplicações PHP
Como escalar aplicações PHPAugusto Pascutti
 
Cypher Query Language
Cypher Query Language Cypher Query Language
Cypher Query Language graphdevroom
 
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012Phil Harvey
 
CLOUD LOCK-IN AND THE MYTH OF OPEN APIS at Structure 2012
CLOUD LOCK-IN AND THE MYTH OF OPEN APIS at Structure 2012CLOUD LOCK-IN AND THE MYTH OF OPEN APIS at Structure 2012
CLOUD LOCK-IN AND THE MYTH OF OPEN APIS at Structure 2012Gigaom
 
Speed is Essential for a Great Web Experience (Digicure - Copenhagen)
Speed is Essential for a Great Web Experience (Digicure - Copenhagen)Speed is Essential for a Great Web Experience (Digicure - Copenhagen)
Speed is Essential for a Great Web Experience (Digicure - Copenhagen)Andy Davies
 

Similar to Redis on Rails (RedDotRubyConf 2012) (19)

Node Access in Drupal 7 (and Drupal 8)
Node Access in Drupal 7 (and Drupal 8)Node Access in Drupal 7 (and Drupal 8)
Node Access in Drupal 7 (and Drupal 8)
 
Symfony2 and MongoDB
Symfony2 and MongoDBSymfony2 and MongoDB
Symfony2 and MongoDB
 
QCON SP 2012
QCON SP 2012QCON SP 2012
QCON SP 2012
 
Mansoura University CSED & Nozom web development sprint
Mansoura University CSED & Nozom web development sprintMansoura University CSED & Nozom web development sprint
Mansoura University CSED & Nozom web development sprint
 
Aegir
AegirAegir
Aegir
 
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)
PlayNice.ly: Using Redis to store all our data, hahaha (Redis London Meetup)
 
THE STATE OF GLOBAL INFRASTRUCTURE PERFORMANCE from Structure 2012
THE STATE OF GLOBAL INFRASTRUCTURE PERFORMANCE from Structure 2012THE STATE OF GLOBAL INFRASTRUCTURE PERFORMANCE from Structure 2012
THE STATE OF GLOBAL INFRASTRUCTURE PERFORMANCE from Structure 2012
 
Architecting large Node.js applications
Architecting large Node.js applicationsArchitecting large Node.js applications
Architecting large Node.js applications
 
Day 27 order of operations day 3
Day 27 order of operations day 3Day 27 order of operations day 3
Day 27 order of operations day 3
 
RDBMS vs NoSQL
RDBMS vs NoSQLRDBMS vs NoSQL
RDBMS vs NoSQL
 
Weotta Presentation at SF Bay Area MongoDB User Group Feb 21 2012
Weotta Presentation at SF Bay Area MongoDB User Group Feb 21 2012Weotta Presentation at SF Bay Area MongoDB User Group Feb 21 2012
Weotta Presentation at SF Bay Area MongoDB User Group Feb 21 2012
 
Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013Angular.js - JS Camp UKraine 2013
Angular.js - JS Camp UKraine 2013
 
Como escalar aplicações PHP
Como escalar aplicações PHPComo escalar aplicações PHP
Como escalar aplicações PHP
 
Cypher Query Language
Cypher Query Language Cypher Query Language
Cypher Query Language
 
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
REST & Hypermedia: the missing links and why you need them - Ruby Hoedown 2012
 
CLOUD LOCK-IN AND THE MYTH OF OPEN APIS at Structure 2012
CLOUD LOCK-IN AND THE MYTH OF OPEN APIS at Structure 2012CLOUD LOCK-IN AND THE MYTH OF OPEN APIS at Structure 2012
CLOUD LOCK-IN AND THE MYTH OF OPEN APIS at Structure 2012
 
Speed is Essential for a Great Web Experience (Digicure - Copenhagen)
Speed is Essential for a Great Web Experience (Digicure - Copenhagen)Speed is Essential for a Great Web Experience (Digicure - Copenhagen)
Speed is Essential for a Great Web Experience (Digicure - Copenhagen)
 
lecture_32.pptx
lecture_32.pptxlecture_32.pptx
lecture_32.pptx
 
Lecture 32
Lecture 32Lecture 32
Lecture 32
 

Recently uploaded

Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...DianaGray10
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 

Recently uploaded (20)

Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
Connector Corner: Extending LLM automation use cases with UiPath GenAI connec...
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 

Redis on Rails (RedDotRubyConf 2012)

  • 1. Redis on Rails Obie Fernandez Tuesday, May 22, 2012
  • 2. Salvatore Sanfilippo aka “antirez” Pieter Noordhuis Tuesday, May 22, 2012
  • 3. It’s a sidekick to your regular database! Tuesday, May 22, 2012
  • 6. clues that you should consider using Redis •SQL database seems overkill •update-only data (only inserted) •non-transactional needs •no relations with other tables Tuesday, May 22, 2012
  • 7. Why Redis and not something else? Tuesday, May 22, 2012
  • 8. Redis is blazing fast! Tuesday, May 22, 2012
  • 10. Redis Durability Tuesday, May 22, 2012
  • 11. :REDIS0001<FE>^@^C^RAttendee:27:events^B<C1><A8>^@ 1335369284<C1><A6>^@ 1335369244^C^TAttendee:1:events:11^A<C0>J 1335364980^@^PAttendee:10:name^SJorge H. Cuadrado C^@ESCConference:8:breakevenpoint<C1><A0>^O^C^TAttendee:1:events: 13^B<C0>a 1335365085<C0>g 1335365112^@^PAttendee:22:name Mark Bates^D^RConference:1:notes^A<C0>^A<C3>=@C^Xthese are my notes, lala ^C@^A^E mo ^^<A0>ESC^LI'll addd som 4^Bore^C^QAttendee:4:events^F<C0>^] 1335314963<C0>^_ 1335314968<C0>D 1335335712<C0>E RDB 1335335715<C0>^S 1335314271<C0>^T 1335314300^C^RAttendee:16:events^C<C0>k 1335365137<C0>^ 1335365082<C0>V files 1335365068^B^UAttendee: 11:followers^B<C0>^A<C0>^O^D^ZAttendeeRegisteredEvent: 65^B^Kattendee_id^A1^Mconference_id^A8^D^ AttendeeUnregisteredEvent:64^B^Kattendee_id^A1 ^Mconference_id^A8^C^TAttendee:13:events:1^A<C0>a 1335365085^D^AttendeeUnregisteredEvent: 66^B^Kattendee_id^A1^Mconference_id^A8^D^] AttendeeUnregisteredEvent: 170^B^Kattendee_id^B25^Mconference_id^A8^C^UAttendee:21:events: 21^M<C1><97>^@ 1335365767<C1><8F>^@ 1335365733<C1><92>^@ 1335365741<C1><9B>^@ 1335365879<C1><93>^@ 1335365742<C1><94>^@ 1335365743<C1><95>^@ 1335365744<C1><96>^@ 1335365746<C1><98>^@ 1335365783<C1><99>^@ Tuesday, May 22, 2012
  • 12. ################################ SNAPSHOTTING ################################# # # Save the DB on disk: # # save <seconds> <changes> # # Will save the DB if both the given number of seconds and # the given number of write operations against the DB occurred. # # In the example below the behaviour will be to save: # after 900 sec (15 min) if at least 1 key changed # after 300 sec (5 min) if at least 10 keys changed # after 60 sec if at least 10000 keys changed # # Note: you can disable saving at all commenting all the # "save" lines. save 900 1 save 300 10 save 60 10000 Tuesday, May 22, 2012
  • 13. Redis AOF (Append Only File) Tuesday, May 22, 2012
  • 15. Redis has lots of features Tuesday, May 22, 2012
  • 18. Nest Object-oriented Keys for Redis github.com/soveran/nest • Creates a Redis connection by default • Calls to_s for key representation • Really simple code / hack it for your needs Tuesday, May 22, 2012
  • 21. Example App http://github.com/obie/redis_on_rails Tuesday, May 22, 2012
  • 23. Adding properties to ActiveRecord Example Tuesday, May 22, 2012
  • 24. RedisProps Easy annotation of ActiveRecord objects http://github.com/obie/redis_props example: facebook_authentication.rb Tuesday, May 22, 2012
  • 25. ...Redis hash Example Tuesday, May 22, 2012
  • 26. Basic Twitter functionality in about 60 lines of Ruby Tuesday, May 22, 2012
  • 27. Examples of intersections and unions Tuesday, May 22, 2012
  • 29. Events - Sorted sets Example Tuesday, May 22, 2012
  • 30. SortedSet zunionstore and zinterstore Examples Tuesday, May 22, 2012
  • 31. RedisObjects Map Redis types directly to Ruby objects github.com/nateware/redis-objects Tuesday, May 22, 2012
  • 32. RedisObjects •Values •Lists •Sets •SortedSets •Atomic Counters and Locks Tuesday, May 22, 2012
  • 33. Atomic Counter Example Tuesday, May 22, 2012
  • 34. Testing Tips •Don’t bother mocking out Redis •Select a different database number so you don’t clobber anything •Redis.current.flushdb is your friend Tuesday, May 22, 2012
  • 36. Rails Console ♥s Redis Tuesday, May 22, 2012
  • 37. Redis makes you more creative Tuesday, May 22, 2012
  • 38. Obie Fernandez Thanks... obiefernandez@gmail.com @obie on twitter Example Code http://github.com/obie/redis_on_rails Slides available at my blog http://blog.obiefernandez.com Redis http://redis.io Check out DueProps http://dueprops.com Tuesday, May 22, 2012