CN107451263B - Method, storage medium, device and system for caching gift panel message - Google Patents

Method, storage medium, device and system for caching gift panel message Download PDF

Info

Publication number
CN107451263B
CN107451263B CN201710642672.6A CN201710642672A CN107451263B CN 107451263 B CN107451263 B CN 107451263B CN 201710642672 A CN201710642672 A CN 201710642672A CN 107451263 B CN107451263 B CN 107451263B
Authority
CN
China
Prior art keywords
message
key
value pair
messages
caching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710642672.6A
Other languages
Chinese (zh)
Other versions
CN107451263A (en
Inventor
张磊
陈少杰
张文明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710642672.6A priority Critical patent/CN107451263B/en
Publication of CN107451263A publication Critical patent/CN107451263A/en
Application granted granted Critical
Publication of CN107451263B publication Critical patent/CN107451263B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/61Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio
    • H04L65/611Network streaming of media packets for supporting one-way streaming services, e.g. Internet radio for multicast or broadcast
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • H04N21/4312Generation of visual interfaces for content selection or interaction; Content or additional data rendering involving specific graphical features, e.g. screen layout, special fonts or colors, blinking icons, highlights or animations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4788Supplemental services, e.g. displaying phone caller identification, shopping application communicating with other users, e.g. chatting

Abstract

The invention discloses a method, a storage medium, equipment and a system for caching gift panel messages, and relates to the technical field of live broadcast software development. The method comprises the following steps: packaging each message which reaches a message receiver into an object of a self-defined message packaging class; caching all the packaged messages into a key value pair set, wherein each packaged message corresponds to one key value pair in the key value pair set, the keys in the key value pairs correspond to the message names of the packaged messages, and the values in the key value pairs correspond to the message bodies of the packaged messages; when the gift panel is clicked, the content of the message required to be used is taken out from the key value pair set, and the interface display of the gift panel is carried out by using the obtained content of the message. The invention can effectively ensure the persistence of the message of the gift panel and avoid the condition that the interface of the gift panel is displayed abnormally.

Description

Method, storage medium, device and system for caching gift panel message
Technical Field
The invention relates to the technical field of live broadcast software development, in particular to a method, a storage medium, equipment and a system for caching gift panel messages.
Background
With the rapid development of mobile terminals, especially mobile terminals of mobile phones, the live broadcast industry is more and more popular, and many users like to watch live broadcasts through mobile terminal devices. While watching the live broadcast, users often give gifts to their favorite anchor broadcasts. Therefore, in the development and design of live broadcast software (such as live fish-fighting software), the function of a gift panel is usually required.
The gift panel is mainly used for placing gifts, and the gift panel is provided with a plurality of view elements, and each view element needs to receive different messages and make different interface state updates. However, the arrival of the message is uncertain, and the message may arrive when the gift panel is not clicked yet, and when we click to open the gift panel, a message with hierarchy arrival is required, and the receiver of the message will trigger the function corresponding to the message only when there is a message. However, there is no message at this time when the gift panel is opened (because the message arrives when the gift panel has not been clicked yet), and therefore, the interface display of the gift panel is abnormal because the latest message cannot be acquired in time.
Disclosure of Invention
The present invention is directed to overcome the above-mentioned drawbacks of the prior art, and provides a method, a storage medium, a device and a system for caching a message on a gift panel, which can effectively ensure persistence of the message on the gift panel and avoid abnormal interface display of the gift panel.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows: there is provided a method of caching gift panel messages, the method comprising the steps of:
s1, packaging of the message: packaging each message which reaches a message receiver into an object of a self-defined message packaging class; the self-defined message encapsulation class comprises a message name and a message body, wherein the message name is used for storing a unique identifier of the message, and the message body is used for storing the specific content of the message;
s2, caching of messages: caching all the packaged messages into a key-value pair set; each packaged message corresponds to one key value pair in the key value pair set, the keys in the key value pairs correspond to the message names of the packaged messages, and the values in the key value pairs correspond to the message bodies of the packaged messages;
s3, obtaining and using of message cache: when the gift panel is clicked, the content of the message needing to be used is taken out from the key value pair set; and using the content of the acquired message to display the interface of the gift panel.
On the basis of the above technical solution, in step S2, caching all the packaged messages into a key-value pair set, specifically including the following operations:
s201, extracting a corresponding message name and a message body from a packaged message;
s202, judging whether the extracted message name is empty or an empty character string, and if so, turning to the step S204; otherwise, go to step S203;
s203, caching the extracted message name into a key of one key-value pair in the key-value pair set; caching the extracted message body into the value of one key-value pair in the key-value pair set;
and S204, repeating the steps S201 to S203 until all the packaged messages are cached in the key-value pair set.
Based on the above technical solution, in step S3, the method for extracting the content of the message to be used from the key-value pair set specifically includes the following operations:
s301, sequentially taking out a key value pair corresponding to a message from the key value pair set;
s302, extracting the message name of the message from the key of the key value pair, comparing the message name with the message name of the message needing to be used, and if the two are consistent, turning to the step S303; if the two are not consistent, go to step S304;
s303, extracting the message body of the message from the value of the key value pair, returning the content in the message body as the content of the message required to be used, and finishing the extraction operation;
s304, judging whether all the key-value pairs corresponding to all the messages in the key-value pair set are taken out, if so, returning the information that the messages needing to be used are not obtained; otherwise, returning to step S301, and continuing to fetch the key-value pair corresponding to the next message.
On the basis of the above technical solution, step S2 further includes the following operations: caching all the packaged messages into a message queue; step S3 further includes the following operations: when the gift panel is clicked, the contents of the message for which the history is to be acquired are taken out from the message queue.
The present invention also provides a storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the above-described method of caching gift panel messages.
The invention also provides a device for caching gift panel messages, which comprises a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor realizes the steps of the method for caching the gift panel messages when executing the computer program.
The invention also provides a system for caching gift panel messages, which comprises a message encapsulation module, a message caching module and a message acquisition and use module;
the message encapsulation module is used for: packaging each message which reaches a message receiver into an object of a self-defined message packaging class; the self-defined message encapsulation class comprises a message name and a message body, wherein the message name is used for storing a unique identifier of the message, and the message body is used for storing the specific content of the message;
the message caching module is used for: caching all the packaged messages into a key-value pair set; each packaged message corresponds to one key value pair in the key value pair set, the keys in the key value pairs correspond to the message names of the packaged messages, and the values in the key value pairs correspond to the message bodies of the packaged messages;
the message acquisition and use module is configured to: when the gift panel is clicked, the content of the message needing to be used is taken out from the key value pair set; and using the content of the acquired message to display the interface of the gift panel.
On the basis of the above technical solution, the specific process of the message caching module caching all the packaged messages into one key-value pair set is as follows:
extracting a corresponding message name and a message body from a packaged message, and judging whether the extracted message name is null or a null character string; if not, caching the extracted message name into a key of one key-value pair in the key-value pair set, and caching the extracted message body into a value of one key-value pair in the key-value pair set; if yes, continuing to cache the next packaged message until all the packaged messages are cached in the key-value pair set.
On the basis of the above technical solution, the specific process of the message obtaining and using module to take out the content of the message to be used from the key-value pair set is as follows:
sequentially taking out a key value pair corresponding to a message from the key value pair set; extracting the message name of the message from the key of the key value pair, comparing the message name with the message name of the message required to be used, if the two are consistent, extracting the message body of the message from the value of the key value pair, returning the content in the message body as the content of the message required to be used, and finishing the extraction operation; if the two are not consistent, judging whether the key value pairs corresponding to all the messages in the key value pair set are all taken out, if so, returning the information of the messages which are not acquired to be used; otherwise, continuously taking out the key value corresponding to the next message for comparison.
On the basis of the above technical solution, the message caching module is further configured to: caching all the packaged messages into a message queue; the message acquisition and use module is further configured to: when the gift panel is clicked, the contents of the message for which the history is to be acquired are taken out from the message queue.
The invention has the beneficial effects that:
(1) the invention utilizes a key value pair set to buffer all messages which reach the message receiver, and the key value pair set can effectively buffer all message data information which is needed to be used in the gift panel. When the gift panel is clicked (opened), the once arrived messages can be directly taken out of the key-value pair set and utilized, and the normal loading and opening of the gift panel are ensured.
Compared with the prior art, the method and the system effectively ensure the persistence function of the message by caching the message, so that the gift panel can be initialized by utilizing the cached message and refresh corresponding data on the gift panel when being opened at any time in the later period, thereby realizing the interface display of the gift panel and effectively avoiding the condition of abnormal interface display of the gift panel.
(2) In the invention, the original message is encapsulated by one layer, and the original message object is encapsulated into a self-defined message encapsulation class object, and the self-defined message encapsulation class object can facilitate the rapid cache and acquisition of the message in the later period. The message name of the customized message package class stores a unique identifier of the message, and different kinds of messages can be distinguished through the unique identifier. Therefore, the type of the message can be known only by reading the message name in the message encapsulation type in the later operation, so that the time overhead of analyzing the specific content of the message is saved, and the program execution speed is improved.
(3) Aiming at the situation that some messages need the historical record information when in use in actual operation, the invention is correspondingly additionally provided with a message queue for caching. When the gift panel is used for displaying the interface, if the message which needs the history information needs to be used, the message can be obtained from the message queue, the condition that the interface of the gift panel is displayed abnormally is further avoided, and the invention has higher applicability and wide application range.
Drawings
FIG. 1 is a flow chart of a method for caching gift panel messages in an embodiment of the invention;
FIG. 2 is a schematic structural diagram of an apparatus for caching gift panel messages according to an embodiment of the present invention;
fig. 3 is a block diagram of a system for caching gift panel messages according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the figures and the embodiments.
Referring to fig. 1, an embodiment of the present invention provides a method for caching gift panel messages, including the following steps:
step S1, encapsulation of message: each message that has arrived at the message receiver is encapsulated into an object of a custom message encapsulation class, which includes two pieces of information (e.g., MsgWrapper): a message name and a message body; the message code is a String type message code and is mainly used for storing a unique identifier of the message, and the unique identifier can distinguish different types of messages; the message body is an Object type information data message, and is mainly used for storing the specific content of the message.
It will be appreciated that there are a wide variety of messages in the gift panel, such as room information messages entering a room, user information messages that a user logs in, room type information messages of the room in which he is located, or barrage information messages in the room, etc. Currently, in order to distinguish the above-mentioned various message types, a scheme is generally adopted in which the distinction is made according to the data content of the message. That is, it is necessary to determine whether the message content is room information or not, or user login information or not. Although this solution can distinguish different messages in principle, the biggest disadvantage is that it needs to judge what each message is, and needs to read and parse the content of the message to know what the message is, which will consume too much judgment time undoubtedly, resulting in slow program execution speed.
In view of the above situation, the embodiment of the present invention designs a self-defined message encapsulation class MsgWrapper, which includes two pieces of information: one is the message name and the other is the message body. The message name stores a unique identifier of the message, and different kinds of messages can be distinguished by the unique identifier. Therefore, in the later operation, the type of the message can be known only by reading the message name in the message encapsulation type MsgWrapper, so that the time overhead of analyzing the specific content of the message is saved, and the program execution speed is improved. In addition, the reason why the message body is the information data message of the Object type and the Object type is used to store the specific content of the message is that the Object is a parent class of all classes, and the parent class Object can be used to receive the child class Object according to the characteristics of the Object-oriented language, so the Object type can be used to receive all kinds of message contents.
Further, in an embodiment, when encapsulating a message into an object of a self-defined message encapsulation class, a generation process of a message name corresponding to each message is as follows: and generating a message name corresponding to each message by calling a Hascode value acquisition function getHashCode in the message. It will be appreciated that each message has a unique HashCode value and that the HashCode of the message is unlikely to be repeatable. Thus, by using the unique characteristic of the HashCode, the HashCode of the message can be used for distinguishing the specific message types. That is, the HashCode of the message is the unique identifier of the message stored in the message name.
Step S2, caching of messages: caching all the packaged messages into a key-value pair set (such as Map); each encapsulated message corresponds to a key value pair, a key in the key value pair corresponds to the message name of the encapsulated message, and a value in the key value pair corresponds to the message body of the encapsulated message.
It will be appreciated that the arrival of the message in the gift panel is uncertain, but when we go to open the gift panel, the message needs some information about the room, the user, etc. Since the message of the related information such as the room and the user may arrive before the gift panel is opened, the message needs to be buffered in order to acquire the message arriving in advance.
In the embodiment of the invention, all packaged messages are cached into a key-value pair set Map, and the key-value pair structure in the key-value pair set Map can correspond to the messages packaged into a self-defined message packaging type MsgWrapper; also, in the key-value pair set Map, the keys are unique (different), and the values may be the same. Wherein a key in the key value pair corresponds to a message name in the message encapsulation class MsgWrapper, and a value in the key value pair corresponds to a message body in the message encapsulation class MsgWrapper. By utilizing the corresponding cache data structure, the cache of the message can be quickly realized, and the corresponding message can be conveniently and quickly acquired in the follow-up process.
Specifically, in one embodiment, the step S2 buffers all the packaged messages into a key-value pair set (e.g., Map), and specifically includes the following operations:
step S201, extracting the corresponding message name and message body from a packaged message (i.e. an object of a message package class MsgWrapper). In actual operation, the information of the message name in the object of the message encapsulation class MsgWrapper can be acquired by calling the message name acquisition function getName.
Step S202, judging whether the extracted message name is null or null character string ("), and if the extracted message name is null or null character string, turning to step S204; otherwise, the process proceeds to step S203.
Step S203, caching the extracted message name into a key of one key value pair in a key value pair set (such as Map); and caching the fetched message body into the value of one key-value pair in the key-value pair set (such as Map). In actual operation, the message name and the message body of a message may be cached in a key value pair of the key-value pair set by calling the key-value pair write function put (key, value).
And step S204, repeating the steps S201 to S203 until all the packaged messages are cached in the key-value pair set (such as Map).
Step S3, obtaining and using of message buffer: when the gift panel is clicked (opened), the content of the message to be used is taken out from the key-value pair set (such as Map); and using the content of the acquired message to display the interface of the gift panel.
Specifically, in one embodiment, the fetching the content of the message to be used from the key-value pair set (e.g., Map) in step S3 specifically includes the following operations:
step S301, sequentially extracting a key-value pair corresponding to a message from a key-value pair set (e.g., Map).
Step S302, the message name of the message is taken out from the key of the key value pair, the message name is compared with the message name of the message needing to be used, and if the message name is consistent with the message name of the message needing to be used, the step S303 is carried out; if they are not the same, the process proceeds to step S304.
Step S303 is to extract the message body of the message from the value of the key value pair, return the content in the message body as the content of the message that needs to be used, and end the extraction operation (that is, end the operation of extracting the content of the message that needs to be used from the set of key value pairs). In practice, the loop operation of fetching messages may be ended by calling the break function.
Step S304, judging whether all the key-value pairs corresponding to all the messages in the key-value pair set are taken out, if so, indicating that the messages needing to be used are not found after traversing all the key-value pairs in the key-value pair set, and returning the information of the messages not needing to be used; otherwise, returning to step S301, and continuing to fetch the key-value pair corresponding to the next message. In actual operation, when information of a message which is not acquired and needs to be used is returned, a null object can be directly returned to indicate that the message which needs to be used is not acquired.
It can be understood that, when the loop operation in steps S301 to S304 is implemented, a For loop statement can be used, which not only has high loop efficiency, but also is simple and convenient to implement.
Further, in practical operation, some messages need their history information when they are used, and messages are overwritten when they are cached by using the key value pair set, that is, messages with the same message name (i.e. messages of the same kind) are overwritten and stored, so we cannot obtain the history information of the messages. In order to solve the problem of acquiring historical messages, a message queue is additionally arranged for buffering. The message queue stores the message needing the history information into the message queue through a push method, and when people take out the message, the message is acquired by calling a pop method. Since all messages are buffered by means of a message queue, messages with the same message name can also be stored as an element in the queue. Thus, in this way all messages of the same kind can be cached in their entirety, i.e. the historical message log information of all messages is cached. Because the gift panel commonly uses two caching mechanisms of the message queue and the key value pair set, when the interface is displayed, if the message needing the history record information needs to be used, the gift panel can be obtained from the message queue, the display efficiency of the interface of the gift panel is improved, and the condition that the interface of the gift panel is displayed abnormally is further avoided.
Based on the above design, in an embodiment, step S2 further includes the following operations: all the packaged messages are buffered in a message queue. On this basis, step S3 further includes the following operations: when the gift panel is clicked (opened), the contents of the message for which the history is to be acquired are taken out from the message queue.
In response to the above method for caching gift panel messages, embodiments of the present invention further provide a storage medium having a computer program stored thereon, where the computer program is executed by a processor, and the computer program can implement the steps of the method for caching gift panel messages in the above embodiments. The storage medium includes various media capable of storing program codes, such as a usb disk, a removable hard disk, a ROM (Read-only Memory), a RAM (Random Access Memory), a magnetic disk, or an optical disk.
In addition, referring to fig. 2, in response to the method for caching the gift panel message, an embodiment of the invention further provides an apparatus for caching the gift panel message, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the method for caching the gift panel message in the foregoing embodiments can be implemented.
Referring to fig. 3, an embodiment of the present invention further provides a system for caching gift panel messages, where the system includes a message encapsulation module, a message caching module, and a message obtaining and using module.
Wherein the message encapsulation module is configured to: packaging each message which reaches a message receiver into an object of a self-defined message packaging class; the self-defined message encapsulation class comprises a message name and a message body, wherein the message name is used for storing the unique identifier of the message, and the message body is used for storing the specific content of the message.
The message caching module is used for: caching all the packaged messages into a key-value pair set; each encapsulated message corresponds to a key value pair in the set of key value pairs, a key in a key value pair corresponds to a message name of the encapsulated message, and a value in a key value pair corresponds to a message body of the encapsulated message. Specifically, the specific process of the message caching module caching all the packaged messages into one key-value pair set is as follows: extracting a corresponding message name and a message body from a packaged message, and judging whether the extracted message name is null or a null character string; if not, caching the extracted message name into a key of one key-value pair in the key-value pair set, and caching the extracted message body into a value of one key-value pair in the key-value pair set; if yes, continuing to cache the next packaged message until all the packaged messages are cached in the key-value pair set.
The message acquisition and use module is used for: when the gift panel is clicked, the content of the message needing to be used is taken out from the key value pair set; and using the content of the acquired message to display the interface of the gift panel. Specifically, the specific process of the message obtaining and using module extracting the content of the message to be used from the key-value pair set includes: sequentially taking out a key value pair corresponding to a message from the key value pair set; extracting the message name of the message from the key of the key value pair, comparing the message name with the message name of the message required to be used, if the two are consistent, extracting the message body of the message from the value of the key value pair, returning the content in the message body as the content of the message required to be used, and finishing the extraction operation; if the two are not consistent, judging whether the key value pairs corresponding to all the messages in the key value pair set are all taken out, if so, returning the information of the messages which are not acquired to be used; otherwise, continuously taking out the key value corresponding to the next message for comparison.
Further, to solve the problem of needing to obtain historical messages, in one embodiment, a message queue is added to buffer all packaged messages. Specifically, the message caching module is further configured to: caching all the packaged messages into a message queue; the message acquisition and use module is further configured to: when the gift panel is clicked, the contents of the message for which the history is to be acquired are taken out from the message queue.
It should be noted that: in the system provided in the foregoing embodiment, when the buffering operation of the message of the gift panel is implemented, only the division of the functional modules is illustrated, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the system is divided into different functional modules to complete all or part of the above described functions.
The present invention is not limited to the above-described embodiments, and it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements are also considered to be within the scope of the present invention.
Those not described in detail in this specification are within the skill of the art.

Claims (8)

1. A method of caching gift panel messages, the method comprising the steps of:
s1, packaging of the message: packaging each message which reaches a message receiver into an object of a self-defined message packaging class; the self-defined message encapsulation class comprises a message name and a message body, wherein the message name is a String type message code and is used for storing a unique identifier capable of distinguishing different types of messages, and the message body is an Object type information data message and is used for storing the specific content of the message; the generation process of the message name corresponding to each message is as follows: generating a message name corresponding to each message by calling a HashCode value in the message to obtain a function getHashCode;
s2, caching of messages: caching all the packaged messages into a key-value pair set; each packaged message corresponds to one key value pair in the key value pair set, the keys in the key value pairs correspond to the message names of the packaged messages, and the values in the key value pairs correspond to the message bodies of the packaged messages;
s3, obtaining and using of message cache: when the gift panel is clicked, the content of the message needing to be used is taken out from the key value pair set; and using the content of the acquired message to display the interface of the gift panel;
step S2 further includes the following operations: caching all the packaged messages into a message queue; step S3 further includes the following operations: when the gift panel is clicked, the contents of the message for which the history is to be acquired are taken out from the message queue.
2. A method of caching gift panel messages as defined in claim 1, wherein: in step S2, caching all the packaged messages into one key-value pair set, which specifically includes the following operations:
s201, extracting a corresponding message name and a message body from a packaged message;
s202, judging whether the extracted message name is empty or an empty character string, and if so, turning to the step S204; otherwise, go to step S203;
s203, caching the extracted message name into a key of one key-value pair in the key-value pair set; caching the extracted message body into the value of one key-value pair in the key-value pair set;
and S204, repeating the steps S201 to S203 until all the packaged messages are cached in the key-value pair set.
3. A method of caching gift panel messages as defined in claim 1, wherein: in step S3, the method for retrieving the content of the message that needs to be used from the key-value pair set specifically includes the following operations:
s301, sequentially taking out a key value pair corresponding to a message from the key value pair set;
s302, extracting the message name of the message from the key of the key value pair, comparing the message name with the message name of the message needing to be used, and if the two are consistent, turning to the step S303; if the two are not consistent, go to step S304;
s303, extracting the message body of the message from the value of the key value pair, returning the content in the message body as the content of the message required to be used, and finishing the extraction operation;
s304, judging whether all the key-value pairs corresponding to all the messages in the key-value pair set are taken out, if so, returning the information that the messages needing to be used are not obtained; otherwise, returning to step S301, and continuing to fetch the key-value pair corresponding to the next message.
4. A storage medium having a computer program stored thereon, characterized in that: the computer program when executed by a processor implements the steps of the method of any of the preceding claims 1 to 3.
5. An apparatus for caching gift panel messages comprising a memory, a processor, and a computer program stored on the memory and running on the processor, wherein: the processor, when executing the computer program, realizes the steps of the method of any of the preceding claims 1 to 3.
6. A system for caching gift panel messages, comprising: the system comprises a message packaging module, a message caching module and a message acquiring and using module;
the message encapsulation module is used for: packaging each message which reaches a message receiver into an object of a self-defined message packaging class; the self-defined message encapsulation class comprises a message name and a message body, wherein the message name is a String type message code and is used for storing a unique identifier capable of distinguishing different types of messages, and the message body is an Object type information data message and is used for storing the specific content of the message; the generation process of the message name corresponding to each message is as follows: generating a message name corresponding to each message by calling a HashCode value in the message to obtain a function getHashCode;
the message caching module is used for: caching all the packaged messages into a key-value pair set; each packaged message corresponds to one key value pair in the key value pair set, the keys in the key value pairs correspond to the message names of the packaged messages, and the values in the key value pairs correspond to the message bodies of the packaged messages;
the message acquisition and use module is configured to: when the gift panel is clicked, the content of the message needing to be used is taken out from the key value pair set; and using the content of the acquired message to display the interface of the gift panel;
caching all the packaged messages into a message queue; the message acquisition and use module is further configured to: when the gift panel is clicked, the contents of the message for which the history is to be acquired are taken out from the message queue.
7. The system for caching gift panel messages of claim 6 wherein the specific process of the message caching module caching all encapsulated messages into a set of key-value pairs is:
extracting a corresponding message name and a message body from a packaged message, and judging whether the extracted message name is null or a null character string;
if not, caching the extracted message name into a key of one key-value pair in the key-value pair set, and caching the extracted message body into a value of one key-value pair in the key-value pair set;
if yes, continuing to cache the next packaged message until all the packaged messages are cached in the key-value pair set.
8. The system for caching gift panel messages of claim 6 wherein the specific process of the message fetch and use module fetching the contents of the message to be used from the set of key-value pairs is:
sequentially taking out a key value pair corresponding to a message from the key value pair set; the message name of the message is taken out from the key of the key value pair, and the message name is compared with the message name of the message required to be used,
if the two are consistent, the message body of the message is taken out from the value of the key value pair, the content in the message body is taken as the content of the message needing to be used to return, and the taking-out operation is finished;
if the two are not consistent, judging whether the key value pairs corresponding to all the messages in the key value pair set are all taken out, if so, returning the information of the messages which are not acquired to be used; otherwise, continuously taking out the key value corresponding to the next message for comparison.
CN201710642672.6A 2017-07-31 2017-07-31 Method, storage medium, device and system for caching gift panel message Active CN107451263B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710642672.6A CN107451263B (en) 2017-07-31 2017-07-31 Method, storage medium, device and system for caching gift panel message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710642672.6A CN107451263B (en) 2017-07-31 2017-07-31 Method, storage medium, device and system for caching gift panel message

Publications (2)

Publication Number Publication Date
CN107451263A CN107451263A (en) 2017-12-08
CN107451263B true CN107451263B (en) 2020-10-16

Family

ID=60489959

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710642672.6A Active CN107451263B (en) 2017-07-31 2017-07-31 Method, storage medium, device and system for caching gift panel message

Country Status (1)

Country Link
CN (1) CN107451263B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108159690A (en) * 2017-12-28 2018-06-15 天脉聚源(北京)科技有限公司 A kind of information storage means and device
CN112069438B (en) * 2020-09-10 2023-12-22 北京五八信息技术有限公司 Message merging method, message processing method and device, equipment and medium
CN114598894A (en) * 2020-12-03 2022-06-07 北京字节跳动网络技术有限公司 Interactive message processing method, device, equipment and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102117338A (en) * 2011-04-02 2011-07-06 天脉聚源(北京)传媒科技有限公司 Data base caching method
CN105791291A (en) * 2016-03-02 2016-07-20 腾讯科技(深圳)有限公司 Display control method for network application and real-time display update method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10521413B2 (en) * 2015-11-20 2019-12-31 Oath Inc. Location-based recommendations using nearest neighbors in a locality sensitive hashing (LSH) index

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102117338A (en) * 2011-04-02 2011-07-06 天脉聚源(北京)传媒科技有限公司 Data base caching method
CN105791291A (en) * 2016-03-02 2016-07-20 腾讯科技(深圳)有限公司 Display control method for network application and real-time display update method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
百万弹幕下的礼物系统:海量并发强事务系统实践;csdn屠敏;《CSDN》;20161012;网页正文部分 *

Also Published As

Publication number Publication date
CN107451263A (en) 2017-12-08

Similar Documents

Publication Publication Date Title
CN107451263B (en) Method, storage medium, device and system for caching gift panel message
CN109117361B (en) Remote debugging method, related equipment and system for small program
CN104573597B (en) A kind of two-dimensional code identification method and device
CN105869005A (en) APP startup advertisement pre-loading method, apparatus and system
CN106095477B (en) Using mounting device and method
CN108920220B (en) Function calling method, device and terminal
CN107562539A (en) Applied program processing method and device, computer equipment, storage medium
CN108197264A (en) Webpage accelerates display methods, device, mobile terminal and storage medium
CN107707618B (en) Method and Related product based on position adjustment download
CN110874301B (en) Method and device for acquiring program pause information
CN106502833A (en) Data back up method and device
CN109525647A (en) Message pushes badge value control method, electronic device and storage medium
CN109126124B (en) Engine adaptation method, related device and computer readable storage medium
CN107743080B (en) Flow statistical method and device, computer equipment, computer readable storage medium
US8910240B1 (en) Mapping content using uniform resource identifiers
CN110770716A (en) Association word recommendation method, mobile terminal and computer-readable storage medium
CN103761020A (en) Shortcut navigating method and device
CN111723115A (en) Data statistics method, device, terminal and storage medium based on multi-level cache
CN110717126A (en) Page browsing method and device, electronic equipment and computer readable storage medium
CN108009226B (en) Promotion content display implementation method based on intelligent terminal application and intelligent terminal
CN109316751A (en) Game adaptation method, relevant device and computer readable storage medium
CN108459884A (en) Closing application program method, apparatus, storage medium and electronic equipment
CN106528188B (en) It is a kind of to apply accelerating method and device
CN103714291A (en) Information processing method and electronic equipment
CN111159244B (en) Data query method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant