How do I enable the user to read the group message?

Source: Internet
Author: User
How do I enable the user to read the group message? Thank you for sending messages to the group. how do you implement read?

Thank you!

Reply content: how does one enable the user to read the group message?

Thank you!

How to select the push and pull modes?

If you select push, it is the easiest way to do this. the data size may be a bit large, but it can be done in a single message table.

If you select pull, in addition to the message Table (msg_id, msg_content), you must have a separate user message Table (uid, msg_id, status ), when you send a message to N users, there will be N records in this table. when you open the message list page, you can view the number of records displayed on each page, search for the content display based on msg_id. if you click it, the status is updated even if you have read it.

Additional points

  1. If you think that the user message table still has a large amount of data, you can split the table by different dimensions. for example, if the old message is not viewed, the table will be split by time, if some users do not view the data, they can split the data based on user activity.

  2. If the read pressure is too high, use redis and memcache to cache each read.

Add a message-when the user's table user reads the page of the message, add the relevant content, and then check the database. if the user has this row, it indicates that the message has been read.
This is a simple implementation logic that can be optimized to reduce the I/O pressure on the database and determine whether repeated operations need to be excluded.

Add a status field in the database to indicate whether the message has been read. when you read the message, update the database status from 0 to 1.
Update A set status = 1 where ID =.

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.