SlideShare a Scribd company logo
1 of 13
Download to read offline
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_manyBlazing 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
 
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 PHPConFoo
 
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 PHPsmueller_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.9David Calavera
 
Conquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSConquistando el Servidor con Node.JS
Conquistando el Servidor con Node.JSCaridy Patino
 
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 - 2Blazing 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/Railsdanielrsmith
 
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 libraryPETER 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 mqJeff Peck
 
BlackBerry WebWorks APIs
BlackBerry WebWorks APIsBlackBerry WebWorks APIs
BlackBerry WebWorks APIsSencha
 

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 rerereSean Lee
 
Spring data
Spring dataSpring data
Spring dataSean Lee
 
Cloud foundry practice
Cloud foundry practiceCloud foundry practice
Cloud foundry practiceSean Lee
 
Mongo db with spring data document
Mongo db with spring data documentMongo db with spring data document
Mongo db with spring data documentSean Lee
 
ePUB in brief
ePUB in briefePUB in brief
ePUB in briefSean Lee
 
트렌드 코리아 2011
트렌드 코리아 2011트렌드 코리아 2011
트렌드 코리아 2011Sean Lee
 
Future Health Care 3
Future Health Care 3Future Health Care 3
Future Health Care 3Sean Lee
 
Future Health Care 3
Future Health Care 3Future Health Care 3
Future Health Care 3Sean Lee
 
미래를 읽는 기술(Future Inc) Pechakucha
미래를 읽는 기술(Future Inc) Pechakucha미래를 읽는 기술(Future Inc) Pechakucha
미래를 읽는 기술(Future Inc) PechakuchaSean 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

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
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
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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)
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

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