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

How redis data is stored

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how redis data is stored, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to understand it!

Where is the redis data stored?

First of all, we should understand that redis is a database, redis is an in-memory database, all the data is basically stored in memory and will be regularly refreshed to the hard disk by append or snapshot. Because redis is an in-memory database, the speed of reading and writing is very fast, so it is often used to cache data, pages, etc.

Data types commonly used in redis

The most commonly used data types in Redis are as follows:

String

Hash

List

Set

Sorted set

Pub/sub

Transactions

Type represents a value object. What data type is it?

Encoding is how different data types are stored within redis.

For example, type=string represents value to store an ordinary string, then the corresponding encoding can be raw or int, and if int represents the actual redis, the string is stored and represented as a numeric class internally, of course, provided that the string itself can be represented by a numeric value, such as a string like "123,456".

The vm field needs to be specified here. Only when the virtual memory feature of Redis is enabled, this field will actually allocate memory. This function is disabled by default, which will be described later. From the figure above, we can find that it is a waste of memory for Redis to use redisObject to represent all key/value data. Of course, these memory management costs are mainly to provide a unified management interface for different data types of Redis. The actual author also provides a variety of methods to help us save memory as much as possible.

The above is all the content of how redis data is stored, thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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