This is the 7th day of my participation in the November Gwen Challenge. Check out the details: The last Gwen Challenge 2021

1. What is Redis

Redis is a non-relational remote memory database, because operations are in memory, so Redis is very fast, very strong performance.

It can store mappings between keys and five different types of values. Can help users solve a variety of problems, directly map data naturally to these five data structures.

With replication, persistence, and client sharding capabilities, Redis can be scaled up to a database of hundreds of GIGABytes, except for very high concurrency. (Among them, the replication feature can expand read performance; Client sharding improves write performance.

Redis also automatically persists database content to hard disk in two different ways to ensure data integrity.

2. Compare three more commonly used databases

(1), Redis

Database type: A non-relational database that uses memory to store data.

Data format: Support string, list, set, hash, ordered set data types.

Query type: Each data type has its own command, batch operation command, partial transaction support

Additional features: master-slave replication, persistence, scripting (stored procedures)

(2), memcached

Database type: in-memory key-value pair cache database

Data format: Mapping between keys and values

Query types: Create, read, update, delete commands, plus several other commands

Additional features: Multi-threaded servers exist for improved performance

(3), Mysql,

Database type: common relational database

Data format: A library contains multiple tables, each table contains multiple rows, multiple table processing

Query types: basic SQL queries, functions, and stored procedures

Additional features: ACID (Innodb) support, master/slave replication + master/master replication

3. Five data structures for REIDS

String (string) : Cannot be repeated
[
    "camellia1":"90"."camellia2":"100"."camellia3":"90"
]
Copy the code
②, list: repeatable
[
    "user": ["camellia1"."camellia2"."camellia1"]]Copy the code
③, set (set) : cannot be repeated
[
    "user": ["camellia1"."camellia2"."camellia3"]]Copy the code
④ Zset (ordered set) : cannot be repeated, and value can only be a number
[
    "user": ["camellia1": 90,"camellia2": 100,"camellia3": 90]]Copy the code
⑤, hash: non-repeatable, value of any type
[
    "user": ["camellia1":"90"."camellia2":"100"."camellia3":"90"]]Copy the code

Above is a basic understanding of Redis, next, will pay attention to its data format to try.

For good suggestions, please enter your comments below.

Welcome to my blog guanchao.site

Welcome to applets: