Home > Article > Backend Development > memcached - How to better implement graphic and text live broadcast in php?
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?
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?