Ask a question about how to store chat records

Source: Internet
Author: User
Ask a question about how to store chat records. The background is as follows: a WEB chat program. one of the main functions is the real-time chat between the two parties online, however, this chat record will not be saved in the end. it is stored temporarily when both parties chat, that is, before the chat window is closed, my preliminary design is to temporarily save the latest 300 records.

So the question is: where can I save up to 300 temporary chat records? how can I save them? Are temporary files stored locally, in front-end JS memory, or a MYSQL data table created to continually insert, delete, and update data? Or stored in memory such as MC and SESSION? Or are there other better solutions?

Note that this chat record temporarily displays the content of the current chat only when the chat window is not closed. after the chat window is closed or exited, this chat record is no longer needed.


Reply to discussion (solution)

Private chat?
Yes
1. the problem with js, cookie, and session is that both parties need to save
2. the problem with Memcache lies in the need for third-party software.
3. there are files. The problem is that there are always one-to-one files, which may cause file system management problems.
3. databases should be the first choice. besides, mysql memory tables provide extremely high speeds.

Private chat?
Yes
1. the problem with js, cookie, and session is that both parties need to save
2. the problem with Memcache lies in the need for third-party software.
3. there are files. The problem is that there are always one-to-one files, which may cause file system management problems.
3. databases should be the first choice. besides, mysql memory tables provide extremely high speeds.

I 'd like to know how to compare the memory table of mysql with redis? I have never used a mysql memory table before.

Redis is a key-value pair database, and mysql is a relational database. The two are completely different and cannot be compared.

Redis requires the installation of third-party servers and extensions. Naturally, the corresponding php code is different.
The mysql memory table only has different storage media, and its operation method is no different from other tables. From the php perspective, I just changed the table name.

Redis is a key-value pair database, and mysql is a relational database. The two are completely different and cannot be compared.

Redis requires the installation of third-party servers and extensions. Naturally, the corresponding php code is different.
The mysql memory table only has different storage media, and its operation method is no different from other tables. From the php perspective, I just changed the table name.

Cannot the varchar or text field be stored in the memory table?

Yes, text fields cannot be stored, but the varchar type length is not limited.

Yes, text fields cannot be stored, but the varchar type length is not limited.

That is to say, if I want to store text records, I can only use the varchar type? What is the proper length?

Chat, how long can it be? When are you doing this?
Weibo is limited to 140 words

Chat, how long can it be? When are you doing this?
Weibo is limited to 140 words

Moderator boss, I'm going to try it on Sina SAE. do you think it's okay to use ajax long polling?

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.