YouTip LogoYouTip

Redis Tutorial - Getting Started

Redis Data Structures

-- Strings
SET name "Alice"
GET name

-- Hash
HSET user:1 name "Alice" age 25
HGETALL user:1

-- List
LPUSH queue "task1" "task2"
RPOP queue

-- Set
SADD tags "js" "py" "go"
SMEMBERS tags

-- Sorted Set
ZADD leaderboard 100 "Alice"
ZREVRANGE leaderboard 0 2 WITHSCORES

Summary

  • Redis supports strings, hashes, lists, sets, sorted sets
  • In-memory for maximum speed
← PostgreSQL Tutorial - Getting MongoDB Tutorial - Getting Sta β†’