Original link:http://www.yiibai.com/redis/redis_quick_guide.html
1. Start Redis
$redis-server
2. Check if Redis is working
$redis-CLI
5 data types for 3.Redis: string, hash, list, collection, ordered set
Example:
1) string
Redis 127.0.0.1:6379>SETname "Yiibai"OKRedis 127.0.0.1:6379>GETname"Yiibai"
2) Hash
Redis 127.0.0.1:6379>Hmsetuser:1 username Yiibai password Yiibai pointsOKRedis 127.0.0.1:6379>Hgetalluser:11) "username" 2) "Yiibai" 3) "password" 4) "Yiibai" 5) "points" 6) "
3) List
Redis 127.0.0.1:6379>Lpushtutoriallist Redis(integer) 1Redis 127.0.0.1:6379>Lpushtutoriallist MongoDB(integer) 2Redis 127.0.0.1:6379>Lpushtutoriallist RABITMQ(integer) 3Redis 127.0.0.1:6379>Lrangetutoriallist 01) "RABITMQ" 2) "MongoDB" 3) "Redis"
4) Collection
Redis 127.0.0.1:6379>Saddtutoriallist Redis(integer) 1Redis 127.0.0.1:6379>Saddtutoriallist MongoDB(integer) 1Redis 127.0.0.1:6379>Saddtutoriallist RABITMQ(integer) 1Redis 127.0.0.1:6379>Saddtutoriallist RABITMQ(integer) 0Redis 127.0.0.1:6379>smemberstutoriallist1) "RABITMQ" 2) "MongoDB" 3) "Redis"
5) ordered set
Redis 127.0.0.1:6379>Zaddtutoriallist 0 Redis(integer) 1Redis 127.0.0.1:6379>Zaddtutoriallist 0 MongoDB(integer) 1Redis 127.0.0.1:6379>Zaddtutoriallist 0 RABITMQ(integer) 1Redis 127.0.0.1:6379>Zaddtutoriallist 0 RABITMQ(integer) 0Redis 127.0.0.1:6379>Zrangebyscoretutoriallist 01) "Redis" 2) "MongoDB" 3) "RABITMQ"
Redis Learning Notes