Home  >  Article  >  Database  >  Where does redis data exist?

Where does redis data exist?

silencement
silencementOriginal
2019-06-10 09:19:107483browse

Where does redis data exist?

#Where is the redis data stored?

First of all, you must understand that redis is a database. Redis is an in-memory database. All data basically exists in the memory and will be refreshed to the hard disk regularly in the form of appends or snapshots. Because Redis is an in-memory database, so the speed of reading and writing is very fast, so it is often used to cache data, pages, etc.

Commonly used data types 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 specific value object What data type is it?

Encoding is the way different data types are stored inside redis.

For example: type=string means that value is stored as an ordinary string, then the corresponding encoding can It is raw or int. If it is int, it means that the actual redis internally stores and represents the string according to the numerical class. Of course, the premise is that the string itself can be represented by numerical values, such as: "123" "456" such characters string.

The vm field needs special explanation here. Only when the virtual memory function of Redis is turned on can this field actually allocate memory. This function is turned off by default. This function will be described in detail later. From the above figure, we can find that Redis uses redisObject to represent all key/value data, which is a waste of memory. 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 Various methods help us save memory usage as much as possible.

The above is the detailed content of Where does redis data exist?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn