Applied Redis
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Applied Redis

on

  • 895 views

 

Statistics

Views

Total Views
895
Views on SlideShare
891
Embed Views
4

Actions

Likes
3
Downloads
18
Comments
0

1 Embed 4

https://twitter.com 4

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Applied Redis Presentation Transcript

  • 1. Applied Redis Barcamp Saigon 2012
  • 2. About me @hotrannamKMS Technology
  • 3. take away
  • 4. back to school
  • 5. data structures
  • 6. big O
  • 7. do it right( data model & query performance )
  • 8. redis???
  • 9. data structure server
  • 10. data types
  • 11. #1 strings#2 hashes#3 lists#4 sets#5 sorted sets
  • 12. data examplesKeys Valuespage:index.html <html><head>[…] stringlogin_count 7464users_logged_in_today {1, 2, 3, 4, 5} setlatest_post_ids [201, 204, 205] listuser:123:session time => 10927353 hash username => joeusers_and_scores joe ~ 1348 sorted set fred ~ 938 chris ~ 2832
  • 13. command examplesSET my_key “my value”GET my_keyINCR next_post_idEXPIRE my_key 1234TTL my_keyDEL my_key field valueEXISTS my_key HSET product:1 id 1 HSET product:1 name “iPad” HSET product:1 available 10
  • 14. commandshave its big O ( mostly )
  • 15. and beyond
  • 16. bring to life
  • 17. #1 cache data
  • 18. #2 who is online# add to friends setSADD users:nam:friends duySADD users:nam:friends khoi# add to online setSADD online namSADD online nghiaSADD online khoi# get online friends – {khoi}SINTER users:nam:friends online
  • 19. #3 leaderboard ( ranking )# add to leaderboard (sorted set)ZADD leaderboard <score> <player># get top 5ZREVRANGEBYSCORE leaderboard +inf –infWITHSCORES LIMIT 0 5# get rank of KhoiZREVRANK leaderboard Khoi# get 5 players around KhoiZREVRANGEBYSCORE leaderboard +inf –infWITHSCORES LIMIT 2 5
  • 20. #4 cross-app communication# web appSUBSCRIBE chatPUBLISH chat “Hello! I’m web app.”# mobile appSUBSCRIBE chatPUBLISH chat “Hi! I’m mobile app.”
  • 21. Thank you!