Table of contents
1. Basic features of redis
2. Redis application scenario
3. Data structure
3.1 string
In redis, there is a kv structure, the key is a string structure at the bottom, and the value includes string, hash, set, sorted set, list, etc.
The data structure in string is as follows. Before 3.2, there were only three parameters: len (character length), free (free space), and buf[] (storage variable)
Three characteristics of string strings in redis
1. Binary safe data structure
The c language uses a \0 to represent the end of the structure such as string str='xxx\0';
2. Provides a memory pre-allocation mechanism to avoid frequent memory allocation
Provide expansion mechanism, algorithm: (len+addlen)*2
3. Function library compatible with C language.
The bottom layer of bitmap uses string, and the maximum length that string can represent is 512M.
The figure below counts weekly active users