SlideShare a Scribd company logo
Redis with
Spring Data Document
      Sean@Weaveus
         May 2011
•     http://redis.io/

                •     open source

                •     by CitrusByte

                •     sponsored by VMWare




Monday, May 9, 2011                         2
•     key/value store

                •     in memory/persistence




                •     Values

                      •   String, List, Set, Binary, ...

                      •   command by values




                •     speed - faster

                •     replication - master/slave async




Monday, May 9, 2011                                        3
Monday, May 9, 2011   4
Redis Command Client
      // String Type Value

      sean@ubuntu:~$ redis-cli set mykey "my binary safe value"
      OK
      sean@ubuntu:~$ redis-cli get mykey
      my binary safe value



      sean@ubuntu:~$ redis-cli set mykey 100
      OK
      sean@ubuntu:~$ redis-cli incr mykey
      (integer) 101
      sean@ubuntu:~$ redis-cli incrby mykey 10
      (integer) 111




Monday, May 9, 2011                                               5
List
      sean@ubuntu:~$   redis-cli rpush messages "hello"
      OK
      sean@ubuntu:~$   redis-cli rpush messages "fine"
      OK
      sean@ubuntu:~$   redis-cli rpush messages "nosql"
      OK
      sean@ubuntu:~$   redis-cli lrange messages 0 2
      1. hello
      2. fine
      3. nosql
      sean@ubuntu:~$   redis-cli lrange messages 0 -1 // first to end
      1. hello
      2. fine
      3. nosql




Monday, May 9, 2011                                                     6
List with ID
      $ redis-cli      incr next.news.id
      (integer) 1
      $ redis-cli      set news:1:title "Redis is simple"
      OK
      $ redis-cli      set news:1:url "http://code.google.com/p/redis"
      OK
      $ redis-cli      lpush submitted.news 1
      OK



                •     generate unique ID
                •     a new actual data
                •     push new ID of the actual data


Monday, May 9, 2011                                                      7
Set
      sean@ubuntu:~$   redis-cli sadd news:1000:tags 1
      (integer) 1
      sean@ubuntu:~$   redis-cli sadd news:1000:tags 100
      (integer) 1
      sean@ubuntu:~$   redis-cli sadd news:1000:tags 777
      (integer) 1
      sean@ubuntu:~$   redis-cli sadd tags:1:objects 1000
      (integer) 1
      sean@ubuntu:~$   redis-cli sadd tags:100:objects 1000
      (integer) 1
      sean@ubuntu:~$   redis-cli sadd tags:777:objects 1000
      (integer) 1
      sean@ubuntu:~$   redis-cli smembers news:1000:tags
      1. 777
      2. 100
      3. 1
      sean@ubuntu:~$   redis-cli sismember news:1000:tags 5
      (integer) 0



Monday, May 9, 2011                                           8
Set Selection/Union

      sean@ubuntu:~$    redis-cli sadd news:1001:tags 888
      (integer) 1
      sean@ubuntu:~$    redis-cli sadd tags:888:objects 1001
      (integer) 1
      sean@ubuntu:~$    redis-cli sinter tags:777:objects tags:888:objects
      (empty list or    set)
      sean@ubuntu:~$    redis-cli sunion tags:777:objects tags:888:objects
      1. 1000
      2. 1001




Monday, May 9, 2011                                                          9
Sorted Set

      sean@ubuntu:~$   redis-cli zadd hackers 1940 "Alan Kay"
      (integer) 1
      sean@ubuntu:~$   redis-cli zadd hackers 1969 "Linus"
      (integer) 1
      sean@ubuntu:~$   redis-cli zrange hackers 0 -1
      1. Alan Kay
      2. Linus
      sean@ubuntu:~$   redis-cli zrangetbyscore hackers 1900 1950
      1. Alan Kay




Monday, May 9, 2011                                                 10
with Java
      import redis.clients.jedis.Jedis
      Jedis jedis = new Jedis("ubuntu.sean.me")
      println jedis.lrange("messages", 0, -1)

      // Result
      [hello, fine, nosql]




                •     JDBC-Redis
                •     Jedis library - Popular



Monday, May 9, 2011                               11
with Spring
                                   <<interface>>



                      @Autowired
                                     Redis
                                   Operations

                         Bean
                                      Redis
                                    Template


                         Bean
                                     Redis
                                     Driver



Monday, May 9, 2011                                12
Beans




Monday, May 9, 2011           13

More Related Content

Similar to Redis with spring data key value

Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_many
Blazing Cloud
 
Ensuring Quality in Data Lakes (D&D Meetup Feb 22)
Ensuring Quality in Data Lakes  (D&D Meetup Feb 22)Ensuring Quality in Data Lakes  (D&D Meetup Feb 22)
Ensuring Quality in Data Lakes (D&D Meetup Feb 22)
lakeFS
 
MySQL At Yelp
MySQL At YelpMySQL At Yelp
MySQL At Yelp
Yelp Engineering
 
Games for the Masses (Jax)
Games for the Masses (Jax)Games for the Masses (Jax)
Games for the Masses (Jax)
Wooga
 
The Solar Framework for PHP
The Solar Framework for PHPThe Solar Framework for PHP
The Solar Framework for PHP
ConFoo
 
international PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHPinternational PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHP
smueller_sandsmedia
 
Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9
David Calavera
 
Caridy patino - node-js
Caridy patino - node-jsCaridy patino - node-js
Caridy patino - node-js
StarTech Conference
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JS
Caridy Patino
 
Hive sq lfor-hadoop
Hive sq lfor-hadoopHive sq lfor-hadoop
Hive sq lfor-hadoop
Pragati Singh
 
Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)
benwaine
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2
Blazing Cloud
 
ORUG - Sept 2014 - Lesson When Learning Ruby/Rails
ORUG - Sept 2014 - Lesson When Learning Ruby/RailsORUG - Sept 2014 - Lesson When Learning Ruby/Rails
ORUG - Sept 2014 - Lesson When Learning Ruby/Rails
danielrsmith
 
Image and Music: Processing plus Pure Data with libpd library
Image and Music: Processing plus Pure Data with libpd libraryImage and Music: Processing plus Pure Data with libpd library
Image and Music: Processing plus Pure Data with libpd library
PETER KIRN
 
Data processing with celery and rabbit mq
Data processing with celery and rabbit mqData processing with celery and rabbit mq
Data processing with celery and rabbit mq
Jeff Peck
 
Joy of Unix
Joy of UnixJoy of Unix
Joy of Unix
Raman Kannan
 
BlackBerry WebWorks APIs
BlackBerry WebWorks APIsBlackBerry WebWorks APIs
BlackBerry WebWorks APIs
Sencha
 

Similar to Redis with spring data key value (17)

Rails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_manyRails ORM De-mystifying Active Record has_many
Rails ORM De-mystifying Active Record has_many
 
Ensuring Quality in Data Lakes (D&D Meetup Feb 22)
Ensuring Quality in Data Lakes  (D&D Meetup Feb 22)Ensuring Quality in Data Lakes  (D&D Meetup Feb 22)
Ensuring Quality in Data Lakes (D&D Meetup Feb 22)
 
MySQL At Yelp
MySQL At YelpMySQL At Yelp
MySQL At Yelp
 
Games for the Masses (Jax)
Games for the Masses (Jax)Games for the Masses (Jax)
Games for the Masses (Jax)
 
The Solar Framework for PHP
The Solar Framework for PHPThe Solar Framework for PHP
The Solar Framework for PHP
 
international PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHPinternational PHP2011_ilia alshanetsky_Hidden Features of PHP
international PHP2011_ilia alshanetsky_Hidden Features of PHP
 
Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9Rubyspec y el largo camino hacia Ruby 1.9
Rubyspec y el largo camino hacia Ruby 1.9
 
Caridy patino - node-js
Caridy patino - node-jsCaridy patino - node-js
Caridy patino - node-js
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JS
 
Hive sq lfor-hadoop
Hive sq lfor-hadoopHive sq lfor-hadoop
Hive sq lfor-hadoop
 
Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2
 
ORUG - Sept 2014 - Lesson When Learning Ruby/Rails
ORUG - Sept 2014 - Lesson When Learning Ruby/RailsORUG - Sept 2014 - Lesson When Learning Ruby/Rails
ORUG - Sept 2014 - Lesson When Learning Ruby/Rails
 
Image and Music: Processing plus Pure Data with libpd library
Image and Music: Processing plus Pure Data with libpd libraryImage and Music: Processing plus Pure Data with libpd library
Image and Music: Processing plus Pure Data with libpd library
 
Data processing with celery and rabbit mq
Data processing with celery and rabbit mqData processing with celery and rabbit mq
Data processing with celery and rabbit mq
 
Joy of Unix
Joy of UnixJoy of Unix
Joy of Unix
 
BlackBerry WebWorks APIs
BlackBerry WebWorks APIsBlackBerry WebWorks APIs
BlackBerry WebWorks APIs
 

More from Sean Lee

Git rerere
Git rerereGit rerere
Git rerere
Sean Lee
 
Spring data
Spring dataSpring data
Spring data
Sean Lee
 
Cloud foundry practice
Cloud foundry practiceCloud foundry practice
Cloud foundry practice
Sean Lee
 
Mongo db with spring data document
Mongo db with spring data documentMongo db with spring data document
Mongo db with spring data document
Sean Lee
 
ePUB in brief
ePUB in briefePUB in brief
ePUB in brief
Sean Lee
 
트렌드 코리아 2011
트렌드 코리아 2011트렌드 코리아 2011
트렌드 코리아 2011
Sean Lee
 
Future Health Care 3
Future Health Care 3Future Health Care 3
Future Health Care 3
Sean Lee
 
Future Health Care 3
Future Health Care 3Future Health Care 3
Future Health Care 3
Sean Lee
 
미래를 읽는 기술(Future Inc) Pechakucha
미래를 읽는 기술(Future Inc) Pechakucha미래를 읽는 기술(Future Inc) Pechakucha
미래를 읽는 기술(Future Inc) Pechakucha
Sean Lee
 

More from Sean Lee (9)

Git rerere
Git rerereGit rerere
Git rerere
 
Spring data
Spring dataSpring data
Spring data
 
Cloud foundry practice
Cloud foundry practiceCloud foundry practice
Cloud foundry practice
 
Mongo db with spring data document
Mongo db with spring data documentMongo db with spring data document
Mongo db with spring data document
 
ePUB in brief
ePUB in briefePUB in brief
ePUB in brief
 
트렌드 코리아 2011
트렌드 코리아 2011트렌드 코리아 2011
트렌드 코리아 2011
 
Future Health Care 3
Future Health Care 3Future Health Care 3
Future Health Care 3
 
Future Health Care 3
Future Health Care 3Future Health Care 3
Future Health Care 3
 
미래를 읽는 기술(Future Inc) Pechakucha
미래를 읽는 기술(Future Inc) Pechakucha미래를 읽는 기술(Future Inc) Pechakucha
미래를 읽는 기술(Future Inc) Pechakucha
 

Recently uploaded

Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
saastr
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
GDSC PJATK
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
Dinusha Kumarasiri
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Jeffrey Haguewood
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
flufftailshop
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
Pravash Chandra Das
 

Recently uploaded (20)

Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStrDeep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
Deep Dive: Getting Funded with Jason Jason Lemkin Founder & CEO @ SaaStr
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!Finale of the Year: Apply for Next One!
Finale of the Year: Apply for Next One!
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Azure API Management to expose backend services securely
Azure API Management to expose backend services securelyAzure API Management to expose backend services securely
Azure API Management to expose backend services securely
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
Letter and Document Automation for Bonterra Impact Management (fka Social Sol...
 
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdfNunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
Nunit vs XUnit vs MSTest Differences Between These Unit Testing Frameworks.pdf
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
Operating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptxOperating System Used by Users in day-to-day life.pptx
Operating System Used by Users in day-to-day life.pptx
 

Redis with spring data key value

  • 1. Redis with Spring Data Document Sean@Weaveus May 2011
  • 2. http://redis.io/ • open source • by CitrusByte • sponsored by VMWare Monday, May 9, 2011 2
  • 3. key/value store • in memory/persistence • Values • String, List, Set, Binary, ... • command by values • speed - faster • replication - master/slave async Monday, May 9, 2011 3
  • 4. Monday, May 9, 2011 4
  • 5. Redis Command Client // String Type Value sean@ubuntu:~$ redis-cli set mykey "my binary safe value" OK sean@ubuntu:~$ redis-cli get mykey my binary safe value sean@ubuntu:~$ redis-cli set mykey 100 OK sean@ubuntu:~$ redis-cli incr mykey (integer) 101 sean@ubuntu:~$ redis-cli incrby mykey 10 (integer) 111 Monday, May 9, 2011 5
  • 6. List sean@ubuntu:~$ redis-cli rpush messages "hello" OK sean@ubuntu:~$ redis-cli rpush messages "fine" OK sean@ubuntu:~$ redis-cli rpush messages "nosql" OK sean@ubuntu:~$ redis-cli lrange messages 0 2 1. hello 2. fine 3. nosql sean@ubuntu:~$ redis-cli lrange messages 0 -1 // first to end 1. hello 2. fine 3. nosql Monday, May 9, 2011 6
  • 7. List with ID $ redis-cli incr next.news.id (integer) 1 $ redis-cli set news:1:title "Redis is simple" OK $ redis-cli set news:1:url "http://code.google.com/p/redis" OK $ redis-cli lpush submitted.news 1 OK • generate unique ID • a new actual data • push new ID of the actual data Monday, May 9, 2011 7
  • 8. Set sean@ubuntu:~$ redis-cli sadd news:1000:tags 1 (integer) 1 sean@ubuntu:~$ redis-cli sadd news:1000:tags 100 (integer) 1 sean@ubuntu:~$ redis-cli sadd news:1000:tags 777 (integer) 1 sean@ubuntu:~$ redis-cli sadd tags:1:objects 1000 (integer) 1 sean@ubuntu:~$ redis-cli sadd tags:100:objects 1000 (integer) 1 sean@ubuntu:~$ redis-cli sadd tags:777:objects 1000 (integer) 1 sean@ubuntu:~$ redis-cli smembers news:1000:tags 1. 777 2. 100 3. 1 sean@ubuntu:~$ redis-cli sismember news:1000:tags 5 (integer) 0 Monday, May 9, 2011 8
  • 9. Set Selection/Union sean@ubuntu:~$ redis-cli sadd news:1001:tags 888 (integer) 1 sean@ubuntu:~$ redis-cli sadd tags:888:objects 1001 (integer) 1 sean@ubuntu:~$ redis-cli sinter tags:777:objects tags:888:objects (empty list or set) sean@ubuntu:~$ redis-cli sunion tags:777:objects tags:888:objects 1. 1000 2. 1001 Monday, May 9, 2011 9
  • 10. Sorted Set sean@ubuntu:~$ redis-cli zadd hackers 1940 "Alan Kay" (integer) 1 sean@ubuntu:~$ redis-cli zadd hackers 1969 "Linus" (integer) 1 sean@ubuntu:~$ redis-cli zrange hackers 0 -1 1. Alan Kay 2. Linus sean@ubuntu:~$ redis-cli zrangetbyscore hackers 1900 1950 1. Alan Kay Monday, May 9, 2011 10
  • 11. with Java import redis.clients.jedis.Jedis Jedis jedis = new Jedis("ubuntu.sean.me") println jedis.lrange("messages", 0, -1) // Result [hello, fine, nosql] • JDBC-Redis • Jedis library - Popular Monday, May 9, 2011 11
  • 12. with Spring <<interface>> @Autowired Redis Operations Bean Redis Template Bean Redis Driver Monday, May 9, 2011 12