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

Where does the data of redis exist?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Is the data of redis stored in memory?

First of all, it is important to 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 in the form of appends or snapshots.

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.

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

String

Hash

List

Set

Sorted set

Pub/sub

Transactions

First of all, a redisObject object is used internally in Redis to represent the most important information of all key and value,redisObject as shown above:

Type represents the specific data type of a value object, and 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, which is turned off by default.

We can find that it is a waste of memory for Redis to use redisObject to represent all key/value data. Of course, the main purpose of these memory management costs is 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.

These are the details of where the redis data is stored, please pay attention to other related articles!

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