SlideShare a Scribd company logo
1 of 2
Download to read offline
Redis​ ​Cheat​ ​Sheet 
Objects​ ​in​ ​Redis 
● must​ ​have​ ​a​ ​key 
● keys​ ​are​ ​colon​ ​separated 
● value​ ​can​ ​be​ ​hash,​ ​set,​ ​list,​ ​sortedset,​ ​string 
● can​ ​have​ ​an​ ​expiry 
   
Hashes: 
● Use​ ​to​ ​store​ ​"objects"​ ​from​ ​object​ ​oriented​ ​programming 
"blogs:234":​ ​{
​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​"id":​ ​234,
​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​"title":​ ​"Introduction​ ​to​ ​Redis",
​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​"views":​ ​1024
​ ​​ ​​ ​​ ​​ ​​ ​}
● hmset​ ​blogs:234​ ​id​ ​234​ ​title​ ​"Introduction​ ​to​ ​Redis"​ ​views​ ​1024 
● hgetall​ ​blogs:234 
● hincrby​ ​blogs:234​ ​views​ ​1 
 
Sets: 
● Only​ ​unique​ ​items.​ ​No​ ​duplicates 
● Elements​ ​are​ ​not​ ​ordered 
● Can​ ​check​ ​if​ ​element​ ​exists​ ​very​ ​quickly 
● Use​ ​case:​ ​Count​ ​unique​ ​items 
● Use​ ​case:​ ​Check​ ​if​ ​item​ ​exists 
● Use​ ​case:​ ​Perform​ ​logical​ ​UNION​ ​/​ ​INTERSECTION​ ​operations 
● Two​ ​ways​ ​to​ ​represent​ ​same​ ​information,​ ​choose​ ​based​ ​on​ ​use 
case​ ​set​ ​of​ ​integers​ ​consumes​ ​less​ ​memory,​ ​is​ ​very​ ​efficient 
"blogs:234:tags"​ ​==>​ ​set("aws",​ ​"redis",​ ​"cache")
v/s
"tags:aws:blogs"​ ​==>​ ​set(234,​ ​532,​ ​332)
Lists: 
● Duplicates​ ​allowed.  
● Very​ ​well​ ​defined​ ​order​ ​of​ ​elements 
● Expensive​ ​to​ ​check​ ​if​ ​element​ ​already​ ​exists​ ​in​ ​list 
©​ ​2017​ ​HashedIn​ ​Technologies​ ​Pvt.​ ​Ltd. 
● Operations​ ​near​ ​head​ ​/​ ​tail​ ​very​ ​fast. 
● Operations​ ​near​ ​centre​ ​elements​ ​slower 
● Can​ ​use​ ​as​ ​a​ ​queue​ ​or​ ​a​ ​stack 
● Operations​ ​can​ ​block​ ​if​ ​no​ ​elements​ ​are​ ​available,​ ​useful 
● Easy​ ​to​ ​restrict​ ​length​ ​using​ ​ltrim​ ​command 
● Use​ ​case:​ ​Recent​ ​items,​ ​recent​ ​logs 
● Use​ ​case:​ ​Queue​ ​to​ ​maintain​ ​tasks 
 
Sorted​ ​Sets 
● Like​ ​a​ ​set,​ ​only​ ​allows​ ​unique​ ​items 
● Every​ ​element​ ​can​ ​have​ ​a​ ​numeric​ ​score 
● Score​ ​can​ ​represent​ ​anything​ ​-​ ​sales,​ ​count​ ​of​ ​orders,​ ​points​ ​in 
a​ ​game​ ​etc. 
● Elements​ ​are​ ​always​ ​maintained​ ​in​ ​order​ ​of​ ​score  
● If​ ​score​ ​of​ ​two​ ​elements​ ​are​ ​same,​ ​elements​ ​are​ ​sorted​ ​in 
lexicographical​ ​order​ ​-​ ​the​ ​way​ ​you​ ​see​ ​in​ ​oxford's​ ​dictionary 
● Use​ ​case:​ ​Leader​ ​boards​ ​-​ ​Top​ ​10​ ​players,​ ​Products​ ​with​ ​least 
sales,  
● Use​ ​case:​ ​Autocomplete​ ​API  
Strings: 
● Strings​ ​are​ ​binary,​ ​and​ ​can​ ​store​ ​integers,​ ​floats,​ ​text 
● You​ ​can​ ​treat​ ​the​ ​string​ ​as​ ​a​ ​very​ ​large​ ​bitmap 
● You​ ​can​ ​split​ ​the​ ​string​ ​into​ ​smaller​ ​fields,​ ​and​ ​then​ ​set/get 
each​ ​field​ ​using​ ​the​ ​bitfield​ ​command 
 
©​ ​2017​ ​HashedIn​ ​Technologies​ ​Pvt.​ ​Ltd. 

More Related Content

Similar to Redis Cheat Sheet

Mongodb Performance
Mongodb PerformanceMongodb Performance
Mongodb PerformanceJack
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2Dvir Volk
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017HashedIn Technologies
 
An Introduction to Redis for .NET Developers.pdf
An Introduction to Redis for .NET Developers.pdfAn Introduction to Redis for .NET Developers.pdf
An Introduction to Redis for .NET Developers.pdfStephen Lorello
 
Text search with Elasticsearch on AWS
Text search with Elasticsearch on AWSText search with Elasticsearch on AWS
Text search with Elasticsearch on AWSŁukasz Przybyłek
 
PyConIT6 - MAKING SESSIONS AND CACHING ROOMMATES
PyConIT6 - MAKING SESSIONS AND CACHING ROOMMATESPyConIT6 - MAKING SESSIONS AND CACHING ROOMMATES
PyConIT6 - MAKING SESSIONS AND CACHING ROOMMATESAlessandro Molina
 
PostgreSQL and Redis - talk at pgcon 2013
PostgreSQL and Redis - talk at pgcon 2013PostgreSQL and Redis - talk at pgcon 2013
PostgreSQL and Redis - talk at pgcon 2013Andrew Dunstan
 
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...Command Prompt., Inc
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabaseMubashar Iqbal
 
Introduction to AWS Big Data
Introduction to AWS Big Data Introduction to AWS Big Data
Introduction to AWS Big Data Omid Vahdaty
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django applicationbangaloredjangousergroup
 
AWS Big Data Demystified #2 | Athena, Spectrum, Emr, Hive
AWS Big Data Demystified #2 |  Athena, Spectrum, Emr, Hive AWS Big Data Demystified #2 |  Athena, Spectrum, Emr, Hive
AWS Big Data Demystified #2 | Athena, Spectrum, Emr, Hive Omid Vahdaty
 
Elasticsearch selected topics
Elasticsearch selected topicsElasticsearch selected topics
Elasticsearch selected topicsCube Solutions
 
Work Stealing For Fun & Profit: Jim Nelson
Work Stealing For Fun & Profit: Jim NelsonWork Stealing For Fun & Profit: Jim Nelson
Work Stealing For Fun & Profit: Jim NelsonRedis Labs
 
PostgreSQL and Sphinx pgcon 2013
PostgreSQL and Sphinx   pgcon 2013PostgreSQL and Sphinx   pgcon 2013
PostgreSQL and Sphinx pgcon 2013Emanuel Calvo
 
Amazon DynamoDB Lessen's Learned by Beginner
Amazon DynamoDB Lessen's Learned by BeginnerAmazon DynamoDB Lessen's Learned by Beginner
Amazon DynamoDB Lessen's Learned by BeginnerHirokazu Tokuno
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisRizky Abdilah
 

Similar to Redis Cheat Sheet (20)

Mongodb Performance
Mongodb PerformanceMongodb Performance
Mongodb Performance
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017
 
An Introduction to Redis for .NET Developers.pdf
An Introduction to Redis for .NET Developers.pdfAn Introduction to Redis for .NET Developers.pdf
An Introduction to Redis for .NET Developers.pdf
 
Text search with Elasticsearch on AWS
Text search with Elasticsearch on AWSText search with Elasticsearch on AWS
Text search with Elasticsearch on AWS
 
PyConIT6 - MAKING SESSIONS AND CACHING ROOMMATES
PyConIT6 - MAKING SESSIONS AND CACHING ROOMMATESPyConIT6 - MAKING SESSIONS AND CACHING ROOMMATES
PyConIT6 - MAKING SESSIONS AND CACHING ROOMMATES
 
PostgreSQL and Redis - talk at pgcon 2013
PostgreSQL and Redis - talk at pgcon 2013PostgreSQL and Redis - talk at pgcon 2013
PostgreSQL and Redis - talk at pgcon 2013
 
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational Database
 
Introduction to AWS Big Data
Introduction to AWS Big Data Introduction to AWS Big Data
Introduction to AWS Big Data
 
Discovering python search engine
Discovering python search engineDiscovering python search engine
Discovering python search engine
 
Journey through high performance django application
Journey through high performance django applicationJourney through high performance django application
Journey through high performance django application
 
AWS Big Data Demystified #2 | Athena, Spectrum, Emr, Hive
AWS Big Data Demystified #2 |  Athena, Spectrum, Emr, Hive AWS Big Data Demystified #2 |  Athena, Spectrum, Emr, Hive
AWS Big Data Demystified #2 | Athena, Spectrum, Emr, Hive
 
Elasticsearch selected topics
Elasticsearch selected topicsElasticsearch selected topics
Elasticsearch selected topics
 
Work Stealing For Fun & Profit: Jim Nelson
Work Stealing For Fun & Profit: Jim NelsonWork Stealing For Fun & Profit: Jim Nelson
Work Stealing For Fun & Profit: Jim Nelson
 
Introducing Datawave
Introducing DatawaveIntroducing Datawave
Introducing Datawave
 
PostgreSQL and Sphinx pgcon 2013
PostgreSQL and Sphinx   pgcon 2013PostgreSQL and Sphinx   pgcon 2013
PostgreSQL and Sphinx pgcon 2013
 
Redis basics
Redis basicsRedis basics
Redis basics
 
Amazon DynamoDB Lessen's Learned by Beginner
Amazon DynamoDB Lessen's Learned by BeginnerAmazon DynamoDB Lessen's Learned by Beginner
Amazon DynamoDB Lessen's Learned by Beginner
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 

Recently uploaded

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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Recently uploaded (20)

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)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Redis Cheat Sheet

  • 1. Redis​ ​Cheat​ ​Sheet  Objects​ ​in​ ​Redis  ● must​ ​have​ ​a​ ​key  ● keys​ ​are​ ​colon​ ​separated  ● value​ ​can​ ​be​ ​hash,​ ​set,​ ​list,​ ​sortedset,​ ​string  ● can​ ​have​ ​an​ ​expiry      Hashes:  ● Use​ ​to​ ​store​ ​"objects"​ ​from​ ​object​ ​oriented​ ​programming  "blogs:234":​ ​{ ​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​"id":​ ​234, ​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​"title":​ ​"Introduction​ ​to​ ​Redis", ​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​"views":​ ​1024 ​ ​​ ​​ ​​ ​​ ​​ ​} ● hmset​ ​blogs:234​ ​id​ ​234​ ​title​ ​"Introduction​ ​to​ ​Redis"​ ​views​ ​1024  ● hgetall​ ​blogs:234  ● hincrby​ ​blogs:234​ ​views​ ​1    Sets:  ● Only​ ​unique​ ​items.​ ​No​ ​duplicates  ● Elements​ ​are​ ​not​ ​ordered  ● Can​ ​check​ ​if​ ​element​ ​exists​ ​very​ ​quickly  ● Use​ ​case:​ ​Count​ ​unique​ ​items  ● Use​ ​case:​ ​Check​ ​if​ ​item​ ​exists  ● Use​ ​case:​ ​Perform​ ​logical​ ​UNION​ ​/​ ​INTERSECTION​ ​operations  ● Two​ ​ways​ ​to​ ​represent​ ​same​ ​information,​ ​choose​ ​based​ ​on​ ​use  case​ ​set​ ​of​ ​integers​ ​consumes​ ​less​ ​memory,​ ​is​ ​very​ ​efficient  "blogs:234:tags"​ ​==>​ ​set("aws",​ ​"redis",​ ​"cache") v/s "tags:aws:blogs"​ ​==>​ ​set(234,​ ​532,​ ​332) Lists:  ● Duplicates​ ​allowed.   ● Very​ ​well​ ​defined​ ​order​ ​of​ ​elements  ● Expensive​ ​to​ ​check​ ​if​ ​element​ ​already​ ​exists​ ​in​ ​list  ©​ ​2017​ ​HashedIn​ ​Technologies​ ​Pvt.​ ​Ltd. 
  • 2. ● Operations​ ​near​ ​head​ ​/​ ​tail​ ​very​ ​fast.  ● Operations​ ​near​ ​centre​ ​elements​ ​slower  ● Can​ ​use​ ​as​ ​a​ ​queue​ ​or​ ​a​ ​stack  ● Operations​ ​can​ ​block​ ​if​ ​no​ ​elements​ ​are​ ​available,​ ​useful  ● Easy​ ​to​ ​restrict​ ​length​ ​using​ ​ltrim​ ​command  ● Use​ ​case:​ ​Recent​ ​items,​ ​recent​ ​logs  ● Use​ ​case:​ ​Queue​ ​to​ ​maintain​ ​tasks    Sorted​ ​Sets  ● Like​ ​a​ ​set,​ ​only​ ​allows​ ​unique​ ​items  ● Every​ ​element​ ​can​ ​have​ ​a​ ​numeric​ ​score  ● Score​ ​can​ ​represent​ ​anything​ ​-​ ​sales,​ ​count​ ​of​ ​orders,​ ​points​ ​in  a​ ​game​ ​etc.  ● Elements​ ​are​ ​always​ ​maintained​ ​in​ ​order​ ​of​ ​score   ● If​ ​score​ ​of​ ​two​ ​elements​ ​are​ ​same,​ ​elements​ ​are​ ​sorted​ ​in  lexicographical​ ​order​ ​-​ ​the​ ​way​ ​you​ ​see​ ​in​ ​oxford's​ ​dictionary  ● Use​ ​case:​ ​Leader​ ​boards​ ​-​ ​Top​ ​10​ ​players,​ ​Products​ ​with​ ​least  sales,   ● Use​ ​case:​ ​Autocomplete​ ​API   Strings:  ● Strings​ ​are​ ​binary,​ ​and​ ​can​ ​store​ ​integers,​ ​floats,​ ​text  ● You​ ​can​ ​treat​ ​the​ ​string​ ​as​ ​a​ ​very​ ​large​ ​bitmap  ● You​ ​can​ ​split​ ​the​ ​string​ ​into​ ​smaller​ ​fields,​ ​and​ ​then​ ​set/get  each​ ​field​ ​using​ ​the​ ​bitfield​ ​command    ©​ ​2017​ ​HashedIn​ ​Technologies​ ​Pvt.​ ​Ltd.