Applied Redis
Upcoming SlideShare
Loading in...5
×
 

Applied Redis

on

  • 853 views

 

Statistics

Views

Total Views
853
Views on SlideShare
849
Embed Views
4

Actions

Likes
3
Downloads
17
Comments
0

1 Embed 4

https://twitter.com 4

Accessibility

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 Applied Redis Presentation Transcript

  • Applied Redis Barcamp Saigon 2012
  • About me @hotrannamKMS Technology
  • take away
  • back to school
  • data structures
  • big O
  • do it right( data model & query performance )
  • redis???
  • data structure server
  • data types
  • #1 strings#2 hashes#3 lists#4 sets#5 sorted sets
  • 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
  • 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
  • commandshave its big O ( mostly )
  • and beyond
  • bring to life
  • #1 cache data
  • #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
  • #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
  • #4 cross-app communication# web appSUBSCRIBE chatPUBLISH chat “Hello! I’m web app.”# mobile appSUBSCRIBE chatPUBLISH chat “Hi! I’m mobile app.”
  • Thank you!