Redis 简明教程

Redis - Overview

Redis 是一款开源的高级键值存储,也是用于构建高性能可扩展 Web 应用程序的极佳解决方案。

Redis is an open source, advanced key-value store and an apt solution for building highperformance, scalable web applications.

Redis 具有使其与众不同的三个主要特点。

Redis has three main peculiarities that sets it apart.

  1. Redis holds its database entirely in the memory, using the disk only for persistence.

  2. Redis has a relatively rich set of data types when compared to many key-value data stores.

  3. Redis can replicate data to any number of slaves.

Redis Advantages

以下是 Redis 的一些优势。

Following are certain advantages of Redis.

  1. Exceptionally fast − Redis is very fast and can perform about 110000 SETs per second, about 81000 GETs per second.

  2. Supports rich data types − Redis natively supports most of the datatypes that developers already know such as list, set, sorted set, and hashes. This makes it easy to solve a variety of problems as we know which problem can be handled better by which data type.

  3. Operations are atomic − All Redis operations are atomic, which ensures that if two clients concurrently access, Redis server will receive the updated value.

  4. Multi-utility tool − Redis is a multi-utility tool and can be used in a number of use cases such as caching, messaging-queues (Redis natively supports Publish/Subscribe), any short-lived data in your application, such as web application sessions, web page hit counts, etc.

Redis Versus Other Key-value Stores

  1. Redis is a different evolution path in the key-value DBs, where values can contain more complex data types, with atomic operations defined on those data types.

  2. Redis is an in-memory database but persistent on disk database, hence it represents a different trade off where very high write and read speed is achieved with the limitation of data sets that can’t be larger than the memory.

  3. Another advantage of in-memory databases is that the memory representation of complex data structures is much simpler to manipulate compared to the same data structure on disk. Thus, Redis can do a lot with little internal complexity.