Your SlideShare is downloading. ×
  • Like
Applied Redis
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply
Published

 

Published in Technology , Spiritual
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
733
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
18
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

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!