SlideShare a Scribd company logo
1 of 22
Redis
Redis Key-Value Database:
Practical Introduction
SoftUni Team
Technical Trainers
Software University
http://softuni.bg
Table of Contents
1. What is Redis?
2. Installing and Running Redis
3. Redis Commands
 String Commands
 Working with Keys
 Working with Hashes
 Working with Lists
 Working with Sets
 Working with Sorted Sets
2
Redis
Ultra-Fast Data Structure Server
4
 Redis is:
 Ultra-fast in-memory key-value data store
 Powerful data structure server
 Open-source software: http://redis.io
 Redis stores data structures:
 Strings, lists, hashes, sets, sorted sets
 Publish / subscribe messaging
What is Redis?
 Redis is really fast
 Non-blocking I/O, single threaded
 100,000+ read / writes per second
 Redis is not a database
 It complements your existing data storage layer
 E.g. StackOverflow uses Redis for data caching
 For small labs Redis may replace entirely the database
 Trade performance for durability  data is persisted immediately
Redis: Features
 To install Redis on Linux / Mac OS X:
 Download from http://redis.io/download
 Install it and run it
 To install Redis on Windows:
 Download https://github.com/MSOpenTech/redis
 Compile the solution in the msvs folder and build it with VS
 The easier way: use the Windows package manager Chocolatey
 http://chocolatey.org
Installing Redis
choco install redis
7
 On Linux / Mac OS X start / stop the Redis service
 The default Redis port is 6379 (the service name is redis_6379)
 On Windows start / stop the "redis" service
 Use the console-based (CLI) client or just connect with Telnet:
Running Redis
sudo service redis_6379 start sudo service redis_6379 stop
sc start redis sc stop redis
redis-cli telnet localhost 6379
Redis: Basic Commands
9
 Redis keeps key-value pairs
 Every item is stored as key + value
 Keys are unique identifiers
 Values can be different data structures:
 Strings (numbers are stored as strings)
 Lists (of strings)
 Hash tables: string  string
 Sets / sorted sets (of strings)
Redis: Data Model
10
 Redis works as interpreter of commands:
Redis: Commands
SET name "Nakov"
OK
GET name
"Nakov"
DEL name
(integer) 1
GET name
(nil)
 Play with the command-line client
redis-cli
 Or play with Redis online at
http://try.redis.io
11
String Commands
 SET [key] [value]
 Assigns a string value in a key
 GET [key] / MGET [keys]
 Returns the value by key / keys
 INCR [key] / DECR [key]
 Increments / decrements a key
 STRLEN [key]
 Returns the length of a string
SET name "hi"
OK
GET name
"hi"
SET name abc
OK
GET "name"
"abc"
GET Name
(nil)
SET a 1234
OK
INCR a
(integer) 1235
GET a
"12345"
MGET a name
1) "1235"
2) "asdda"
STRLEN a
(integer) 4
12
Working with Keys
 EXISTS [key]
 Checks whether a key exists
 TYPE [key]
 Returns the type of a key
 DEL [key]
 Deletes a key
 EXPIRE [key] [t]
 Deletes a key after t seconds
SET count 5
OK
TYPE count
string
EXISTS count
(integer) 1
DEL count
(integer) 1
EXISTS count
(integer) 0
SET a 1234
OK
GET a
"1234"
EXPIRE a 5
(integer) 1
EXISTS a
(integer) 1
EXISTS a
(integer) 0
13
Working with Hashes (Hash Tables)
 HSET [key] [field] [value]
 Assigns a value for given field
 HKEYS [key]
 Returns the fields (keys) is in a hash
 HGET [key] [field]
 Returns a value by fields from a hash
 HDEL [key] [field]
 Deletes a fields from a hash
HSET user name "peter"
(integer) 1
HSET user age 23
(integer) 1
HKEYS user
1) "name"
2) "age"
HGET user age
"23"
HDEL user age
(integer) 1
14
Working with Lists
 RPUSH / LPUSH [list] [value]
 Appends / prepend an value to a list
 LINDEX [list] [index]
 Returns a value given index in a list
 LLEN [list]
 Returns the length of a list
 LRANGE [list] [start] [count]
 Returns a sub-list (range of values)
RPUSH names "peter"
(integer) 1
LPUSH names Nakov
(integer) 1
LINDEX names 0
"Nakov"
LLEN names
(integer) 2
LRANGE names 0 100
1) "Nakov"
2) "peter"
15
Working with Sets
 SADD [set] [value]
 Appends a value to a set
 SMEMBERS [set]
 Returns the values from a set
 SREM [set] [value]
 Deletes a value form a set
 SCARD [set]
 Returns the stack size (items count)
SADD users "peter"
(integer) 1
SADD users "peter"
(integer) 0
SADD users maria
(integer) 1
SMEMBERS users
1) "peter"
2) "maria"
SREM users maria
(integer) 1
16
Working with Sorted Sets
 Learn more at http://redis.io/commands#sorted_set
ZADD myzset 1 "one"
(integer) 1
ZADD myzset 1 "uno"
(integer) 1
ZADD myzset 2 "two" 3 "three"
(integer) 2
ZRANGE myzset 0 -1 WITHSCORES
1) "one"
2) "1"
…
17
 First user subscribes to certain channel "news"
 Another user sends messages to the same channel "news"
 Learn more at http://redis.io/commands#pubsub
Publish / Subscribe Commands
SUBSCRIBE news
1) "subscribe"
2) "news"
3) (integer) 1
PUBLISH news "hello"
(integer) 1
18
 Special naming can help using Redis as database
Using Redis as a Database
SADD users:names peter
HSET users:peter name "Peter Petrov"
HSET users:peter email "pp@gmail.com"
SADD users:names maria
HSET users:maria name "Maria Ivanova"
HSET users:maria email "maria@yahoo.com"
SMEMBERS users:names
HGETALL users:peter
Add a user "peter".
Add a user "maria".
Use "users:peter" as
key to hold user data
List all users
List all properties
for user "peter"
19
1. Redis is ultra-fast in-memory data store
 Not a database, used along with databases
2. Supports strings, numbers, lists, hashes,
sets, sorted sets, publish / subscribe
messaging
3. Used for caching / simple apps
Summary
?
https://softuni.bg/courses/databases
Redis
License
 This course (slides, examples, demos, videos, homework, etc.)
is licensed under the "Creative Commons Attribution-
NonCommercial-ShareAlike 4.0 International" license
21
 Attribution: this work may contain portions from
 "Databases" course by Telerik Academy under CC-BY-NC-SA license
Free Trainings @ Software University
 Software University Foundation – softuni.org
 Software University – High-Quality Education,
Profession and Job for Software Developers
 softuni.bg
 Software University @ Facebook
 facebook.com/SoftwareUniversity
 Software University @ YouTube
 youtube.com/SoftwareUniversity
 Software University Forums – forum.softuni.bg

More Related Content

What's hot

Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...DataStax
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAli MasudianPour
 
A simple introduction to redis
A simple introduction to redisA simple introduction to redis
A simple introduction to redisZhichao Liang
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBMongoDB
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2Dvir Volk
 
Storing time series data with Apache Cassandra
Storing time series data with Apache CassandraStoring time series data with Apache Cassandra
Storing time series data with Apache CassandraPatrick McFadin
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practiceEugene Fidelin
 
ClickHouse Deep Dive, by Aleksei Milovidov
ClickHouse Deep Dive, by Aleksei MilovidovClickHouse Deep Dive, by Aleksei Milovidov
ClickHouse Deep Dive, by Aleksei MilovidovAltinity Ltd
 
Redis and its Scaling and Obersvability
Redis and its Scaling and ObersvabilityRedis and its Scaling and Obersvability
Redis and its Scaling and ObersvabilityAbhishekDubey902839
 
Redis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Labs
 
Using ClickHouse for Experimentation
Using ClickHouse for ExperimentationUsing ClickHouse for Experimentation
Using ClickHouse for ExperimentationGleb Kanterov
 
Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016
Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016
Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016DataStax
 
Базы данных в 2020
Базы данных в 2020Базы данных в 2020
Базы данных в 2020Timur Shemsedinov
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기I Goo Lee
 

What's hot (20)

Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
Deletes Without Tombstones or TTLs (Eric Stevens, ProtectWise) | Cassandra Su...
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
A simple introduction to redis
A simple introduction to redisA simple introduction to redis
A simple introduction to redis
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
redis basics
redis basicsredis basics
redis basics
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2
 
Redis database
Redis databaseRedis database
Redis database
 
Storing time series data with Apache Cassandra
Storing time series data with Apache CassandraStoring time series data with Apache Cassandra
Storing time series data with Apache Cassandra
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practice
 
ClickHouse Deep Dive, by Aleksei Milovidov
ClickHouse Deep Dive, by Aleksei MilovidovClickHouse Deep Dive, by Aleksei Milovidov
ClickHouse Deep Dive, by Aleksei Milovidov
 
Postgresql
PostgresqlPostgresql
Postgresql
 
Redis and its Scaling and Obersvability
Redis and its Scaling and ObersvabilityRedis and its Scaling and Obersvability
Redis and its Scaling and Obersvability
 
Redis Reliability, Performance & Innovation
Redis Reliability, Performance & InnovationRedis Reliability, Performance & Innovation
Redis Reliability, Performance & Innovation
 
Redis basics
Redis basicsRedis basics
Redis basics
 
Using ClickHouse for Experimentation
Using ClickHouse for ExperimentationUsing ClickHouse for Experimentation
Using ClickHouse for Experimentation
 
MongoDB
MongoDBMongoDB
MongoDB
 
Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016
Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016
Myths of Big Partitions (Robert Stupp, DataStax) | Cassandra Summit 2016
 
Базы данных в 2020
Базы данных в 2020Базы данных в 2020
Базы данных в 2020
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
 

Similar to Redis

Redis Installation Configuration And Implementation
Redis Installation Configuration And ImplementationRedis Installation Configuration And Implementation
Redis Installation Configuration And ImplementationAbhijeet Shekhar
 
quickguide-einnovator-9-redis
quickguide-einnovator-9-redisquickguide-einnovator-9-redis
quickguide-einnovator-9-redisjorgesimao71
 
Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Itamar Haber
 
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020Andrew Lavers
 
mar07-redis.pdf
mar07-redis.pdfmar07-redis.pdf
mar07-redis.pdfAnisSalhi3
 
Try Redis - interactive Tutorial
Try Redis - interactive TutorialTry Redis - interactive Tutorial
Try Redis - interactive TutorialEdward Lee
 
Redis SoCraTes 2014
Redis SoCraTes 2014Redis SoCraTes 2014
Redis SoCraTes 2014steffenbauer
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisItamar Haber
 
Extend Redis with Modules
Extend Redis with ModulesExtend Redis with Modules
Extend Redis with ModulesItamar Haber
 
Tuga IT 2017 - Redis
Tuga IT 2017 - RedisTuga IT 2017 - Redis
Tuga IT 2017 - RedisNuno Caneco
 
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
 
What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?ukdpe
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewEric Nelson
 
Redis/Lessons learned
Redis/Lessons learnedRedis/Lessons learned
Redis/Lessons learnedTit Petric
 
Redis 101 Data Structure
Redis 101 Data StructureRedis 101 Data Structure
Redis 101 Data StructureIsmaeel Enjreny
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup IntroductionGregory Boissinot
 

Similar to Redis (20)

Redis Installation Configuration And Implementation
Redis Installation Configuration And ImplementationRedis Installation Configuration And Implementation
Redis Installation Configuration And Implementation
 
quickguide-einnovator-9-redis
quickguide-einnovator-9-redisquickguide-einnovator-9-redis
quickguide-einnovator-9-redis
 
Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)Redis Indices (#RedisTLV)
Redis Indices (#RedisTLV)
 
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020
 
mar07-redis.pdf
mar07-redis.pdfmar07-redis.pdf
mar07-redis.pdf
 
Try Redis - interactive Tutorial
Try Redis - interactive TutorialTry Redis - interactive Tutorial
Try Redis - interactive Tutorial
 
Redis SoCraTes 2014
Redis SoCraTes 2014Redis SoCraTes 2014
Redis SoCraTes 2014
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis Set Go
Redis Set GoRedis Set Go
Redis Set Go
 
Extend Redis with Modules
Extend Redis with ModulesExtend Redis with Modules
Extend Redis with Modules
 
Sql
SqlSql
Sql
 
Tuga IT 2017 - Redis
Tuga IT 2017 - RedisTuga IT 2017 - Redis
Tuga IT 2017 - 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)
 
What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
Redis/Lessons learned
Redis/Lessons learnedRedis/Lessons learned
Redis/Lessons learned
 
Redis 101 Data Structure
Redis 101 Data StructureRedis 101 Data Structure
Redis 101 Data Structure
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
 
Redis overview
Redis overviewRedis overview
Redis overview
 

More from ssuserbad56d

More from ssuserbad56d (7)

search
searchsearch
search
 
search
searchsearch
search
 
Scaling Web Applications with Cassandra Presentation.ppt
Scaling Web Applications with Cassandra Presentation.pptScaling Web Applications with Cassandra Presentation.ppt
Scaling Web Applications with Cassandra Presentation.ppt
 
Cassandra
CassandraCassandra
Cassandra
 
Covered Call
Covered CallCovered Call
Covered Call
 
Lec04.pdf
Lec04.pdfLec04.pdf
Lec04.pdf
 
Project.pdf
Project.pdfProject.pdf
Project.pdf
 

Recently uploaded

Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
Data Warehouse , Data Cube Computation
Data Warehouse   , Data Cube ComputationData Warehouse   , Data Cube Computation
Data Warehouse , Data Cube Computationsit20ad004
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...shivangimorya083
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...Florian Roscheck
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxStephen266013
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Servicejennyeacort
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 

Recently uploaded (20)

Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
Data Warehouse , Data Cube Computation
Data Warehouse   , Data Cube ComputationData Warehouse   , Data Cube Computation
Data Warehouse , Data Cube Computation
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
Russian Call Girls Dwarka Sector 15 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Russian Call Girls Dwarka Sector 15 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...Russian Call Girls Dwarka Sector 15 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
Russian Call Girls Dwarka Sector 15 💓 Delhi 9999965857 @Sabina Modi VVIP MODE...
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...From idea to production in a day – Leveraging Azure ML and Streamlit to build...
From idea to production in a day – Leveraging Azure ML and Streamlit to build...
 
B2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docxB2 Creative Industry Response Evaluation.docx
B2 Creative Industry Response Evaluation.docx
 
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 

Redis

  • 1. Redis Redis Key-Value Database: Practical Introduction SoftUni Team Technical Trainers Software University http://softuni.bg
  • 2. Table of Contents 1. What is Redis? 2. Installing and Running Redis 3. Redis Commands  String Commands  Working with Keys  Working with Hashes  Working with Lists  Working with Sets  Working with Sorted Sets 2
  • 4. 4  Redis is:  Ultra-fast in-memory key-value data store  Powerful data structure server  Open-source software: http://redis.io  Redis stores data structures:  Strings, lists, hashes, sets, sorted sets  Publish / subscribe messaging What is Redis?
  • 5.  Redis is really fast  Non-blocking I/O, single threaded  100,000+ read / writes per second  Redis is not a database  It complements your existing data storage layer  E.g. StackOverflow uses Redis for data caching  For small labs Redis may replace entirely the database  Trade performance for durability  data is persisted immediately Redis: Features
  • 6.  To install Redis on Linux / Mac OS X:  Download from http://redis.io/download  Install it and run it  To install Redis on Windows:  Download https://github.com/MSOpenTech/redis  Compile the solution in the msvs folder and build it with VS  The easier way: use the Windows package manager Chocolatey  http://chocolatey.org Installing Redis choco install redis
  • 7. 7  On Linux / Mac OS X start / stop the Redis service  The default Redis port is 6379 (the service name is redis_6379)  On Windows start / stop the "redis" service  Use the console-based (CLI) client or just connect with Telnet: Running Redis sudo service redis_6379 start sudo service redis_6379 stop sc start redis sc stop redis redis-cli telnet localhost 6379
  • 9. 9  Redis keeps key-value pairs  Every item is stored as key + value  Keys are unique identifiers  Values can be different data structures:  Strings (numbers are stored as strings)  Lists (of strings)  Hash tables: string  string  Sets / sorted sets (of strings) Redis: Data Model
  • 10. 10  Redis works as interpreter of commands: Redis: Commands SET name "Nakov" OK GET name "Nakov" DEL name (integer) 1 GET name (nil)  Play with the command-line client redis-cli  Or play with Redis online at http://try.redis.io
  • 11. 11 String Commands  SET [key] [value]  Assigns a string value in a key  GET [key] / MGET [keys]  Returns the value by key / keys  INCR [key] / DECR [key]  Increments / decrements a key  STRLEN [key]  Returns the length of a string SET name "hi" OK GET name "hi" SET name abc OK GET "name" "abc" GET Name (nil) SET a 1234 OK INCR a (integer) 1235 GET a "12345" MGET a name 1) "1235" 2) "asdda" STRLEN a (integer) 4
  • 12. 12 Working with Keys  EXISTS [key]  Checks whether a key exists  TYPE [key]  Returns the type of a key  DEL [key]  Deletes a key  EXPIRE [key] [t]  Deletes a key after t seconds SET count 5 OK TYPE count string EXISTS count (integer) 1 DEL count (integer) 1 EXISTS count (integer) 0 SET a 1234 OK GET a "1234" EXPIRE a 5 (integer) 1 EXISTS a (integer) 1 EXISTS a (integer) 0
  • 13. 13 Working with Hashes (Hash Tables)  HSET [key] [field] [value]  Assigns a value for given field  HKEYS [key]  Returns the fields (keys) is in a hash  HGET [key] [field]  Returns a value by fields from a hash  HDEL [key] [field]  Deletes a fields from a hash HSET user name "peter" (integer) 1 HSET user age 23 (integer) 1 HKEYS user 1) "name" 2) "age" HGET user age "23" HDEL user age (integer) 1
  • 14. 14 Working with Lists  RPUSH / LPUSH [list] [value]  Appends / prepend an value to a list  LINDEX [list] [index]  Returns a value given index in a list  LLEN [list]  Returns the length of a list  LRANGE [list] [start] [count]  Returns a sub-list (range of values) RPUSH names "peter" (integer) 1 LPUSH names Nakov (integer) 1 LINDEX names 0 "Nakov" LLEN names (integer) 2 LRANGE names 0 100 1) "Nakov" 2) "peter"
  • 15. 15 Working with Sets  SADD [set] [value]  Appends a value to a set  SMEMBERS [set]  Returns the values from a set  SREM [set] [value]  Deletes a value form a set  SCARD [set]  Returns the stack size (items count) SADD users "peter" (integer) 1 SADD users "peter" (integer) 0 SADD users maria (integer) 1 SMEMBERS users 1) "peter" 2) "maria" SREM users maria (integer) 1
  • 16. 16 Working with Sorted Sets  Learn more at http://redis.io/commands#sorted_set ZADD myzset 1 "one" (integer) 1 ZADD myzset 1 "uno" (integer) 1 ZADD myzset 2 "two" 3 "three" (integer) 2 ZRANGE myzset 0 -1 WITHSCORES 1) "one" 2) "1" …
  • 17. 17  First user subscribes to certain channel "news"  Another user sends messages to the same channel "news"  Learn more at http://redis.io/commands#pubsub Publish / Subscribe Commands SUBSCRIBE news 1) "subscribe" 2) "news" 3) (integer) 1 PUBLISH news "hello" (integer) 1
  • 18. 18  Special naming can help using Redis as database Using Redis as a Database SADD users:names peter HSET users:peter name "Peter Petrov" HSET users:peter email "pp@gmail.com" SADD users:names maria HSET users:maria name "Maria Ivanova" HSET users:maria email "maria@yahoo.com" SMEMBERS users:names HGETALL users:peter Add a user "peter". Add a user "maria". Use "users:peter" as key to hold user data List all users List all properties for user "peter"
  • 19. 19 1. Redis is ultra-fast in-memory data store  Not a database, used along with databases 2. Supports strings, numbers, lists, hashes, sets, sorted sets, publish / subscribe messaging 3. Used for caching / simple apps Summary
  • 21. License  This course (slides, examples, demos, videos, homework, etc.) is licensed under the "Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International" license 21  Attribution: this work may contain portions from  "Databases" course by Telerik Academy under CC-BY-NC-SA license
  • 22. Free Trainings @ Software University  Software University Foundation – softuni.org  Software University – High-Quality Education, Profession and Job for Software Developers  softuni.bg  Software University @ Facebook  facebook.com/SoftwareUniversity  Software University @ YouTube  youtube.com/SoftwareUniversity  Software University Forums – forum.softuni.bg