SlideShare a Scribd company logo
Redis 맛보기
jhoh@encoredtech.com
Redis
● REmote DIctionary Server
● In-memory, but can be persisted
● NoSQL Key-value store
● Written in ANSI C
● No threading, just one process
The Most Popular Key-Value Store
Why Redis?
● Fast
● Easy to learn
● Various data types
● Solve a specific set of problems
○ Good: Caching, Statistical data, Recoverable state,
Worker Queue
○ Bad: 100% consistent dataset required, Data is
larger than memory
Running & Connecting
● redis-server
● redis-cli
● http://try.redis.io/
Redis Protocol
redis[“key”] = “value”
Key
● Redis key is Binary safe, this means that you can use
any binary sequence as a key:
○ string
○ content of a JPEG file
○ also, empty string
Rules about Keys
● Too long keys are not a good idea
○ memory-wise, costly key-comparisons
● Too short keys are often not a good idea
○ more readable
○ id:10:pass => id:10:password
● Try to stick with a schema
○ “object-type:id:field” => “comment:1234:reply.to”
Value types
● String
● List of strings
● Sets of strings
● Sorted sets of strings
● Hashes where keys and values are strings
String
● The simplest Redis type
● A value can’t be bigger than 512 MB
● SET
● GET
● INCR/INCRBY, DECR/DECRBY
● GETSET
127.0.0.1:6379> set mykey 100
OK
127.0.0.1:6379> get mykey
"100"
127.0.0.1:6379> incr mykey
(integer) 101
127.0.0.1:6379> incrby mykey 5
(integer) 106
127.0.0.1:6379> decr mykey
(integer) 105
127.0.0.1:6379> decrby mykey 2
(integer) 103
127.0.0.1:6379> getset mykey 1
"103"
127.0.0.1:6379> get mykey
"1"
Example Of String
List
● Implemented via Linked Lists
● LPUSH
○ add a new element into a list at the head
● RPUSH
○ add a new element into a list at the tail
● LRANGE
127.0.0.1:6379> incr next.news.id
(integer) 1
127.0.0.1:6379> set news:1:title "Redis is simple"
OK
127.0.0.1:6379> set news:1:url "http://code.google.com/redis"
OK
127.0.0.1:6379> lpush submitted.news 1
(integer) 1
Push IDs instead of the actual data
reddit.com example:
Sets
● Unordered collections of unique strings
● SADD
● SMEMBERS
● SISMEMBER
● SINTER
○ the intersection between different sets
Sorted Sets
● Collections of unique strings with associated
score
● ZADD
○ O(log(N))
● ZRANGE/ZREVRANGE
● ZRANGEBYSCORE
ZADD
Add a few selected hackers with their year of birth as score
127.0.0.1:6379> zadd hackers 1940 "Alan Kay"
(integer) 1
127.0.0.1:6379> zadd hackers 1953 "Richard Stallman"
(integer) 1
127.0.0.1:6379> zadd hackers 1965 "Yukihiro Matsumoto"
(integer) 1
127.0.0.1:6379> zadd hackers 1916 "Claude Shannon"
(integer) 1
127.0.0.1:6379> zadd hackers 1969 "Linus Torvalds"
(integer) 1
127.0.0.1:6379> zadd hackers 1912 "Alan Turing"
(integer) 1
ZRANGE/ZREVRANGE
Ask for sorted hackers
127.0.0.1:6379> zrange hackers 0 -1
1) "Alan Turing"
2) "Claude Shannon"
3) "Alan Kay"
4) "Richard Stallman"
5) "Yukihiro Matsumoto"
6) "Linus Torvalds"
127.0.0.1:6379> zrevrange hackers 0 -1
1) "Linus Torvalds"
2) "Yukihiro Matsumoto"
3) "Richard Stallman"
4) "Alan Kay"
5) "Claude Shannon"
6) "Alan Turing"
Sorted Set by different ordering
● Use SORT command
○ Server will waste CPU
● Make another sorted set
○ An alternative for having multiple orders is to add
every element in multiple sorted sets at the same
time.
Updating the scores
● Just calling again ZADD
Hashes
● HSET
● HGET
● HGETALL
● HKEYS
127.0.0.1:6379> hset users:1 username poby
(integer) 1
127.0.0.1:6379> hget users:1 username
"poby"
127.0.0.1:6379> hmset users:1 age 10 bestfriend pororo
OK
127.0.0.1:6379> hgetall users:1
1) "username"
2) "poby"
3) "age"
4) "10"
5) "bestfriend"
6) "pororo"
127.0.0.1:6379> hkeys users:1
1) "username"
2) "age"
3) "bestfriend"
127.0.0.1:6379> hdel users:1 age
(integer) 1
Example Of Hash
Redis Clients
http://redis.io/clients
Demo: realtime-info
AWS ElastiCache
realtime-info
EDM1
EDM1
EDM1
EDM1
EDM1
EDM1
API Server
Log Server
Demo: Realtime-Info (1)
SET realtime-info by Poby
Demo: Realtime-Info (2)
MGET realtime-info by API
참고 자료
● Redis - Wikipedia
● Redis - Fast and Furious
● 15 minutes introduction to Redis data types
● The Little Redis Book
● redis.io
끝

More Related Content

Viewers also liked

Business Networking-Build a solid network
Business Networking-Build a solid networkBusiness Networking-Build a solid network
Business Networking-Build a solid network
Debbie Gilbert
 
The art of readable code ch4 ch8
The art of readable code ch4   ch8The art of readable code ch4   ch8
The art of readable code ch4 ch8
Ki Sung Bae
 
Amazon virtual private cloud (vpc)
Amazon virtual private cloud (vpc)Amazon virtual private cloud (vpc)
Amazon virtual private cloud (vpc)
Ki Sung Bae
 
Never stop running in Heidelberg
Never stop running in HeidelbergNever stop running in Heidelberg
Never stop running in Heidelberg
NatalieFujitsu
 
Awesome!!!!
Awesome!!!!Awesome!!!!
Awesome!!!!
Joy Luper
 
The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)
Ki Sung Bae
 
Inspirater - Startup Weekend - October 16, 2011
Inspirater - Startup Weekend - October 16, 2011Inspirater - Startup Weekend - October 16, 2011
Inspirater - Startup Weekend - October 16, 2011
SWBoston2011
 
Numbers
NumbersNumbers
Preparandomipruebalacolonia 121024141218-phpapp02
Preparandomipruebalacolonia 121024141218-phpapp02Preparandomipruebalacolonia 121024141218-phpapp02
Preparandomipruebalacolonia 121024141218-phpapp02
Starla Smith
 
Kssr matematik
Kssr matematikKssr matematik
Kssr matematik
Noorveda Hashim
 
教育局文明单位工作汇报
教育局文明单位工作汇报教育局文明单位工作汇报
教育局文明单位工作汇报jaychou1986
 
A chinese ppt fans make---10 Ways to Prepare for a TED-format Talk
A chinese ppt fans make---10 Ways to Prepare for a TED-format Talk A chinese ppt fans make---10 Ways to Prepare for a TED-format Talk
A chinese ppt fans make---10 Ways to Prepare for a TED-format Talk
jaychou1986
 
The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)
Ki Sung Bae
 
Tambah 10
Tambah 10Tambah 10
Tambah 10
Noorveda Hashim
 
Starbucks
StarbucksStarbucks
Starbucks
Muhammad Qadeer
 

Viewers also liked (15)

Business Networking-Build a solid network
Business Networking-Build a solid networkBusiness Networking-Build a solid network
Business Networking-Build a solid network
 
The art of readable code ch4 ch8
The art of readable code ch4   ch8The art of readable code ch4   ch8
The art of readable code ch4 ch8
 
Amazon virtual private cloud (vpc)
Amazon virtual private cloud (vpc)Amazon virtual private cloud (vpc)
Amazon virtual private cloud (vpc)
 
Never stop running in Heidelberg
Never stop running in HeidelbergNever stop running in Heidelberg
Never stop running in Heidelberg
 
Awesome!!!!
Awesome!!!!Awesome!!!!
Awesome!!!!
 
The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)
 
Inspirater - Startup Weekend - October 16, 2011
Inspirater - Startup Weekend - October 16, 2011Inspirater - Startup Weekend - October 16, 2011
Inspirater - Startup Weekend - October 16, 2011
 
Numbers
NumbersNumbers
Numbers
 
Preparandomipruebalacolonia 121024141218-phpapp02
Preparandomipruebalacolonia 121024141218-phpapp02Preparandomipruebalacolonia 121024141218-phpapp02
Preparandomipruebalacolonia 121024141218-phpapp02
 
Kssr matematik
Kssr matematikKssr matematik
Kssr matematik
 
教育局文明单位工作汇报
教育局文明单位工作汇报教育局文明单位工作汇报
教育局文明单位工作汇报
 
A chinese ppt fans make---10 Ways to Prepare for a TED-format Talk
A chinese ppt fans make---10 Ways to Prepare for a TED-format Talk A chinese ppt fans make---10 Ways to Prepare for a TED-format Talk
A chinese ppt fans make---10 Ways to Prepare for a TED-format Talk
 
The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)The art of readable code (ch1~ch4)
The art of readable code (ch1~ch4)
 
Tambah 10
Tambah 10Tambah 10
Tambah 10
 
Starbucks
StarbucksStarbucks
Starbucks
 

Similar to Redis 맛보기

An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdf
Stephen Lorello
 
Redis basics
Redis basicsRedis basics
Redis basics
Arthur Shvetsov
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Daniel Cousineau
 
Florida Man Uses Cache as Database.pdf
Florida Man Uses Cache as Database.pdfFlorida Man Uses Cache as Database.pdf
Florida Man Uses Cache as Database.pdf
Stephen Lorello
 
Super-Charging Kamailio
Super-Charging KamailioSuper-Charging Kamailio
Super-Charging Kamailio
Andreas Granig
 
Neo4j: Graph-like power
Neo4j: Graph-like powerNeo4j: Graph-like power
Neo4j: Graph-like power
Roman Rodomansky
 
Hybrid Databases - PHP UK Conference 22 February 2019
Hybrid Databases - PHP UK Conference 22 February 2019Hybrid Databases - PHP UK Conference 22 February 2019
Hybrid Databases - PHP UK Conference 22 February 2019
Dave Stokes
 
Erasure codes and storage tiers on gluster
Erasure codes and storage tiers on glusterErasure codes and storage tiers on gluster
Erasure codes and storage tiers on gluster
Red_Hat_Storage
 
Indexing, searching, and aggregation with redi search and .net
Indexing, searching, and aggregation with redi search and .netIndexing, searching, and aggregation with redi search and .net
Indexing, searching, and aggregation with redi search and .net
Stephen Lorello
 
MongoDB Schema Design Tips & Tricks
MongoDB Schema Design Tips & TricksMongoDB Schema Design Tips & Tricks
MongoDB Schema Design Tips & Tricks
Juan Antonio Roy Couto
 
RedisConf18 - Redis as a time-series DB
RedisConf18 - Redis as a time-series DBRedisConf18 - Redis as a time-series DB
RedisConf18 - Redis as a time-series DB
Redis Labs
 
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
Stephen Lorello
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
MongoDB
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
Ali MasudianPour
 
Neo4j after 1 year in production
Neo4j after 1 year in productionNeo4j after 1 year in production
Neo4j after 1 year in production
Andrew Nikishaev
 
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Data Con LA
 
RedisConf17 - Searching Billions of Documents with Redis
RedisConf17 - Searching Billions of Documents with RedisRedisConf17 - Searching Billions of Documents with Redis
RedisConf17 - Searching Billions of Documents with Redis
Redis Labs
 
The Internet in Database: A Cassandra Use Case
The Internet in Database: A Cassandra Use CaseThe Internet in Database: A Cassandra Use Case
The Internet in Database: A Cassandra Use Case
Datafiniti
 
ORM – The tip of an iceberg
ORM – The tip of an icebergORM – The tip of an iceberg
ORM – The tip of an iceberg
Rafał Hryniewski
 
4Developers 2018: ORM - the tip of an iceberg (Rafał Hryniewski)
4Developers 2018: ORM - the tip of an iceberg (Rafał Hryniewski)4Developers 2018: ORM - the tip of an iceberg (Rafał Hryniewski)
4Developers 2018: ORM - the tip of an iceberg (Rafał Hryniewski)
PROIDEA
 

Similar to Redis 맛보기 (20)

An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdf
 
Redis basics
Redis basicsRedis basics
Redis basics
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
 
Florida Man Uses Cache as Database.pdf
Florida Man Uses Cache as Database.pdfFlorida Man Uses Cache as Database.pdf
Florida Man Uses Cache as Database.pdf
 
Super-Charging Kamailio
Super-Charging KamailioSuper-Charging Kamailio
Super-Charging Kamailio
 
Neo4j: Graph-like power
Neo4j: Graph-like powerNeo4j: Graph-like power
Neo4j: Graph-like power
 
Hybrid Databases - PHP UK Conference 22 February 2019
Hybrid Databases - PHP UK Conference 22 February 2019Hybrid Databases - PHP UK Conference 22 February 2019
Hybrid Databases - PHP UK Conference 22 February 2019
 
Erasure codes and storage tiers on gluster
Erasure codes and storage tiers on glusterErasure codes and storage tiers on gluster
Erasure codes and storage tiers on gluster
 
Indexing, searching, and aggregation with redi search and .net
Indexing, searching, and aggregation with redi search and .netIndexing, searching, and aggregation with redi search and .net
Indexing, searching, and aggregation with redi search and .net
 
MongoDB Schema Design Tips & Tricks
MongoDB Schema Design Tips & TricksMongoDB Schema Design Tips & Tricks
MongoDB Schema Design Tips & Tricks
 
RedisConf18 - Redis as a time-series DB
RedisConf18 - Redis as a time-series DBRedisConf18 - Redis as a time-series DB
RedisConf18 - Redis as a time-series DB
 
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
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
Neo4j after 1 year in production
Neo4j after 1 year in productionNeo4j after 1 year in production
Neo4j after 1 year in production
 
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
Big Data Day LA 2015 - How to model anything in Redis by Josiah Carlson of Ze...
 
RedisConf17 - Searching Billions of Documents with Redis
RedisConf17 - Searching Billions of Documents with RedisRedisConf17 - Searching Billions of Documents with Redis
RedisConf17 - Searching Billions of Documents with Redis
 
The Internet in Database: A Cassandra Use Case
The Internet in Database: A Cassandra Use CaseThe Internet in Database: A Cassandra Use Case
The Internet in Database: A Cassandra Use Case
 
ORM – The tip of an iceberg
ORM – The tip of an icebergORM – The tip of an iceberg
ORM – The tip of an iceberg
 
4Developers 2018: ORM - the tip of an iceberg (Rafał Hryniewski)
4Developers 2018: ORM - the tip of an iceberg (Rafał Hryniewski)4Developers 2018: ORM - the tip of an iceberg (Rafał Hryniewski)
4Developers 2018: ORM - the tip of an iceberg (Rafał Hryniewski)
 

Recently uploaded

A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
kalichargn70th171
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
narinav14
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
The Third Creative Media
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
kalichargn70th171
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
alowpalsadig
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
Envertis Software Solutions
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
kgyxske
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
Yara Milbes
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio, Inc.
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
widenerjobeyrl638
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
Pedro J. Molina
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
campbellclarkson
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
Tier1 app
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
Reetu63
 

Recently uploaded (20)

A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
A Comprehensive Guide on Implementing Real-World Mobile Testing Strategies fo...
 
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and MoreManyata Tech Park Bangalore_ Infrastructure, Facilities and More
Manyata Tech Park Bangalore_ Infrastructure, Facilities and More
 
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
Unlock the Secrets to Effortless Video Creation with Invideo: Your Ultimate G...
 
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdfThe Comprehensive Guide to Validating Audio-Visual Performances.pdf
The Comprehensive Guide to Validating Audio-Visual Performances.pdf
 
Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)Photoshop Tutorial for Beginners (2024 Edition)
Photoshop Tutorial for Beginners (2024 Edition)
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
What’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete RoadmapWhat’s New in Odoo 17 – A Complete Roadmap
What’s New in Odoo 17 – A Complete Roadmap
 
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
一比一原版(sdsu毕业证书)圣地亚哥州立大学毕业证如何办理
 
The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024The Rising Future of CPaaS in the Middle East 2024
The Rising Future of CPaaS in the Middle East 2024
 
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data PlatformAlluxio Webinar | 10x Faster Trino Queries on Your Data Platform
Alluxio Webinar | 10x Faster Trino Queries on Your Data Platform
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
美洲杯赔率投注网【​网址​🎉3977·EE​🎉】
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Orca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container OrchestrationOrca: Nocode Graphical Editor for Container Orchestration
Orca: Nocode Graphical Editor for Container Orchestration
 
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
🏎️Tech Transformation: DevOps Insights from the Experts 👩‍💻
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSISDECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
DECODING JAVA THREAD DUMPS: MASTER THE ART OF ANALYSIS
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
ppt on the brain chip neuralink.pptx
ppt  on   the brain  chip neuralink.pptxppt  on   the brain  chip neuralink.pptx
ppt on the brain chip neuralink.pptx
 

Redis 맛보기

  • 2. Redis ● REmote DIctionary Server ● In-memory, but can be persisted ● NoSQL Key-value store ● Written in ANSI C ● No threading, just one process
  • 3. The Most Popular Key-Value Store
  • 4. Why Redis? ● Fast ● Easy to learn ● Various data types ● Solve a specific set of problems ○ Good: Caching, Statistical data, Recoverable state, Worker Queue ○ Bad: 100% consistent dataset required, Data is larger than memory
  • 5. Running & Connecting ● redis-server ● redis-cli ● http://try.redis.io/
  • 7. Key ● Redis key is Binary safe, this means that you can use any binary sequence as a key: ○ string ○ content of a JPEG file ○ also, empty string
  • 8. Rules about Keys ● Too long keys are not a good idea ○ memory-wise, costly key-comparisons ● Too short keys are often not a good idea ○ more readable ○ id:10:pass => id:10:password ● Try to stick with a schema ○ “object-type:id:field” => “comment:1234:reply.to”
  • 9. Value types ● String ● List of strings ● Sets of strings ● Sorted sets of strings ● Hashes where keys and values are strings
  • 10. String ● The simplest Redis type ● A value can’t be bigger than 512 MB ● SET ● GET ● INCR/INCRBY, DECR/DECRBY ● GETSET
  • 11. 127.0.0.1:6379> set mykey 100 OK 127.0.0.1:6379> get mykey "100" 127.0.0.1:6379> incr mykey (integer) 101 127.0.0.1:6379> incrby mykey 5 (integer) 106 127.0.0.1:6379> decr mykey (integer) 105 127.0.0.1:6379> decrby mykey 2 (integer) 103 127.0.0.1:6379> getset mykey 1 "103" 127.0.0.1:6379> get mykey "1" Example Of String
  • 12. List ● Implemented via Linked Lists ● LPUSH ○ add a new element into a list at the head ● RPUSH ○ add a new element into a list at the tail ● LRANGE
  • 13. 127.0.0.1:6379> incr next.news.id (integer) 1 127.0.0.1:6379> set news:1:title "Redis is simple" OK 127.0.0.1:6379> set news:1:url "http://code.google.com/redis" OK 127.0.0.1:6379> lpush submitted.news 1 (integer) 1 Push IDs instead of the actual data reddit.com example:
  • 14. Sets ● Unordered collections of unique strings ● SADD ● SMEMBERS ● SISMEMBER ● SINTER ○ the intersection between different sets
  • 15. Sorted Sets ● Collections of unique strings with associated score ● ZADD ○ O(log(N)) ● ZRANGE/ZREVRANGE ● ZRANGEBYSCORE
  • 16. ZADD Add a few selected hackers with their year of birth as score 127.0.0.1:6379> zadd hackers 1940 "Alan Kay" (integer) 1 127.0.0.1:6379> zadd hackers 1953 "Richard Stallman" (integer) 1 127.0.0.1:6379> zadd hackers 1965 "Yukihiro Matsumoto" (integer) 1 127.0.0.1:6379> zadd hackers 1916 "Claude Shannon" (integer) 1 127.0.0.1:6379> zadd hackers 1969 "Linus Torvalds" (integer) 1 127.0.0.1:6379> zadd hackers 1912 "Alan Turing" (integer) 1
  • 17. ZRANGE/ZREVRANGE Ask for sorted hackers 127.0.0.1:6379> zrange hackers 0 -1 1) "Alan Turing" 2) "Claude Shannon" 3) "Alan Kay" 4) "Richard Stallman" 5) "Yukihiro Matsumoto" 6) "Linus Torvalds" 127.0.0.1:6379> zrevrange hackers 0 -1 1) "Linus Torvalds" 2) "Yukihiro Matsumoto" 3) "Richard Stallman" 4) "Alan Kay" 5) "Claude Shannon" 6) "Alan Turing"
  • 18. Sorted Set by different ordering ● Use SORT command ○ Server will waste CPU ● Make another sorted set ○ An alternative for having multiple orders is to add every element in multiple sorted sets at the same time.
  • 19. Updating the scores ● Just calling again ZADD
  • 20. Hashes ● HSET ● HGET ● HGETALL ● HKEYS
  • 21. 127.0.0.1:6379> hset users:1 username poby (integer) 1 127.0.0.1:6379> hget users:1 username "poby" 127.0.0.1:6379> hmset users:1 age 10 bestfriend pororo OK 127.0.0.1:6379> hgetall users:1 1) "username" 2) "poby" 3) "age" 4) "10" 5) "bestfriend" 6) "pororo" 127.0.0.1:6379> hkeys users:1 1) "username" 2) "age" 3) "bestfriend" 127.0.0.1:6379> hdel users:1 age (integer) 1 Example Of Hash
  • 24. Demo: Realtime-Info (1) SET realtime-info by Poby
  • 25. Demo: Realtime-Info (2) MGET realtime-info by API
  • 26. 참고 자료 ● Redis - Wikipedia ● Redis - Fast and Furious ● 15 minutes introduction to Redis data types ● The Little Redis Book ● redis.io
  • 27.