Second-level cache design ideas

Source: Internet
Author: User

Assume that the person with ID = 1 is in three custom groups: group_a, group_ B, and group_c.

Groud_disdeal of dongshi, group_school_123, group_area_2323, group_jiaoyanshi_2343

Others are people who are directly recommended and added to favorites. These may not be recorded as group keys, but they mean one thing.

 

Each group records the last modification time ts. The last modification time ts is to modify the latest time ts when there are modifications (such as deletion, addition, and change, the change time does not need to be consistent with that of the database ts.

When a query is required, check whether the group ID = 1 is added or not. If no,

Obtain the last modified ts of each group separately. If an inconsistency exists, you must re-obtain and update the level 2 Cache. Otherwise, you can directly obtain the Level 2 cache.

In this way, we need to record the personal data of each person during the push, the Ts of the group, the Ts of the East Division, the Ts of the school, and the Ts of the area, these ts can be the time ts during the push, rather than the Ts in any database.

For example, if someone recommends a resource to a person with ID = 1, it is certain that the user with ID = 1 must modify the data ts to the modified time ts. The next request, naturally, you need to obtain it again.

 

This idea of modification is essentially different from that of modifying data.

 

Second-level cache design ideas

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.