Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Data types and advantages of Redis cache database

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "the data types and advantages of Redis cache database". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the data types and advantages of Redis cache database.

Why use Redis when you already have Memcache?

The following disadvantages of Memcache:

Data persistence storage is not supported

Master and slave are not supported

Fragmentation is not supported

Compared to Redis databases, the above three points are supported, so use redis.

Why is redis so fast?

The access speed of Redis can reach 100000 + QPS (querypersecond, number of queries per second).

Based entirely on memory: most of the requests are purely memory operations and are not limited to the hard disk read speed, so the execution efficiency is high.

The data structure is simple, it is (key,value) form, and the operation of the data is also simple.

Using single thread can also handle highly concurrent requests.

Compared with the traditional blocking I _ paw O _ no _ Redis, it uses the multiplex I _ paw O reuse model, and the non-blocking I _ par _ O

It has atomic operation.

The multiplex Istroke O multiplexing function adopted by Redis?

The multiplex functions are: epoll, kqueue, evport, select link: multiplex Icano multiplexing technology.

According to local conditions, some systems only have select.

Give priority to the function with time complexity O (1) as the underlying implementation

Take select with time complexity O (n) as the guarantee.

Listening for Istroke O events based on reactor design pattern

What are the data types of Redis? (key point! )

String: the most basic data type, binary security, can store data in any format (jpg pictures, serialized objects)

A dictionary composed of hash:string elements, suitable for storing objects

List: list, features: FIFO, orderly (in order of addition), repeatable

An unordered collection of set:string elements, implemented through hash, and does not allow repetition

Sortedset: sorts the members of the collection from small to large by scores

HyperLogLog for counting

Used to support Geo for storing geolocation information

The underlying data type foundation of Redis:

1, simple dynamic string; 2, linked list; 3, dictionary; 4, jump table

5. Collection of integers; 6. Compressed list; 7. Objects.

Thank you for your reading, the above is the content of "data types and advantages of Redis cache database". After the study of this article, I believe you have a deeper understanding of the data types and advantages of Redis cache database, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report