The Little Redis Book by Karl Seguin

  • Nothing will help you understand Redis more than actually experiencing it

  • The latest version of Redis: Get Latest Redis

wget http://download.redis.io/releases/redis-3.0.6.tar.gz
tar xzf redis-3.0.6.tar.gz
cd redis-3.0.6
make
  • Start Redis Server: ./redis-server
  • Start Redis Console: ./redis-cli

  • Redis is much more than a simple key-value store

Redis exposes five data structures

Strings Lists Sets Hashes Sorted sets

Keys are how you identify pieces of data

  • Using separator is a common approach people use to organize their keys
    users:hongwei

Values represent the actual data associated with the key

  • Redis treats values as a byte array and doesn’t care what they are
set users:hongwei '{"name":"hongwei", "planet":"earth","likes":["eating"]}'

get users:hongwei

Redis is not suitable for every scenario

Strings

strlen : get the length of a key’s value
getrange : return the specified range of a value
append : append the value to the existing value
incr incrby decr decrby
setbit getbit Wonderful Post