Message pushing method and device based on cache and computer equipment

By using push task storage queue and ID information status identification to be pushed in Android system, the problem of message loss when the application switches the background is solved, and the reliability and cost-effectiveness of message push is achieved.

CN119052329APending Publication Date: 2024-11-29SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411318276.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

In Android system, when the application is directly killed after switching to the background, the message push function cannot read the messages in the buffer, resulting in message loss, and the existing solution is costly or poorly applicable.

Method used

By establishing a push task storage queue between the server and the application, using ID information and status identifiers to manage messages to be pushed, ensuring that the message is generated after the message is pushed successfully and the messages in the queue are deleted to avoid message loss.

Benefits of technology

It effectively avoids the problem of message loss when the application switches the background, reduces the cost of the push system and improves applicability, ensuring the success rate and user experience of message push.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119052329A_ABST
    Figure CN119052329A_ABST
Patent Text Reader

Abstract

Embodiments of the invention provide a cache-based message pushing method and apparatus, and a computer device. The method comprises the steps of sending login success information to a server so as to enable the server to send a message query request to a pushing task storage queue; receiving each to-be-pushed message fed back by the push task storage queue; updating ID information and state identifiers of the to-be-pushed messages in a locally cached state queue according to the to-be-pushed messages; pushing each message to be pushed according to the ID information and the state identifier; generating a push receipt of each successfully pushed message to be pushed; and the push receipt is fed back to the push task storage queue through the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt. According to the method, after the application successfully pushes the message to be pushed and the server receives the push receipt fed back by the application, the message corresponding to the ID information in the push task storage queue is deleted, so that the message is prevented from being lost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present specification relate to the technical field of data transmission, and in particular to a cache-based message push method, apparatus, and computer device. Background Art

[0002] With the upgrade of Android system, Android 9.0 began to implement power saving strategy and background operation permission restriction, so that the push function of App can only be used when App is opened; and App will also suspend operation after waiting for a period of time when it switches to the background. During the period from when App switches to the background to when it suspends operation, if there is a new message to be pushed, it will be written into the buffer by the system, and the system server will record that the message is pushed successfully; but because App is in the background state at this time, it cannot obtain the right to use the CPU and will not read the message in the buffer. Therefore, if the App that switches to the background is directly killed at this time, the message will no longer be read by App, resulting in loss.

[0003] In view of the above problems, the existing solutions are divided into two categories: the first solution is that mobile phone manufacturers provide official message push channels and build them into the operating system of mobile phones. Push messages are directly processed by the manufacturer's mobile phone system to circumvent restrictions, so that App developers do not need to build their own push systems. However, this solution has the problem of message push success rate. When the message involves limited quotas, sensitive words and sensitive symbols, push failure is prone to occur. In addition, the push systems of different mobile phone manufacturers are independent of each other. Apps need to be accessed according to different mobile phone manufacturers, and the workload of adaptive access is large; if a mature third party is used to integrate the access channels of different manufacturers, it will bring high cost problems. The second solution is other embedded devices equipped with Android systems, such as car machines, medical equipment, etc. These devices are generally industry-specific equipment. Most developers have the ability to modify the system and can directly grant background running permissions to Apps using the push system in the system, so that Apps can run in the background. The problem with this solution is that other special embedded devices equipped with Android systems of mobile phone manufacturers have high system development capabilities. Some small companies do not have the ability to secondary develop the system, so it is difficult to adopt this solution.

[0004] In view of this, the embodiments of this specification aim to provide a cache-based message push method, apparatus and computer device. Summary of the invention

[0005] In view of the above problems in the prior art, the purpose of the embodiments of this specification is to provide a cache-based message push method, apparatus and computer device to solve the problem of message loss in the prior art when an application is switched to the background and is directly killed.

[0006] In order to solve the above technical problems, the specific technical solutions of the embodiments of this specification are as follows:

[0007] In a first aspect, an embodiment of the present specification provides a message push method based on cache, including:

[0008] Sending a login success message to the server so that the server sends a message query request to the push task storage queue;

[0009] Receive each to-be-pushed message forwarded by the server from the push task storage queue;

[0010] Update the status queue of the local cache according to each of the messages to be pushed, wherein the status queue includes the ID information and status identifier of the message to be pushed;

[0011] Pushing each of the messages to be pushed according to the ID information and the status identifier;

[0012] Generate a push receipt for each successfully pushed message to be pushed;

[0013] The push receipt is fed back to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt.

[0014] Specifically, pushing each of the messages to be pushed according to the ID information and the status identifier includes:

[0015] According to the ID information, determine whether the message to be pushed is received for the first time;

[0016] If the message to be pushed is received for the first time, initializing the status flag of the message to be pushed in the status queue to a confirmation flag;

[0017] The message to be pushed is pushed and after the pushing of the message to be pushed is completed, the status flag is updated from the confirmation flag to the push completion flag.

[0018] Furthermore, the method further comprises:

[0019] If the message to be pushed is not received for the first time, determining that the message to be pushed is a repeated received message and determining that a message in the status queue corresponding to the repeated received message is a first received message;

[0020] Determine whether the status identifier of the first received message is a confirmation identifier;

[0021] If yes, push the first received message, generate a push receipt for the first received message after the push is successful, and forward the push receipt to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt;

[0022] If not, a duplicate receipt of the message to be pushed is generated, and the duplicate receipt is fed back to the push task storage queue via the server, so that the push task storage queue deletes the message to be pushed.

[0023] Preferably, the status queue also includes the arrival time of the message to be pushed, and the method further includes:

[0024] According to the arrival time of the message to be pushed and the current time node, determining whether the storage time of each message to be pushed in the status queue reaches a preset time threshold;

[0025] If so, the message to be pushed is deleted from the status queue.

[0026] Specifically, the ID information of the message to be pushed uniquely corresponds to the message to be pushed, and judging whether the message to be pushed is received for the first time according to the ID information is further as follows:

[0027] Determine whether there is a message in the status queue that has the same information ID as the message to be pushed;

[0028] If so, it is determined that the message to be pushed is not received for the first time;

[0029] If it does not exist, it is determined that the message to be pushed is received for the first time.

[0030] Furthermore, the ID information of the message to be pushed uniquely corresponds to the message to be pushed, and increases in sequence according to the storage time in the push task storage queue;

[0031] According to the ID information, it is determined whether the message to be pushed is received for the first time, and further:

[0032] Determine whether there is a message in the status queue that has the same information ID as the message to be pushed;

[0033] If not, determine whether the ID information of the message to be pushed is the maximum value among the ID information of all messages in the status queue;

[0034] If the ID information of the message to be pushed is the maximum value among the ID information of all messages, it is determined that the message to be pushed is received for the first time.

[0035] Specifically, the method further includes:

[0036] If the ID information of the message to be pushed is not the maximum value among the ID information of each message, determining whether the difference between the ID information of the message to be pushed and the maximum value among the ID information of all messages in the status queue is within a preset difference range;

[0037] If yes, it is determined that the message to be pushed is received for the first time;

[0038] If not, it is determined that the message to be pushed is not received for the first time.

[0039] In a second aspect, an embodiment of the present specification provides a message push device based on cache, including:

[0040] A sending module, used for sending a login success message to a server so that the server sends a message query request to a push task storage queue;

[0041] A receiving module, used for receiving each to-be-pushed message forwarded by the server from the push task storage queue;

[0042] An updating module, used for updating a status queue of a local cache according to each of the messages to be pushed, wherein the status queue includes the ID information and status identifier of the message to be pushed;

[0043] A push module, used for pushing each of the messages to be pushed according to the ID information and the status identifier;

[0044] A generation module, used to generate a push receipt for each successfully pushed message to be pushed;

[0045] The feedback module is used to feed back the push receipt to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt.

[0046] In a third aspect, an embodiment of the present specification provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method provided by the above technical solution when executing the computer program.

[0047] In a fourth aspect, an embodiment of the present specification provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method provided by the above technical solution is implemented.

[0048] In a fifth aspect, an embodiment of the present specification provides a computer program product, comprising at least one instruction or at least one program, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the method provided by the above technical solution.

[0049] By adopting the above-mentioned technical scheme, a cache-based message push method, apparatus and computer device are provided in the embodiments of this specification, so that the message corresponding to the ID information in the push task storage queue is deleted only after the application successfully pushes the message to be pushed and the server receives the push receipt fed back by the application, thereby avoiding the problem of message loss caused by deleting the message in the push task storage queue after the server feeds back the message to be pushed to the application, and if the application fails to successfully receive the push message at this time.

[0050] In order to make the above and other purposes, features and advantages of the embodiments of this specification more obvious and easy to understand, the following specifically cites preferred embodiments and describes them in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 A schematic diagram showing the steps of a cache-based message push method provided in an embodiment of this specification;

[0053] Figure 2 A schematic diagram showing the steps of pushing each message to be pushed according to ID information and status identification in an embodiment of this specification;

[0054] Figure 3 A schematic diagram showing the steps of determining whether a message to be pushed is received for the first time according to ID information in an embodiment of this specification;

[0055] Figure 4 A schematic diagram of the structure of a message push device based on cache provided in an embodiment of this specification is shown;

[0056] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of this specification is shown.

[0057] Description of the accompanying symbols:

[0058] 41. Sending module;

[0059] 42. Receiving module;

[0060] 43. Update module;

[0061] 44. Push module;

[0062] 45. Generate module;

[0063] 46. ​​Feedback module;

[0064] 502. Computer equipment;

[0065] 504, processor;

[0066] 506. Memory;

[0067] 508, driving mechanism;

[0068] 510, input / output module;

[0069] 512. Input devices;

[0070] 514. Output device;

[0071] 516. Presentation equipment;

[0072] 518. Graphical user interface;

[0073] 520, network interface;

[0074] 522, communication link;

[0075] 524. Communication bus. DETAILED DESCRIPTION

[0076] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.

[0077] It should be noted that the terms "first", "second", etc. in this specification and claims and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this specification described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0078] The embodiments of this specification provide a cache-based message push method, apparatus and computer device, which can solve the problem in the prior art that the message to be pushed is lost after the application is killed when switching to the background, and the problem that the existing solutions are high in cost and poor in applicability. Figure 1 This is a schematic diagram of the steps of a cache-based message push method provided in an embodiment of this specification. This specification provides method operation steps as described in the embodiment or flowchart, but may include more or fewer operation steps based on conventional or non-creative labor. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or device product is executed, it can be executed in the order or in parallel according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 1 As shown, the method may be executed by an application, and the method may include:

[0079] S110: Sending a login success message to the server so that the server sends a message query request to the push task storage queue.

[0080] In the embodiment of this specification, the push task storage queue can be implemented using redis.

[0081] S120: Receive each to-be-pushed message forwarded by the server from the push task storage queue.

[0082] That is, redis feeds back all the messages to be pushed stored in it to the server, and then the server forwards them to the application.

[0083] S130: updating a status queue of a local cache according to each of the messages to be pushed, wherein the status queue includes ID information and status identifiers of the messages to be pushed.

[0084] In the embodiment of this specification, the status queue is initially an empty linked list. Each time a message to be pushed is received, a node corresponding to the message to be pushed is created in the linked list. In the status queue, each piece of data consists of the ID information, status identifier and arrival time of the message to be pushed, so as to record the processing status of each message to be pushed.

[0085] S140: Pushing each of the messages to be pushed according to the ID information and the status identifier.

[0086] That is, determine whether each message to be pushed needs to be pushed.

[0087] S150: Generate a push receipt for each successfully pushed message.

[0088] That is, for the pending push messages that need to be pushed, a push receipt is generated after the push is completed.

[0089] S160: Feedback the push receipt to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt.

[0090] The cache-based message push method provided in the embodiment of this specification ensures that the message corresponding to the ID information in the push task storage queue will not be deleted until the application successfully pushes the push message and the server receives the push receipt fed back by the application, thereby avoiding the problem of message loss caused by the server deleting the message in the push task storage queue after the server feeds back the push message to the application.

[0091] Furthermore, if Figure 2 As shown, in the embodiment of this specification, step S140: pushing each of the messages to be pushed according to the ID information and the status identifier, includes:

[0092] S210: Determine, based on the ID information, whether the message to be pushed is received for the first time.

[0093] In some feasible embodiments, the ID information of the message to be pushed uniquely corresponds to the message to be pushed, so that whether the message to be pushed is received for the first time is further determined as follows:

[0094] Determine whether there is a message in the status queue that has the same information ID as the message to be pushed;

[0095] If so, it is determined that the message to be pushed is not received for the first time;

[0096] If it does not exist, it is determined that the message to be pushed is received for the first time.

[0097] S220: If the message to be pushed is received for the first time, the status flag of the message to be pushed in the status queue is initialized to a confirmation flag.

[0098] That is, the ID information, status identifier and arrival time of the message to be pushed are initialized in the status queue.

[0099] S230: Push the message to be pushed and update the status flag from a confirmation flag to a push completion flag after the message to be pushed is pushed.

[0100] In the embodiments of this specification, the confirmation mark can be marked with the number 1, and the push completion mark can be marked with the number 2. The above digital markings are only exemplary, and other marking methods can be used in actual applications. It is only necessary to ensure that the confirmation mark and the push completion mark are different.

[0101] Thus, the obtained state queue is shown in Table 1 below.

[0102] Table 1

[0103] ID Information Status indicator Arrival time A 2 1682576254131 …… …… H 2 1684512009217 I 2 1685098251129 J 1 1685170230148

[0104] It should be noted that in the embodiments of this specification, the arrival time of each message in the status queue is the total number of seconds from 00:00:00 Greenwich time on January 1, 1970 (08:00:00 Beijing time on January 1, 1970) to the arrival time.

[0105] Furthermore, the method further comprises:

[0106] S240: If the message to be pushed is not received for the first time, determining that the message to be pushed is a repeatedly received message and determining that a message in the status queue corresponding to the repeatedly received message is a first received message.

[0107] S250: Determine whether the status identifier of the first received message is a confirmation identifier.

[0108] S260: If yes, push the first received message, generate a push receipt for the first received message after the push is successful, and forward the push receipt to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt.

[0109] When the push receipt fed back by the application is not successfully received by the server due to network problems such as weak network or no network, or the pending push message in the push task storage queue is not successfully deleted due to other failures, the server will resend the pending push message to the application. For example, after the application receives the pending push message with ID information J and initializes it in the status queue, it receives the pending push message with ID information J again. Then, the pending push message with ID information J received again will be determined as a duplicate received message, and the message with ID information J in the status queue will be determined as the first received message.

[0110] Then, the status of the first received message in the status queue is obtained. If its status is a confirmation mark (i.e., marked as 1), it indicates that the first received message has not been pushed yet, which may be caused by the application being killed immediately after receiving the first received message, so the first received message needs to be pushed. A corresponding push receipt is generated and fed back to the push task storage queue through the server, so that the push task storage queue deletes the to-be-pushed message with ID information J.

[0111] S270: If not, a duplicate receipt for the message to be pushed is generated, and the duplicate receipt is fed back to the push task storage queue via the server, so that the push task storage queue deletes the message to be pushed.

[0112] For example, if the status of the first received message in the status queue is a push completion mark (i.e., marked as 2), it indicates that the first received message has been pushed, and the receiving of this duplicate received message may be due to the fact that the push receipt for the first received message was not successfully sent to the server due to network problems. Therefore, a duplicate receipt needs to be generated so that the push task storage queue can delete the duplicate received message with ID information J.

[0113] The message push method provided in the embodiments of this specification can not only avoid the loss of messages, but also avoid repeated message push by recording the status of messages by establishing a status queue on the application side, which is beneficial to improving the success rate of message push on the application side and is beneficial to the user experience when the application pushes messages to users.

[0114] In some preferred embodiments, the status queue also includes the arrival time of the message to be pushed, and the method further includes:

[0115] According to the arrival time of the message to be pushed and the current time node, determining whether the storage time of each message to be pushed in the status queue reaches a preset time threshold;

[0116] If so, the message to be pushed is deleted from the status queue.

[0117] By deleting the records of the status queue messages in the local cache on the application side according to the arrival time, the queue is always maintained at a smaller length, which is beneficial to reducing the local cache and is also beneficial to the retrieval efficiency when verifying whether each push message forwarded by the server is received for the first time.

[0118] In some other feasible embodiments, the method may further include:

[0119] According to the arrival time of the message to be pushed and the current time node, determining whether the storage time of each message to be pushed in the status queue reaches a preset time threshold;

[0120] If yes, determining whether the status flag of each message to be pushed is a push completion flag;

[0121] If so, the message to be pushed is deleted from the status queue.

[0122] That is, the messages in the local cache of the application that have exceeded their validity period and have been successfully pushed are deleted to save local cache space while ensuring the success rate of message push.

[0123] When the application receives the message to be pushed fed back by the server and verifies whether the message to be pushed is received for the first time, it is difficult to distinguish whether it is received for the first time or received repeatedly (the first received message in the status queue is cleared because the storage time reaches the preset time threshold). Therefore, in other feasible embodiments, the ID information of the message to be pushed can be made to uniquely correspond to the message to be pushed, and the ID information of the message to be pushed is incremented according to the storage time sequence in the push task storage queue.

[0124] Furthermore, the application status queue is shown in Table 2 below.

[0125] Table 2

[0126] ID Information Status indicator Arrival time 98 2 1692542346321 99 2 1698712225231 100 1 1705664310592

[0127] Thus, if Figure 3 As shown, judging whether the message to be pushed is received for the first time according to the ID information may include the following steps:

[0128] S310: Determine whether there is a message in the status queue that has the same information ID as the message to be pushed.

[0129] S320: If not, determine whether the ID information of the message to be pushed is the maximum value among the ID information of all messages in the status queue.

[0130] S330: If the ID information of the message to be pushed is the maximum value among the ID information of all messages, it is determined that the message to be pushed is received for the first time.

[0131] For example, the messages in the application-side status queue are shown in Table 2. At this time, the application receives a to-be-pushed message with ID information 101 forwarded by the server. Since 101 is greater than the value of the ID information of all messages in the status queue at this time, it is determined that the to-be-pushed message with ID information 101 is received for the first time. For another example, under the premise that the messages in the application-side status queue are shown in Table 2, the application receives a to-be-pushed message with ID information 102 forwarded by the server. Since 102 is greater than the value of the ID information of all messages in the status queue at this time, it is also determined that the to-be-pushed message with ID information 102 is received for the first time.

[0132] S340: If the ID information of the message to be pushed is not the maximum value among the ID information of each message, then the difference between the ID information of the message to be pushed and the maximum value among the ID information of all messages in the status queue is calculated.

[0133] S350: Determine whether the difference is less than or equal to a preset difference threshold.

[0134] When there are multiple messages to be pushed accumulated in the push task storage queue, the order in which the multiple messages to be pushed reach the application cannot be guaranteed during the transmission to the application. For example, there are two messages to be pushed with ID information 101 and 102 accumulated in the push task storage queue. When the server feeds back to the application, the application first receives the message to be pushed with ID information 102 and initially records it in the status queue before receiving the message to be pushed with ID information 101. At this time, it will be judged that the value 101 of the ID information of the message to be pushed is not the maximum value among the ID information of all messages in the status queue (that is, at this time, the maximum value among the ID information of all messages in the status queue is 102, and 101 is less than 102). At this time, if it is determined that the message with ID information 100 is not the first received message, and it is not pushed, it will result in the loss of the message.

[0135] To avoid this situation, in the embodiment of this specification, the difference between the value of the ID information of the message with ID information 101 and the maximum value of the ID information of all messages in the status queue will be calculated, and it will be determined whether the difference is less than or equal to the preset difference threshold.

[0136] S360: If yes, determine that the message to be pushed is received for the first time.

[0137] Exemplarily, the difference threshold can be set to 3. Taking the above example, the calculated difference is 1, which is less than the difference threshold. It is determined that the message with ID information 101 is received for the first time, so it is pushed and processed and a corresponding push receipt is generated.

[0138] S370: Otherwise, it is determined that the message to be pushed is not received for the first time.

[0139] That is, when the difference is greater than the preset difference threshold, or there is a message in the status queue with the same information ID as the message to be pushed, it is determined that the message to be pushed is not received for the first time, and thus, for the message not received for the first time, the following method is used: Figure 2 Steps S240 to S270 are processed.

[0140] The cache-based message push method provided in the embodiment of this specification records the serial number that increases according to time as the ID information of each message to be pushed, so that the application side can identify and push each message to be pushed based on the increasing serial number, which is beneficial to avoid message loss and also beneficial to saving the storage space occupied by the status queue of the local cache on the application side.

[0141] Furthermore, in the embodiment of the present specification, the push task storage queue may also set a TTL (Time To Live) for each message to be pushed stored therein, and determine whether each message to be pushed exceeds its respective TTL. If so, the message to be pushed is deleted.

[0142] The cache-based message push method provided by the embodiment of this specification sets a cache on the application side. When the application is directly killed in the background, the server will adopt a blind message reissue behavior. After the application re-establishes the connection (the user reopens and logs in), the application will select to resend the messages that have not yet been pushed according to the status identifiers of the messages to be pushed recorded in the cached status queue to avoid repeated message pushes; each message in the status queue will be deleted when it exceeds its corresponding storage time to ensure that the status queue is always maintained at a smaller length, which is conducive to improving the retrieval speed; the generation and feedback of the push receipt is an independent module to facilitate horizontal expansion and share the traffic pressure caused by the increase in receipt requests. The TTL timeout limit of the push task storage queue avoids the occurrence of permanent backlogs to generate garbage data. In summary, this method uses the push receipt to confirm the final state of the message to be pushed and uses the status queue with a timeout mechanism to ensure that the local cache size is controllable and that the message will not be pushed repeatedly. Through the mutual cooperation of the above-mentioned mechanisms, the cost of transforming the existing push system can be reduced, and the problem of message loss and damage caused by message retention can be solved.

[0143] Based on the above-mentioned cache-based message push method, the embodiment of this specification also provides a cache-based message push device. The device may include a system (including a distributed system), software (application), module, component, server, client, etc. using the method described in the embodiment of this specification and a device combined with necessary implementation hardware. Based on the same innovative concept, the device in one or more embodiments provided in the embodiment of this specification is as described in the following embodiments. Since the implementation scheme and method of the device to solve the problem are similar, the implementation of the specific device in the embodiment of this specification can refer to the implementation of the aforementioned method, and the repetitions will not be repeated. As used below, the term "unit" or "module" can implement a combination of software and / or hardware for predetermined functions. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0144] like Figure 4 As shown, a message push device based on cache is provided in an embodiment of this specification, including:

[0145] A sending module 41, used for sending a login success message to a server so that the server sends a message query request to a push task storage queue;

[0146] A receiving module 42, configured to receive each to-be-pushed message forwarded by the server from the push task storage queue;

[0147] An updating module 43, configured to update a status queue of a local cache according to each of the messages to be pushed, wherein the status queue includes the ID information and status identifier of the message to be pushed;

[0148] A push module 44, configured to push each of the messages to be pushed according to the ID information and the status identifier;

[0149] A generating module 45, used for generating a push receipt for each of the messages to be pushed that are successfully pushed;

[0150] The feedback module 46 is used to feed back the push receipt to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt.

[0151] The beneficial effects obtained by the device provided in the embodiments of this specification are consistent with the beneficial effects obtained by the above method and will not be repeated here.

[0152] like Figure 5 As shown, a computer device provided in an embodiment of this specification, a message push device based on cache in this specification can be a computer device in this embodiment, executing the above method of this specification. The computer device 502 may include one or more processors 504, such as one or more central processing units (CPUs), and each processing unit may implement one or more hardware threads. The computer device 502 may also include any memory 506, which is used to store any kind of information such as code, settings, data, etc. Non-limiting, for example, the memory 506 may include any one or more combinations of the following: any type of RAM, any type of ROM, flash memory device, hard disk, optical disk, etc. More generally, any memory can use any technology to store information. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 502. In one case, when the processor 504 executes an associated instruction stored in any memory or a combination of memories, the computer device 502 can perform any operation of the associated instruction. The computer device 502 also includes one or more drive mechanisms 508 for interacting with any storage, such as a hard disk drive mechanism, an optical disk drive mechanism, etc.

[0153] The computer device 502 may also include an input / output module 510 (I / O) for receiving various inputs (via input devices 512) and for providing various outputs (via output devices 514). A specific output mechanism may include a presentation device 516 and an associated graphical user interface (GUI) 518. In other embodiments, the input / output module 510 (I / O), the input device 512, and the output device 514 may not be included, and the computer device 502 may be used as a computer device in a network. The computer device 502 may also include one or more network interfaces 520 for exchanging data with other devices via one or more communication links 522. One or more communication buses 524 couple the components described above together.

[0154] The communication link 522 may be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 522 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.

[0155] Corresponding to Figures 1 to 3 In addition to the method shown, an embodiment of the specification also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are executed.

[0156] The embodiment of the present specification also provides a computer-readable instruction, wherein when the processor executes the instruction, the program therein causes the processor to execute the following Figures 1 to 3 The method shown.

[0157] The embodiments of the present specification also provide a computer program product, including at least one instruction or at least one program, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the following Figures 1 to 3 The method shown.

[0158] It should be understood that in the various embodiments of this specification, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this specification.

[0159] It should also be understood that in the embodiments of this specification, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this specification generally indicates that the associated objects before and after are in an "or" relationship.

[0160] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this specification.

[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0162] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.

[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this specification.

[0164] In addition, each functional unit in each embodiment of this specification may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0165] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this specification is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0166] Specific embodiments are used in this specification to illustrate the principles and implementation methods of this specification. The description of the above embodiments is only used to help understand the methods and core ideas of this specification. At the same time, for those skilled in the art, according to the ideas of this specification, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on this specification.

Claims

1. A message push method based on cache, It is characterized in that include: Sending a login success message to the server so that the server sends a message query request to the push task storage queue; Receive each to-be-pushed message forwarded by the server from the push task storage queue; Update the status queue of the local cache according to each of the messages to be pushed, wherein the status queue includes the ID information and status identifier of the message to be pushed; Pushing each of the messages to be pushed according to the ID information and the status identifier; Generate a push receipt for each successfully pushed message to be pushed; The push receipt is fed back to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt.

2. The method according to claim 1, It is characterized in that Pushing each of the messages to be pushed according to the ID information and the status identifier includes: According to the ID information, determine whether the message to be pushed is received for the first time; If the message to be pushed is received for the first time, initializing the status flag of the message to be pushed in the status queue to a confirmation flag; The message to be pushed is pushed and after the pushing of the message to be pushed is completed, the status flag is updated from the confirmation flag to the push completion flag.

3. The method according to claim 2, It is characterized in that The method further comprises: If the message to be pushed is not received for the first time, determining that the message to be pushed is a repeated received message and determining that a message in the status queue corresponding to the repeated received message is a first received message; Determine whether the status identifier of the first received message is a confirmation identifier; If yes, push the first received message, generate a push receipt for the first received message after the push is successful, and forward the push receipt to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt; If not, a duplicate receipt of the message to be pushed is generated, and the duplicate receipt is fed back to the push task storage queue via the server, so that the push task storage queue deletes the message to be pushed.

4. The method according to claim 2, It is characterized in that The status queue also includes the arrival time of the message to be pushed, and the method further includes: According to the arrival time of the message to be pushed and the current time node, determining whether the storage time of each message to be pushed in the status queue reaches a preset time threshold; If so, the message to be pushed is deleted from the status queue.

5. The method according to claim 4, It is characterized in that The ID information of the message to be pushed uniquely corresponds to the message to be pushed, and judging whether the message to be pushed is received for the first time according to the ID information is further: Determine whether there is a message in the status queue that has the same information ID as the message to be pushed; If so, it is determined that the message to be pushed is not received for the first time; If it does not exist, it is determined that the message to be pushed is received for the first time.

6. The method according to claim 4, It is characterized in that The ID information of the message to be pushed uniquely corresponds to the message to be pushed, and increases in sequence according to the storage time in the push task storage queue; According to the ID information, it is determined whether the message to be pushed is received for the first time, and further: Determine whether there is a message in the status queue that has the same information ID as the message to be pushed; If not, determine whether the ID information of the message to be pushed is the maximum value among the ID information of all messages in the status queue; If the ID information of the message to be pushed is the maximum value among the ID information of all messages, it is determined that the message to be pushed is received for the first time.

7. The method according to claim 6, It is characterized in that The method further comprises: If the ID information of the message to be pushed is not the maximum value among the ID information of each message, determining whether the difference between the ID information of the message to be pushed and the maximum value among the ID information of all messages in the status queue is within a preset difference range; If yes, it is determined that the message to be pushed is received for the first time; If not, it is determined that the message to be pushed is not received for the first time.

8. A message push device based on cache, It is characterized in that include: A sending module, used for sending a login success message to a server so that the server sends a message query request to a push task storage queue; A receiving module, used for receiving each to-be-pushed message forwarded by the server from the push task storage queue; An updating module, used for updating a status queue of a local cache according to each of the messages to be pushed, wherein the status queue includes the ID information and status identifier of the message to be pushed; A push module, used for pushing each of the messages to be pushed according to the ID information and the status identifier; A generation module, used to generate a push receipt for each successfully pushed message to be pushed; The feedback module is used to feed back the push receipt to the push task storage queue via the server, so that the push task storage queue deletes the to-be-pushed message corresponding to the push receipt.

9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product, It is characterized in that The method comprises at least one instruction or at least one program, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the method according to any one of claims 1 to 7.