SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler offline
A Brief Introduction to
Redis
Charles Anderson	

!

Salem Dynamic Languages User Group	

January 2014
Overview
• Redis is a networked “data structure
server”	


• Fast, powerful, simple
Abstract Data Types
• In the Before Time, we didn’t have classes
and objects - we had abstract data types	


•

and, we liked it!	


• Procedural interface	

• First (or last) parameter is the ADT
Example: Stack
• push(stack, item)	

• pop(stack): item	

• size(stack): int	

• etc.
Stack ADT
• We had a single, global name space. So:	

• stack_push(stack, item)	

• stack_pop(stack)	

• stack_size(stack)	

• This is what the Redis API looks like
Redis Types
• String - scalar value	

• List	

• Set	

• Sorted Set	

• Hash
Redis List
• A small subset of the operations:	

• LPUSH key value	

• LPOP key	

• LLEN key	

• LRANGE key start stop
Redis API
• Every object has a name/key	

• First parameter to each call	

• Every object has a type	

• Operation must match the type of object
Using API via CLI
$ redis-cli	
redis 127.0.0.1:6379> lpush mylist 1	
(integer) 1	
redis 127.0.0.1:6379> lpush mylist cat	
(integer) 2	
redis 127.0.0.1:6379> lpush mylist 3.14	
(integer) 3	
redis 127.0.0.1:6379> llen mylist	
(integer) 3	
redis 127.0.0.1:6379> lrange mylist 0 1	
1) "3.14"	
2) "cat"	
redis 127.0.0.1:6379> lrange mylist 0 -1	
1) "3.14"	
2) "cat"	
3) "1"
Redis Clients
• The wire protocol for Redis is dead-simple	

• Therefore, lots of clients for lots of
languages
Ruby Client Demo
irb(main):015:0> r.lpush('mylist', 1)	
=> 1	
irb(main):016:0> r.lpush('mylist', 'cat')	
=> 2	
irb(main):017:0> r.lpush('mylist', 3.14)	
=> 3	
irb(main):019:0> r.lrange('mylist', 0, -1)	
=> ["3.14", "cat", "1"]
Complete Redis API
• http://redis.io/commands	

• Each command includes the time

complexity of the operation - unique
Set
• SADD key member, SREM key member	

• SCARD key	

• SISMEMEBER key member	

• SINTER, SUNION
Sorted Set
• ZADD key score member	

• ZSCORE key member	

• ZRANK key member	

• ZRANGE key start stop	

• Use case: leader board
Hash
• HSET key field value	

• HGET key field	

• HEXISTS key field, HKEYS, HLEN	

• Use case: a structured record like User
Other Stuff
• Key Expiration	

• Transactions/batches	

• Publish-Subscribe	

• Server-side scripting via Lua	

• Replication	

• Clustering
Implementation Details
• Everything is stored in memory	

•
•

Hella fast	

Not memcache - expiration is not LRU	


• Persistent - tunable disk storage	

• Single-threaded - simple, fast, single CPU	

• Support (@antirez) is awesome
But, is it Web
Scale?
• NoSQL key/value store	

• Kickass benchmarks	

• Simpler (smaller scope) than HBase or
Cassandra	


• Sharding done by clients	

• Not usually a system of record	

• I already work on a farm
More Information
• http://redis.io	

• “The Little Redis Book” Seguin	

• “Redis in Action” Carlson	

• “Redis Cookbook” Macedo and Oliveira
Questions

•?

Mais conteúdo relacionado

Mais procurados

Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redisTanu Siwag
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2Dvir Volk
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis IntroductionAlex Su
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101Dvir Volk
 
Redis 101 Data Structure
Redis 101 Data StructureRedis 101 Data Structure
Redis 101 Data StructureIsmaeel Enjreny
 
Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Itamar Haber
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisArnab Mitra
 
This is redis - feature and usecase
This is redis - feature and usecaseThis is redis - feature and usecase
This is redis - feature and usecaseKris Jeong
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkDvir Volk
 
Real time fulltext search with sphinx
Real time fulltext search with sphinxReal time fulltext search with sphinx
Real time fulltext search with sphinxAdrian Nuta
 
Redis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPRedis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPChen Huang
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisKnoldus Inc.
 
Sharding
ShardingSharding
ShardingMongoDB
 

Mais procurados (20)

Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2
 
Redis 101
Redis 101Redis 101
Redis 101
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis 101 Data Structure
Redis 101 Data StructureRedis 101 Data Structure
Redis 101 Data Structure
 
Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis basics
Redis basicsRedis basics
Redis basics
 
This is redis - feature and usecase
This is redis - feature and usecaseThis is redis - feature and usecase
This is redis - feature and usecase
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and Spark
 
Redis database
Redis databaseRedis database
Redis database
 
Real time fulltext search with sphinx
Real time fulltext search with sphinxReal time fulltext search with sphinx
Real time fulltext search with sphinx
 
Redis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHPRedis in Practice: Scenarios, Performance and Practice with PHP
Redis in Practice: Scenarios, Performance and Practice with PHP
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
redis basics
redis basicsredis basics
redis basics
 
Sharding
ShardingSharding
Sharding
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 

Destaque

工程实战
工程实战工程实战
工程实战20004
 
How to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceHow to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceCharles Anderson
 
November 18 General Meeting
November 18 General MeetingNovember 18 General Meeting
November 18 General MeetingMSU PRSSA
 
New era of stakeholder engagement
New era of stakeholder engagementNew era of stakeholder engagement
New era of stakeholder engagementBen Lowndes
 
How To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineHow To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineCharles Anderson
 
A Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMA Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMCharles Anderson
 
September 2 General Meeting
September 2 General MeetingSeptember 2 General Meeting
September 2 General MeetingMSU PRSSA
 
20040430162931
2004043016293120040430162931
2004043016293120004
 
积极的心态
积极的心态积极的心态
积极的心态20004
 
8020法则.
8020法则.8020法则.
8020法则.20004
 
West of England Joint Spatial Plan - what the media is saying
West of England Joint Spatial Plan - what the media is sayingWest of England Joint Spatial Plan - what the media is saying
West of England Joint Spatial Plan - what the media is sayingBen Lowndes
 
员工日常行为扣分条例
员工日常行为扣分条例员工日常行为扣分条例
员工日常行为扣分条例20004
 
高级销售技巧
高级销售技巧高级销售技巧
高级销售技巧20004
 
Above quiz prelims with answers nov 2010
Above quiz prelims with answers nov 2010Above quiz prelims with answers nov 2010
Above quiz prelims with answers nov 2010Venkatesh Srinivasan
 
卓越销售
卓越销售卓越销售
卓越销售20004
 
2009 年的祝福1
2009 年的祝福12009 年的祝福1
2009 年的祝福1jimmy wei
 
September 16 General Meeting
September 16 General MeetingSeptember 16 General Meeting
September 16 General MeetingMSU PRSSA
 

Destaque (20)

工程实战
工程实战工程实战
工程实战
 
How to get a Software Job w/o Experience
How to get a Software Job w/o ExperienceHow to get a Software Job w/o Experience
How to get a Software Job w/o Experience
 
November 18 General Meeting
November 18 General MeetingNovember 18 General Meeting
November 18 General Meeting
 
New era of stakeholder engagement
New era of stakeholder engagementNew era of stakeholder engagement
New era of stakeholder engagement
 
How To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer OnlineHow To Protect Yourself and Your Computer Online
How To Protect Yourself and Your Computer Online
 
A Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVMA Shallow Survey of Alternative Languages on the JVM
A Shallow Survey of Alternative Languages on the JVM
 
September 2 General Meeting
September 2 General MeetingSeptember 2 General Meeting
September 2 General Meeting
 
7
77
7
 
20040430162931
2004043016293120040430162931
20040430162931
 
积极的心态
积极的心态积极的心态
积极的心态
 
8020法则.
8020法则.8020法则.
8020法则.
 
West of England Joint Spatial Plan - what the media is saying
West of England Joint Spatial Plan - what the media is sayingWest of England Joint Spatial Plan - what the media is saying
West of England Joint Spatial Plan - what the media is saying
 
Psychotactics Uniqueness
Psychotactics UniquenessPsychotactics Uniqueness
Psychotactics Uniqueness
 
员工日常行为扣分条例
员工日常行为扣分条例员工日常行为扣分条例
员工日常行为扣分条例
 
1
11
1
 
高级销售技巧
高级销售技巧高级销售技巧
高级销售技巧
 
Above quiz prelims with answers nov 2010
Above quiz prelims with answers nov 2010Above quiz prelims with answers nov 2010
Above quiz prelims with answers nov 2010
 
卓越销售
卓越销售卓越销售
卓越销售
 
2009 年的祝福1
2009 年的祝福12009 年的祝福1
2009 年的祝福1
 
September 16 General Meeting
September 16 General MeetingSeptember 16 General Meeting
September 16 General Meeting
 

Semelhante a A Brief Introduction to Redis

Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Itamar Haber
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisItamar Haber
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redisErhwen Kuo
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRicard Clau
 
Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2John Ashmead
 
Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!François Boucher
 
Redis: REmote DIctionary Server
Redis: REmote DIctionary ServerRedis: REmote DIctionary Server
Redis: REmote DIctionary ServerEzra Zygmuntowicz
 
Spark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsModern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsMike North
 
Hadoop M/R Pig Hive
Hadoop M/R Pig HiveHadoop M/R Pig Hive
Hadoop M/R Pig Hivezahid-mian
 
An introduction to Rails 3
An introduction to Rails 3An introduction to Rails 3
An introduction to Rails 3Blazing Cloud
 
Building Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientBuilding Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientMike Friedman
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017HashedIn Technologies
 

Semelhante a A Brief Introduction to Redis (20)

Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)
 
Python redis talk
Python redis talkPython redis talk
Python redis talk
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
05 integrate redis
05 integrate redis05 integrate redis
05 integrate redis
 
REDIS327
REDIS327REDIS327
REDIS327
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
 
Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2
 
Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!Azure Redis Cache - Cache on Steroids!
Azure Redis Cache - Cache on Steroids!
 
Wider than rails
Wider than railsWider than rails
Wider than rails
 
Redis: REmote DIctionary Server
Redis: REmote DIctionary ServerRedis: REmote DIctionary Server
Redis: REmote DIctionary Server
 
Spark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir Volk
 
Redis Labcamp
Redis LabcampRedis Labcamp
Redis Labcamp
 
Modern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.jsModern, Scalable, Ambitious apps with Ember.js
Modern, Scalable, Ambitious apps with Ember.js
 
Hadoop M/R Pig Hive
Hadoop M/R Pig HiveHadoop M/R Pig Hive
Hadoop M/R Pig Hive
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
 
An introduction to Rails 3
An introduction to Rails 3An introduction to Rails 3
An introduction to Rails 3
 
Building Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::ClientBuilding Scalable, Distributed Job Queues with Redis and Redis::Client
Building Scalable, Distributed Job Queues with Redis and Redis::Client
 
Osd ctw spark
Osd ctw sparkOsd ctw spark
Osd ctw spark
 
Rack
RackRack
Rack
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017
 

Mais de Charles Anderson

Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Charles Anderson
 
How to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceHow to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceCharles Anderson
 
Jython: Integrating Python and Java
Jython: Integrating Python and JavaJython: Integrating Python and Java
Jython: Integrating Python and JavaCharles Anderson
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for JavaCharles Anderson
 

Mais de Charles Anderson (7)

Modern php
Modern phpModern php
Modern php
 
Literate Programming
Literate ProgrammingLiterate Programming
Literate Programming
 
Inrastructure as Code
Inrastructure as CodeInrastructure as Code
Inrastructure as Code
 
Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014Docker - Hack Salem! - November 2014
Docker - Hack Salem! - November 2014
 
How to Get a Software Job w/o Experience
How to Get a Software Job w/o ExperienceHow to Get a Software Job w/o Experience
How to Get a Software Job w/o Experience
 
Jython: Integrating Python and Java
Jython: Integrating Python and JavaJython: Integrating Python and Java
Jython: Integrating Python and Java
 
Groovy a Scripting Language for Java
Groovy a Scripting Language for JavaGroovy a Scripting Language for Java
Groovy a Scripting Language for Java
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

A Brief Introduction to Redis

  • 1. A Brief Introduction to Redis Charles Anderson ! Salem Dynamic Languages User Group January 2014
  • 2. Overview • Redis is a networked “data structure server” • Fast, powerful, simple
  • 3. Abstract Data Types • In the Before Time, we didn’t have classes and objects - we had abstract data types • and, we liked it! • Procedural interface • First (or last) parameter is the ADT
  • 4. Example: Stack • push(stack, item) • pop(stack): item • size(stack): int • etc.
  • 5. Stack ADT • We had a single, global name space. So: • stack_push(stack, item) • stack_pop(stack) • stack_size(stack) • This is what the Redis API looks like
  • 6. Redis Types • String - scalar value • List • Set • Sorted Set • Hash
  • 7. Redis List • A small subset of the operations: • LPUSH key value • LPOP key • LLEN key • LRANGE key start stop
  • 8. Redis API • Every object has a name/key • First parameter to each call • Every object has a type • Operation must match the type of object
  • 9. Using API via CLI $ redis-cli redis 127.0.0.1:6379> lpush mylist 1 (integer) 1 redis 127.0.0.1:6379> lpush mylist cat (integer) 2 redis 127.0.0.1:6379> lpush mylist 3.14 (integer) 3 redis 127.0.0.1:6379> llen mylist (integer) 3 redis 127.0.0.1:6379> lrange mylist 0 1 1) "3.14" 2) "cat" redis 127.0.0.1:6379> lrange mylist 0 -1 1) "3.14" 2) "cat" 3) "1"
  • 10. Redis Clients • The wire protocol for Redis is dead-simple • Therefore, lots of clients for lots of languages
  • 11. Ruby Client Demo irb(main):015:0> r.lpush('mylist', 1) => 1 irb(main):016:0> r.lpush('mylist', 'cat') => 2 irb(main):017:0> r.lpush('mylist', 3.14) => 3 irb(main):019:0> r.lrange('mylist', 0, -1) => ["3.14", "cat", "1"]
  • 12. Complete Redis API • http://redis.io/commands • Each command includes the time complexity of the operation - unique
  • 13. Set • SADD key member, SREM key member • SCARD key • SISMEMEBER key member • SINTER, SUNION
  • 14. Sorted Set • ZADD key score member • ZSCORE key member • ZRANK key member • ZRANGE key start stop • Use case: leader board
  • 15. Hash • HSET key field value • HGET key field • HEXISTS key field, HKEYS, HLEN • Use case: a structured record like User
  • 16. Other Stuff • Key Expiration • Transactions/batches • Publish-Subscribe • Server-side scripting via Lua • Replication • Clustering
  • 17. Implementation Details • Everything is stored in memory • • Hella fast Not memcache - expiration is not LRU • Persistent - tunable disk storage • Single-threaded - simple, fast, single CPU • Support (@antirez) is awesome
  • 18. But, is it Web Scale? • NoSQL key/value store • Kickass benchmarks • Simpler (smaller scope) than HBase or Cassandra • Sharding done by clients • Not usually a system of record • I already work on a farm
  • 19. More Information • http://redis.io • “The Little Redis Book” Seguin • “Redis in Action” Carlson • “Redis Cookbook” Macedo and Oliveira