Introduction to Redis

May 16, 2021 00:00 Redis

Table of contents

Introduction to Redis

Redis is completely open source free, adheres to the BSD protocol, and is a high-performance key-value database.

Redis and other key-value cache products have three characteristics:

  • Redis supports data persistence, keeping data in memory on disk and loading it again when restarted.
  • Redis not only supports simple key-value type data, but also provides storage of data structures such as list, set, zset, hash, etc.
  • Redis supports the backup of data, which is the master-slave mode.

Redis advantage

  • Very high performance - Redis can read 110,000 times/s and write 81,000 times/s.
  • Rich data types - Redis supports strings, Lists, Hashes, Sets, and Ordered Sets data type operations for binary cases.
  • Atoms - All operations of Redis are atomic, while Redis also supports atomic execution of several operations that are all-in-one.
  • Rich features - Redis also supports features such as publish/subscribe, notifications, key expiration, and more.

What is the difference between Redis and other key-value storage?

  • Redis has more complex data structures and provides atomic operations on them, which is an evolutionary path different from other databases. Redis' data types are based on basic data structures while being transparent to programmers without additional abstraction.
  • Redis runs in memory but can be persisted to disk, so you need to weigh memory when reading and writing at high speeds to different datasets, so the amount of data should not be greater than hardware memory. A nother advantage in memory databases is that they are simple to operate in memory compared to the same complex data structure on disk, so that Redis can do a lot of things that are very internally complex. A t the same time, they are compact in terms of disk formatting and are generated in an appended manner because they do not require random access.