Home > Backend Development > PHP Tutorial > memcached - How to better implement graphic and text live broadcast in php?

memcached - How to better implement graphic and text live broadcast in php?

WBOY
Release: 2016-08-04 09:20:55
Original
959 people have browsed it

The requirement is to implement a graphic and text live broadcast system. When sending live broadcast messages, users can refresh them in real time, and enough (1w) people can refresh the latest live broadcast messages at the same time and view historical messages.

My idea is that every time a live broadcast message is sent, a memcache record is added using the message id as the key after it is stored in the database, and a list of message ids is maintained and put into the memcache. When the user requests, the incoming message id is fetched n ids forward according to the message id list, and then loops n times to fetch n records from memcache and returns them. An error occurred during the process, and the library must regenerate the cache.

Question: Is this possible? Can it meet the demand? Is there a better solution?

Reply content:

The requirement is to implement a graphic and text live broadcast system. When sending live broadcast messages, users can refresh them in real time, and enough (1w) people can refresh the latest live broadcast messages at the same time and view historical messages.

My idea is that every time a live broadcast message is sent, a memcache record is added using the message id as the key after it is stored in the database, and a list of message ids is maintained and put into the memcache. When the user requests, the incoming message id is fetched n ids forward according to the message id list, and then loops n times to fetch n records from memcache and returns them. An error occurred during the process, and the library must regenerate the cache.

Question: Is this possible? Can it meet the demand? Is there a better solution?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template