SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Getting
Started
with Redis
Sam Davarnia
@samdvr
What is Redis?
¡  Key/Value Store
¡  Not just strings
¡  Persistence
¡  FAST
¡  Scalable
Redis is fast
5 Data Types
¡  Strings
¡  Hashes
¡  Lists
¡  Sets
¡  Sorted Sets
Strings
¡  The most simple data type
¡  Common Commands
¡  SET/GET (MSET/MGET)
¡  INCR/DECR
¡  INCRBY /INCRBYFLOAT
¡  DECRBY / DECRBYFLOAT
¡  STRLEN
Use Cases
¡  Simple caching with expiration
¡  Counts & Sums using INCRBY/DECRBY
SET	
  	
  	
  	
  blog_count	
  	
  10	
  	
  
INCR	
  blog_count	
  
GET	
  	
  	
  blog_count	
  
	
  	
  	
  	
  “11”	
  
	
  
Hashes
¡  Similar to Ruby & Python hashes
they are maps with keys & values
¡  Common Commands
¡  HSET / HGET
¡  HGETALL
¡  HINCRBY / HINCRBYFLOAT
Use Cases
¡  Good for representing objects and storing data types
other than strings and integers
HSET	
  myhash	
  field1	
  "Hello”	
  field2	
  “Everyone”	
  
HGET	
  myhash	
  field1	
  
	
  	
  	
  	
  “HELLO”	
  
	
  
Lists
¡  Basically linked lists from left to right.
¡  You can push and pop elements
Accessing data in the middle
isn’t as fast
¡  Common Commands
¡  LSET/LINDEX
¡  LPUSH/LPOP
¡  RPUSH/RPOP
¡  LINSERT
¡  LRANGE
Use Cases
¡  Great for queues
¡  Activity feeds
Sets
¡  Unordered collections of unique elements
¡  Find differences between two sets, union of two
sets …
¡  Common Commands
¡  SADD/SREM
¡  SMEMBERS
¡  SISMEMBER
¡  SUNION
¡  SPOP
Use Cases
¡  Tagging systems
¡  Tracking unique visitors
¡  Getting random elements from a collection
Sorted Sets
¡  Similar to Sets but each key should have a score to get
sorted
¡  Common Commands
¡  ZADD/ZREM
¡  ZCOUNT
¡  ZINCRBY
¡  ZRANK
¡  ZRANGE
¡  ZSCORE
Use cases
¡  Leaderboards
¡  Notification systems
¡  Autocomplete searches
¡  Activity feeds based on a score or time and more..
Pub/Sub
¡  Redis supports real time data propagation.
¡  Users can subscribe to a “channel” and any message
sent to the channel will be published to all subscribers
at the same time.
Use Cases
¡  Chat System
¡  Real-time reporting and analytics
Persistence
¡  RDB
¡  Point in time snapshot
¡  Append Only File (AOF)
¡  More durable than RDB but slower
Scaling
¡  Redis has a master/slave replication feature similar to
MySQL
Slave(Read-only)
Slave(Read-only)
Master(Write-only)
Redis as a Service
¡  Managed Redis services
Resources
¡  Redis.io list of all the commands and documentation
¡  Books:
¡  Redis In Action
¡  Redis: The Definitive Guide
Questions/Demo

Contenu connexe

Dernier

tesis maíz univesidad catolica santa maria
tesis maíz univesidad catolica santa mariatesis maíz univesidad catolica santa maria
tesis maíz univesidad catolica santa maria
susafy7
 
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdfLA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
bcondort
 
ANALISIS Y DISEÑO POR VIENTO, DE EDIFICIOS ALTOS, SEGUN ASCE-2016, LAURA RAMIREZ
ANALISIS Y DISEÑO POR VIENTO, DE EDIFICIOS ALTOS, SEGUN ASCE-2016, LAURA RAMIREZANALISIS Y DISEÑO POR VIENTO, DE EDIFICIOS ALTOS, SEGUN ASCE-2016, LAURA RAMIREZ
ANALISIS Y DISEÑO POR VIENTO, DE EDIFICIOS ALTOS, SEGUN ASCE-2016, LAURA RAMIREZ
gustavoiashalom
 

Dernier (20)

Quimica Raymond Chang 12va Edicion___pdf
Quimica Raymond Chang 12va Edicion___pdfQuimica Raymond Chang 12va Edicion___pdf
Quimica Raymond Chang 12va Edicion___pdf
 
Trazos paileros para realizar trazos, cortes y calculos.pptx
Trazos paileros para realizar trazos, cortes y calculos.pptxTrazos paileros para realizar trazos, cortes y calculos.pptx
Trazos paileros para realizar trazos, cortes y calculos.pptx
 
Maquinaria Agricola utilizada en la produccion de Piña.pdf
Maquinaria Agricola utilizada en la produccion de Piña.pdfMaquinaria Agricola utilizada en la produccion de Piña.pdf
Maquinaria Agricola utilizada en la produccion de Piña.pdf
 
ingenieria grafica para la carrera de ingeniera .pptx
ingenieria grafica para la carrera de ingeniera .pptxingenieria grafica para la carrera de ingeniera .pptx
ingenieria grafica para la carrera de ingeniera .pptx
 
Sesion 03 Formas de absorcion de agua.pptx
Sesion 03 Formas de absorcion de agua.pptxSesion 03 Formas de absorcion de agua.pptx
Sesion 03 Formas de absorcion de agua.pptx
 
Aportes a la Arquitectura de Le Corbusier y Mies Van der Rohe
Aportes a la Arquitectura de Le Corbusier y Mies Van der RoheAportes a la Arquitectura de Le Corbusier y Mies Van der Rohe
Aportes a la Arquitectura de Le Corbusier y Mies Van der Rohe
 
ATS-FORMATO cara.pdf PARA TRABAJO SEGURO
ATS-FORMATO cara.pdf  PARA TRABAJO SEGUROATS-FORMATO cara.pdf  PARA TRABAJO SEGURO
ATS-FORMATO cara.pdf PARA TRABAJO SEGURO
 
tesis maíz univesidad catolica santa maria
tesis maíz univesidad catolica santa mariatesis maíz univesidad catolica santa maria
tesis maíz univesidad catolica santa maria
 
Sistemas de Ecuaciones no lineales-1.pptx
Sistemas de Ecuaciones no lineales-1.pptxSistemas de Ecuaciones no lineales-1.pptx
Sistemas de Ecuaciones no lineales-1.pptx
 
ESPECIFICACIONES TECNICAS COMPLEJO DEPORTIVO
ESPECIFICACIONES TECNICAS COMPLEJO DEPORTIVOESPECIFICACIONES TECNICAS COMPLEJO DEPORTIVO
ESPECIFICACIONES TECNICAS COMPLEJO DEPORTIVO
 
422382393-Curso-de-Tableros-Electricos.pptx
422382393-Curso-de-Tableros-Electricos.pptx422382393-Curso-de-Tableros-Electricos.pptx
422382393-Curso-de-Tableros-Electricos.pptx
 
Presentacion de la ganaderia en la región
Presentacion de la ganaderia en la regiónPresentacion de la ganaderia en la región
Presentacion de la ganaderia en la región
 
Ficha Tecnica de Ladrillos de Tabique de diferentes modelos
Ficha Tecnica de Ladrillos de Tabique de diferentes modelosFicha Tecnica de Ladrillos de Tabique de diferentes modelos
Ficha Tecnica de Ladrillos de Tabique de diferentes modelos
 
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdfLA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
LA APLICACIÓN DE LAS PROPIEDADES TEXTUALES A LOS TEXTOS.pdf
 
01 MATERIALES AERONAUTICOS VARIOS clase 1.ppt
01 MATERIALES AERONAUTICOS VARIOS clase 1.ppt01 MATERIALES AERONAUTICOS VARIOS clase 1.ppt
01 MATERIALES AERONAUTICOS VARIOS clase 1.ppt
 
27311861-Cuencas-sedimentarias-en-Colombia.ppt
27311861-Cuencas-sedimentarias-en-Colombia.ppt27311861-Cuencas-sedimentarias-en-Colombia.ppt
27311861-Cuencas-sedimentarias-en-Colombia.ppt
 
CONEXIONES SERIE, PERALELO EN MÓDULOS FOTOVOLTAICOS.pdf
CONEXIONES SERIE, PERALELO EN MÓDULOS FOTOVOLTAICOS.pdfCONEXIONES SERIE, PERALELO EN MÓDULOS FOTOVOLTAICOS.pdf
CONEXIONES SERIE, PERALELO EN MÓDULOS FOTOVOLTAICOS.pdf
 
ANALISIS Y DISEÑO POR VIENTO, DE EDIFICIOS ALTOS, SEGUN ASCE-2016, LAURA RAMIREZ
ANALISIS Y DISEÑO POR VIENTO, DE EDIFICIOS ALTOS, SEGUN ASCE-2016, LAURA RAMIREZANALISIS Y DISEÑO POR VIENTO, DE EDIFICIOS ALTOS, SEGUN ASCE-2016, LAURA RAMIREZ
ANALISIS Y DISEÑO POR VIENTO, DE EDIFICIOS ALTOS, SEGUN ASCE-2016, LAURA RAMIREZ
 
Propuesta para la creación de un Centro de Innovación para la Refundación ...
Propuesta para la creación de un Centro de Innovación para la Refundación ...Propuesta para la creación de un Centro de Innovación para la Refundación ...
Propuesta para la creación de un Centro de Innovación para la Refundación ...
 
2. Cristaloquimica. ingenieria geologica
2. Cristaloquimica. ingenieria geologica2. Cristaloquimica. ingenieria geologica
2. Cristaloquimica. ingenieria geologica
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Getting Started with Redis

  • 2. What is Redis? ¡  Key/Value Store ¡  Not just strings ¡  Persistence ¡  FAST ¡  Scalable
  • 4. 5 Data Types ¡  Strings ¡  Hashes ¡  Lists ¡  Sets ¡  Sorted Sets
  • 5. Strings ¡  The most simple data type ¡  Common Commands ¡  SET/GET (MSET/MGET) ¡  INCR/DECR ¡  INCRBY /INCRBYFLOAT ¡  DECRBY / DECRBYFLOAT ¡  STRLEN
  • 6. Use Cases ¡  Simple caching with expiration ¡  Counts & Sums using INCRBY/DECRBY SET        blog_count    10     INCR  blog_count   GET      blog_count          “11”    
  • 7. Hashes ¡  Similar to Ruby & Python hashes they are maps with keys & values ¡  Common Commands ¡  HSET / HGET ¡  HGETALL ¡  HINCRBY / HINCRBYFLOAT
  • 8. Use Cases ¡  Good for representing objects and storing data types other than strings and integers HSET  myhash  field1  "Hello”  field2  “Everyone”   HGET  myhash  field1          “HELLO”    
  • 9. Lists ¡  Basically linked lists from left to right. ¡  You can push and pop elements Accessing data in the middle isn’t as fast ¡  Common Commands ¡  LSET/LINDEX ¡  LPUSH/LPOP ¡  RPUSH/RPOP ¡  LINSERT ¡  LRANGE
  • 10. Use Cases ¡  Great for queues ¡  Activity feeds
  • 11. Sets ¡  Unordered collections of unique elements ¡  Find differences between two sets, union of two sets … ¡  Common Commands ¡  SADD/SREM ¡  SMEMBERS ¡  SISMEMBER ¡  SUNION ¡  SPOP
  • 12. Use Cases ¡  Tagging systems ¡  Tracking unique visitors ¡  Getting random elements from a collection
  • 13. Sorted Sets ¡  Similar to Sets but each key should have a score to get sorted ¡  Common Commands ¡  ZADD/ZREM ¡  ZCOUNT ¡  ZINCRBY ¡  ZRANK ¡  ZRANGE ¡  ZSCORE
  • 14. Use cases ¡  Leaderboards ¡  Notification systems ¡  Autocomplete searches ¡  Activity feeds based on a score or time and more..
  • 15. Pub/Sub ¡  Redis supports real time data propagation. ¡  Users can subscribe to a “channel” and any message sent to the channel will be published to all subscribers at the same time.
  • 16. Use Cases ¡  Chat System ¡  Real-time reporting and analytics
  • 17. Persistence ¡  RDB ¡  Point in time snapshot ¡  Append Only File (AOF) ¡  More durable than RDB but slower
  • 18. Scaling ¡  Redis has a master/slave replication feature similar to MySQL Slave(Read-only) Slave(Read-only) Master(Write-only)
  • 19. Redis as a Service ¡  Managed Redis services
  • 20. Resources ¡  Redis.io list of all the commands and documentation ¡  Books: ¡  Redis In Action ¡  Redis: The Definitive Guide