Redis

What is Redis

  • Redis is a in-memory data store, used as database, cache and message broker.
  • Redis is NoSQL.
  • Redis is non-volatile, different from memcached. Redis has built-in data persistency to avoid data disappearing from restart.

Commands

  • SCAN: cursor-based
  • MATCH: match pattern
  • CONFIG: related to configuration of the server
  • INFO: related to information of the server
  • COMMAND: return details on redis commands
  • CLIENT: manage clients

Data Types

  • LISTS(Ordered): LPUSH, RPUSH, LRANGE, LLEN, LPOP, RPOP
  • SETS(Unordered, No Repeating): SADD, SREM, SISMEMBER, SMEMBERS, SCARD, SMOVE, SUNION, SDIFF, SRANDOMEMBER, SPOP
  • SORTED SETS(Ordered, Values No Repeating, Scores can repeat): ZADD, ZREM, ZRANGE, ZRANGEBYSCORE, ZRANK, ZCARD, ZCOUNT, ZINCBY, ZSCORE,
  • HASH(Field-Value): HSET, HMSET, HGET, HMGET, HGETALL, HDEL, HEXISITS, HINCBY, HKEYS, HLEN, HVALS, HSTRLEN

Data Persistence(From Memory To Disk)

  • RDB(Redis Database):Point-in-time Snapshots; SAVE, BGSAVE
  • AOF(Append Only File): Write Operation Logging; rewrite, fsync;

Java Client

  • Lettuce;
  • Jedis;