To show how to choose the correct data types, we would like to save the user information of Relp in Redis. As a prototype design verification, we are going to populate some sample data for 10,000 users from Redis to check if we are using the best strategy to store user information in Redis. This means that while satisfying the business needs of the application, we will try to use as little memory as possible. For illustration purposes, the following information will be stored for one user:
- id: user ID
- name: user name
- sex: m/f
- register_time: sign-up timestamp
- nation: the nationality of the user
- We check the memory consumption of an empty Redis instance:
127.0.0.1:6379> INFO MEMORY # Memory used_memory:827512 used_memory_human:808.12K ...