Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Redis - Key-value store enhanced
Search
Guilherme da Silva Mello
April 20, 2012
Programming
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Redis - Key-value store enhanced
Introduction to some redis data types and manipulation
Guilherme da Silva Mello
April 20, 2012
More Decks by Guilherme da Silva Mello
See All by Guilherme da Silva Mello
Desenvolvimento Ágil de Aplicações WEB
guimello
0
58
Other Decks in Programming
See All in Programming
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
110
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
240
ALB ログから Trace を気合で繋げる技術
fohte
7
890
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
3
330
Family mrubyの進捗
kishima
1
110
Heart of Swift Concurrency
koher
0
360
『寄り添うラジオ』をAIで作る 体験価値から逆算した、会話しないUXと品質設計
theoriatec2024
3
160
業務時間外もAIに働いてもらう話
colorful12
3
10k
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
200
Swift愛好会100回記念 第1回を振り返る
jollyjoester
0
120
Intent as Code
shoppingjaws
6
970
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
450
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.9k
A designer walks into a library…
pauljervisheath
211
25k
Embracing the Ebb and Flow
colly
88
5.2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.8k
ラッコキーワード サービス紹介資料
rakko
1
4.8M
[SF Ruby Conf 2025] Rails X
palkan
2
1.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
Building Applications with DynamoDB
mza
96
7.2k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Transcript
Redis key-value store enhanced
Storing and retrieving > SET what:is:love? "baby ..." > GET
what:is:love? => "baby ..."
Deleting keys > DEL article:1 => 1 | 0
SET-if-not-exists > SETNX video:63:title "The Doors" => 1 | 0
Increment > SET online:users 0 > INCR online:users => 1
> INCR online:users => 2 > GET online:users => 2 > DEL online:users > INCR online:users => 1
Expiring - TTL > SET balance:sheet "<p>$1</p>" > EXPIRE balance:sheet
60 > TTL balance:sheet => 59 > TTL ruby => -1
Lists (Ordered) > RPUSH headlines 86 > RPUSH headlines 77
> LPUSH headlines 458 > LRANGE headlines 0 -1 => ["458", "86", "77"] > LRANGE headlines 1 2 => ["86", "77"]
Lists (cont.) > LLEN headlines => 3 > LPOP headlines
=> "458" > RPOP headlines => "77"
Sets > SADD social:networks twitter > SADD social:networks facebook >
SADD social:networks google+ > SCARD social:networks => 3
Sets (cont.) > SREM social:networks twitter => 1 > SCARD
social:networks => 2 > SISMEMBER social:networks twitter => 0 > SISMEMBER social:networks google+ => 1
Sets (cont.) > SMEMBERS social-networks => ["google+", "facebook"] > SRANDMEMBER
social-networks => ["facebook"]
Sets (cont.) > SADD cool-sites facebook > SINTER social-networks cool-sites
=> ["facebook"]
Sorted Sets (by score) > ZADD languages 10 Ruby >
ZADD languages 9.5 Java > ZADD languages 4 C# > ZRANGE languages 0 -1 => ["C#", "Java", "Ruby"]
Sorted Sets (cont.) > ZREVRANGE languages 0 -1 => ["Ruby",
"Java", "C#"] > ZRANGEBYSCORE languages 5 inf => ["Java", "Ruby"] > ZREVRANGEBYSCORE languages inf 5 WITHSCORES LIMIT 0 10 => ["Ruby", "10", "Java", "9.5"]
Sorted Sets (cont.) > ZSCORE languages Ruby => 10 >
ZCOUNT languages 3 5 => 1 > ZREMRANGEBYRANK languages 0 1 => 2 > ZRANGE languages 0 -1 WITHSCORES => ["Ruby", "10"]
Hashes > HMSET user:45 email
[email protected]
name Guilherme age 27
> HGETALL user:45 => ["email", "
[email protected]
", "name", "Guilherme", "age", "27"]
Hashes (cont.) > HSET user:45 name Mello > HGET user:45
name => Mello
Hashes (cont.) > HLEN user:45 => 3 > HDEL user:45
name > HEXISTS user:45 name => 0 > HKEYS user:45 => ["email", "age"]
> RPUSH numbers 50 > RPUSH numbers 43 > LPUSH
numbers 67 > LRANGE numbers 0 -1 => ["67", "50", "43"] > SORT numbers => ["43", "50", "67"] Sorting
Sorting (cont.) > LPUSH things car > RPUSH things ball
> RPUSH things pen > LRANGE things 0 -1 => ["car", "ball", "pen"] > SORT things ALPHA DESC => ["pen", "car", "ball"]
Sort by external keys > LPUSH account:ids 2 > RPUSH
account:ids 3 > RPUSH account:ids 1 > SET account:2:logins 50 > SET account:3:logins 23 > SET account:1:logins 12
> LRANGE account:ids 0 -1 => ["2", "3", "1"] >
SORT account:ids BY account:*: logins => ["1", "3", "2"] Sort by external keys (cont.)
Retrieving external keys > SET account:1 "dhh" > SET account:2
"tenderlove" > SET account:3 "matz"
Retrieving external keys (cont.) > SORT account:ids BY account:*:logins GET
account:* => ["dhh", "matz", "tenderlove"] > SORT account:ids BY account:*:logins GET account:* GET # => ["dhh", "1", "matz", "3", "tenderlove", "2"]
Storing the result list > SORT account:ids BY account:*:logins GET
account:* GET # STORE account:list > LRANGE account:list 0 -1 => ["dhh", "1", "matz", "3", "tenderlove", "2"]
Sorting and retrieving with hashes > HMSET account:1:profile logins 12
> HMSET account:2:profile logins 50 > HMSET account:3:profile logins 23 > HMSET account:1:hash name dhh > HMSET account:2:hash name tenderlove > HMSET account:3:hash name matz
Sorting and retrieving with hashes (cont.) > SORT account:ids BY
account:*:profile->logins GET account:*:hash->name => ["dhh", "matz", "tenderlove"]
Check out more on http://redis.io or http://lmgtfy.com/?q=redis Thanks!