Method for quickly constructing message push service based on Redis cache

By integrating Redis cache middleware, the system load and delay problems in traditional message push methods are solved, efficient and stable message push services are achieved, and real-time and accuracy are improved.

CN119449754APending Publication Date: 2025-02-14BEIJING TESTOR TECH
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411376612.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-30
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Traditional message push methods require frequent query of databases, resulting in system load and delay, which cannot guarantee fast, efficient and stable information push, and low accuracy, waste network resources and reduce user experience.

Method used

By integrating Redis cache middleware, we receive and cache message push requests, query push messages to obtain target users, and use Redis's fast read and write performance to achieve real-time push.

Benefits of technology

Improve the real-time and accuracy of message push, reduce system load and latency, and ensure the stability and scalability of message push services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119449754A_ABST
    Figure CN119449754A_ABST
Patent Text Reader

Abstract

The invention provides a method for quickly constructing a message push service based on Redis cache. The method comprises the following steps: step 1, integrating Redis cache middleware; 2, receiving a message push request based on the Redis cache middleware, and caching a push message according to the Redis cache middleware; 3, querying the cached push message according to the Redis cache middleware to obtain a target user, and pushing the push information to the target user based on the Redis cache middleware; the method is simple in implementation mode, is suitable for message pushing scenes of various scales, and provides powerful support for quickly constructing efficient and stable message pushing services.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of message push technology, and in particular to a method for quickly building a message push service based on Redis cache. Background Art

[0002] At present, with the continuous development of Internet technology and computers, message push service plays an important role in modern application systems; it can push information to users in real time, improve user experience and system responsiveness;

[0003] However, traditional message push methods usually require frequent queries to databases or other data storage, which leads to system load and delays, and thus cannot guarantee fast, efficient, and stable information push, resulting in low accuracy of message push, and a large amount of network resources is wasted, which reduces the efficiency of message push and is not conducive to improving user experience;

[0004] Therefore, in order to overcome the above technical problems, the present invention provides a method for quickly building a message push service based on Redis cache. Summary of the invention

[0005] The present invention provides a method for quickly building a message push service based on Redis cache, which is used to effectively receive and cache message push requests by integrating Redis cache middleware, and effectively obtain target users by querying push messages, thereby realizing accurate and fast push of push information to target users based on Redis cache middleware; the method not only improves the real-time and accuracy of message push, but also reduces the load and delay of the system; at the same time, through Redis cache middleware, the stability and scalability of the message push service can be ensured; the implementation method of the present invention is simple, suitable for message push scenarios of various scales, and provides strong support for quickly building efficient and stable message push services.

[0006] A method for quickly building a message push service based on Redis cache, comprising:

[0007] Step 1: Integrate Redis cache middleware;

[0008] Step 2: Accept the message push request, confirm the push message, and cache the push message according to the Redis cache middleware;

[0009] Step 3: Query the cached push message according to the Redis cache middleware, obtain the target user, and push the push information to the target user based on the Redis cache middleware.

[0010] Preferably, a method for quickly building a message push service based on Redis cache, in step 1, integrating Redis cache middleware, includes:

[0011] First configure the operating environment for Redis;

[0012] Obtain the message push service attributes, determine the relevant database of Redis according to the message push service attributes, and introduce the relevant database into Redis to complete the second configuration;

[0013] Perform the third configuration for Redis connection information;

[0014] Create a client object in Redis and complete the fourth configuration based on the creation result;

[0015] Perform the fifth configuration for Redis cache operation;

[0016] Integrate the Redis cache middleware according to the first configuration result, the second configuration result, the third configuration result, the fourth configuration result and the fifth configuration result.

[0017] Preferably, a method for quickly building a message push service based on Redis cache, in step 2, accepting a message push request, determining a push message, and caching the push message according to the Redis cache middleware, includes:

[0018] Receive a message push request, and parse the message push request based on the processor to determine the information address of the message source and the push information;

[0019] Establish a connection between the information push terminal and the Redis cache middleware according to the information address of the message source;

[0020] Based on the connection result, the push information is received according to the Redis cache middleware, and the push information is cached according to the preset method.

[0021] Preferably, a method for quickly building a message push service based on Redis cache, caching push information according to a preset method, includes:

[0022] Read the preset method to determine the data storage structure and data caching strategy;

[0023] Convert the push information into a format according to the data storage structure to obtain the first target push information;

[0024] Based on the data cache strategy, the Redis cache middleware is configured to cache the push information for a certain period of time and a certain cache memory size. At the same time, the first target push information is compressed according to the cache memory size to obtain the second target push information.

[0025] The second target push information is cached in the Redis cache according to the cache duration.

[0026] Preferably, a method for quickly building a message push service based on Redis cache, in step 2, before caching the push message according to the Redis cache middleware, also includes:

[0027] Obtain information data corresponding to the push information based on Redis cache middleware;

[0028] Retrieve the historical cache event set in the Redis cache middleware;

[0029] Preprocessing the information data corresponding to the pushed information to obtain a plurality of word item data in the information data, and creating an index item for each word item data, wherein the index item includes: each word item data and the position of each word item data in the information data;

[0030] The historical cache events are traversed centrally according to the index items, and the reading or caching of the push messages in the Redis cache middleware is completed based on the traversal results.

[0031] Preferably, a method for quickly building a message push service based on Redis cache, completing the reading or caching of push messages in Redis cache middleware based on the traversal results, includes:

[0032] Based on the traversal results, the historical cache data in the historical cache event set that is consistent with the index item is marked, and the marked data set in each historical cache event is determined;

[0033] Obtain the target ratio of the marked data set in each historical cache event to the total data set of the corresponding historical cache event;

[0034] Obtain target historical cache events corresponding to target ratios greater than a preset ratio threshold;

[0035] Calculate the content similarity of multiple word items in the tag data set and the information data in the target historical cache event;

[0036] Get the position of the marked dataset in the target historical cache event;

[0037] Based on the position similarity between the position of the labeled dataset in the target historical cache event and the position of each term data in the information data;

[0038] Determine the total similarity between the push information and the target historical cache event based on the content similarity and the location similarity;

[0039] Compare the total similarity between the push information and the target historical cache event with the preset similarity threshold to determine whether there is a corresponding push message in the Redis cache middleware;

[0040] If it exists, the push message is read based on the Redis cache middleware;

[0041] If it does not exist, the push message is cached based on the Redis cache middleware.

[0042] Preferably, a method for quickly building a message push service based on Redis cache, in step 3, querying the cached push message according to the Redis cache middleware, obtaining the target user, and pushing the push information to the target user based on the Redis cache middleware, including:

[0043] Read the cached push message based on Redis cache middleware to determine the push target corresponding to the push message;

[0044] Based on the push target, the user information is queried in the Redis cache middleware, and the target user that matches the push message is matched based on the query result;

[0045] Push information to target users based on Redis cache middleware.

[0046] Preferably, a method for quickly building a message push service based on Redis cache, pushing push information to target users based on Redis cache middleware, includes:

[0047] Obtain the target user's information reading requirements, and parse the push information based on the information reading requirements to determine the key fields of the push information. At the same time, split the push information according to the key fields of the push information to obtain several sub-push information segments;

[0048] Constructing a push tag corresponding to the sub-push information segment according to the key field, and encapsulating the sub-push information segment according to the push tag to obtain an information package to be pushed, wherein the information package to be pushed includes: the push tag, the sub-push information segment and the key field;

[0049] The push order of each information package to be pushed is determined based on the information reading requirements, and each information package to be pushed is pushed to the target user in the push order based on the Redis cache middleware.

[0050] Preferably, a method for quickly building a message push service based on Redis cache, in step 2, caching the push message according to the Redis cache middleware, includes:

[0051] Read the push information, determine the information content of the push information, and determine the content structure of the push information according to the information content of the push information;

[0052] Designing a data storage structure in the Redis cache middleware based on the content structure of the push information, and generating a first cache strategy according to the data storage structure;

[0053] Read the historical data caching process of the Redis cache middleware, obtain the cache monitoring indicators of the historical data caching process, and determine the optimal cache state of the Redis cache middleware under each cache monitoring indicator;

[0054] Generate a dynamic cache space adjustment strategy based on the optimal cache status of the Redis cache middleware under each cache monitoring indicator;

[0055] The Redis cache middleware is divided into multiple Redis nodes, and a working master node and a working slave node are allocated to the Redis nodes based on the working attributes of the Redis cache middleware. At the same time, a collaborative relationship between the working master node and the working slave node is determined according to the working attributes of the Redis cache middleware, and a second cache strategy is generated according to the collaborative relationship;

[0056] A comprehensive cache strategy for the push message is generated based on the first cache strategy, the dynamic cache space adjustment strategy, and the second cache strategy, and the push information is cached according to the comprehensive cache strategy based on the Redis cache middleware.

[0057] Preferably, a method for quickly building a message push service based on Redis cache, after pushing the push information to the target user based on Redis cache middleware, also includes:

[0058] Read the push information sent to the target user, determine the type of the push information, and obtain the user code of the target user;

[0059] Retrieving a preset historical information push library, and performing a first search in the historical information push library according to the user code of the target user, and retrieving the historical information push document of the target user in the preset historical information push library according to the search result;

[0060] Performing a second search in the historical information push documents according to the information type of the push information to determine the push frequency to the target user in the current information type;

[0061] Determine the target user's satisfaction with the pushed information based on the push frequency of the target user, and compare the satisfaction with a preset satisfaction threshold;

[0062] When the satisfaction level is greater than or equal to the preset satisfaction level threshold, the information type of the pushed information is associated with the user code of the target user, and the associated result is stored in the Redis cache middleware;

[0063] Otherwise, the information type of the pushed information is not associated with the user code of the target user.

[0064] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures specifically pointed out in this application document.

[0065] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0067] Figure 1 This is a flow chart of a method for quickly building a message push service based on Redis cache in an embodiment of the present invention;

[0068] Figure 2 This is a flowchart of step 2 in a method for quickly building a message push service based on Redis cache in an embodiment of the present invention;

[0069] Figure 3 This is a flowchart of step 3 in a method for quickly building a message push service based on Redis cache in an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0071] Embodiment 1:

[0072] This embodiment improves a method for quickly building a message push service based on Redis cache, such as Figure 1 As shown, including:

[0073] Step 1: Integrate Redis cache middleware;

[0074] Step 2: Accept the message push request based on the Redis cache middleware, and cache the push message according to the Redis cache middleware;

[0075] Step 3: Query the cached push message according to the Redis cache middleware, obtain the target user, and push the push information to the target user based on the Redis cache middleware.

[0076] In this embodiment, by integrating Redis as a message cache and middleware, efficient message storage, retrieval and push are achieved.

[0077] In this embodiment, by utilizing the fast read and write performance of Redis, the method can quickly store the message into the Redis cache when receiving a message push request, and push the message to the target user in real time through the Redis publish / subscribe mode or key-value pair query.

[0078] In this embodiment, querying the cached push message may be performed through a publish / subscribe mode or a key-value pair query.

[0079] The working principle and beneficial effects of the above technical solution are: by integrating Redis cache middleware, the reception and caching of message push requests can be effectively realized, and by querying the push messages, the target users can be effectively obtained, and then the push information can be accurately and quickly pushed to the target users based on Redis cache middleware; this method not only improves the real-time and accuracy of message push, but also reduces the load and delay of the system; at the same time, through Redis cache middleware, the stability and scalability of the message push service can be ensured; the implementation method of the present invention is simple, suitable for message push scenarios of various scales, and provides strong support for the rapid construction of efficient and stable message push services.

[0080] Embodiment 2:

[0081] Based on Example 1, this embodiment provides a method for quickly building a message push service based on Redis cache. In step 1, Redis cache middleware is integrated, including:

[0082] First configure the operating environment for Redis;

[0083] Obtain the message push service attributes, determine the relevant database of Redis according to the message push service attributes, and introduce the relevant database into Redis to complete the second configuration;

[0084] Perform the third configuration for Redis connection information;

[0085] Create a client object in Redis and complete the fourth configuration based on the creation result;

[0086] Perform the fifth configuration for Redis cache operation;

[0087] Integrate the Redis cache middleware according to the first configuration result, the second configuration result, the third configuration result, the fourth configuration result and the fifth configuration result.

[0088] In this embodiment, the first configuration is used to configure the operating environment of Redis, that is, to install the Redis server.

[0089] In this embodiment, the message push service attributes may include: a relevant database for message push and the like, wherein the relevant database may include: push content, push method, data type and other information.

[0090] In this embodiment, the connection information may include: the address, port, password, etc. of the Redis server.

[0091] In this embodiment, the client object may be a message push terminal or device.

[0092] In this embodiment, the cache operation may include: cache setting, acquisition, deletion and other operations.

[0093] The working principle and beneficial effect of the above technical solution are: by configuring the Redis operating environment, related databases, connection information, client objects, and cache operations, the Redis cache middleware is effectively integrated, laying the foundation for subsequent message promotion.

[0094] Embodiment 3:

[0095] Based on Example 1, this example provides a method for quickly building an information push service based on Redis cache, such as Figure 2 As shown, in step 2, the message push request is accepted, the push message is determined, and the push message is cached according to the Redis cache middleware, including:

[0096] S201: receiving a message push request, and parsing the message push request based on a processor to determine the information address of the message source and the push information;

[0097] S202: Establishing a connection between the information push terminal and the Redis cache middleware according to the information address of the message source;

[0098] S203: receiving the push information according to the Redis cache middleware based on the connection result, and caching the push information according to a preset method.

[0099] In this embodiment, the information source is the information push terminal that generates the push information, wherein the information address of the information source is the address code of the information push terminal.

[0100] In this embodiment, the preset method may be a data storage structure and a data caching strategy for caching push information based on Redis cache middleware, wherein the data caching strategy may include a cache duration and a cache memory size for the push information.

[0101] The working principle and beneficial effects of the above technical solution are: receiving and parsing through message push requests, so as to effectively obtain the information address and push information of the message source, thereby establishing a connection between the information push terminal and the Redis cache middleware according to the information address of the message source, and then receiving the push information according to the Redis cache middleware through the connection result, and caching the push information based on a preset method, thereby improving the accuracy of the push information reception cache, thereby improving the caching rate of the push information based on the Redis cache middleware.

[0102] Embodiment 4:

[0103] Based on Example 3, this embodiment provides a method for quickly building an information push service based on Redis cache, caching the push information according to a preset method, including:

[0104] Read the preset method to determine the data storage structure and data caching strategy;

[0105] Convert the push information into a format according to the data storage structure to obtain the first target push information;

[0106] Based on the data cache strategy, the Redis cache middleware is configured to cache the push information for a certain period of time and a certain cache memory size. At the same time, the first target push information is compressed according to the cache memory size to obtain the second target push information.

[0107] The second target push information is cached in the Redis cache according to the cache duration.

[0108] In this embodiment, the first target push information may be the push information obtained by converting the format of the push information according to the data storage structure.

[0109] In this embodiment, the second target push information may be push information obtained by compressing the first target push information.

[0110] The working principle and beneficial effects of the above technical solution are: by converting the format of push information through the data storage structure, the reading efficiency and cache rate of push information based on the Redis cache middleware can be effectively guaranteed. By configuring the cache duration and cache memory size of push information by the Redis cache middleware based on the data cache strategy, the working stability of the Redis cache middleware can be effectively guaranteed, and the cache load and delay of the Redis cache middleware can be reduced.

[0111] Embodiment 5:

[0112] Based on Example 1, this embodiment provides a method for quickly building an information push service based on Redis cache. In step 2, before caching the push message according to the Redis cache middleware, the method further includes:

[0113] Obtain information data corresponding to the push information based on Redis cache middleware;

[0114] Retrieve the historical cache event set in the Redis cache middleware;

[0115] Preprocessing the information data corresponding to the pushed information to obtain a plurality of word item data in the information data, and creating an index item for each word item data, wherein the index item includes: each word item data and the position of each word item data in the information data;

[0116] The historical cache events are traversed centrally according to the index items, and the reading or caching of the push messages in the Redis cache middleware is completed based on the traversal results.

[0117] In this embodiment, the preprocessing of the information data corresponding to the push information can be to identify the separator symbols (such as commas, periods, etc.) in the information data and divide the information data according to the identification results, and then determine the word data (i.e., the vocabulary in the push information) according to the relationship between the information data.

[0118] In this embodiment, the index item may be used to implement similarity traversal of the historical cache event set to obtain historical cache data consistent with the index item in the historical cache event set.

[0119] In this embodiment, the reading or caching of the push message in the Redis cache middleware is completed based on the traversal result, including:

[0120] Based on the traversal results, the historical cache data in the historical cache event set that is consistent with the index item is marked, and the marked data set in each historical cache event is determined;

[0121] Obtain the target ratio of the marked data set in each historical cache event to the total data set of the corresponding historical cache event;

[0122] Obtain the target historical cache events corresponding to the target ratio being greater than a preset ratio threshold (set in advance and used to measure whether it is a target historical event);

[0123] Calculate the content similarity of multiple word items in the tag data set and the information data in the target historical cache event;

[0124] Get the position of the marked dataset in the target historical cache event;

[0125] Based on the position similarity between the position of the labeled dataset in the target historical cache event and the position of each term data in the information data;

[0126] Determine the total similarity between the push information and the target historical cache event based on the content similarity and the location similarity;

[0127] Compare the total similarity between the push information and the target historical cache event with the preset similarity threshold (set in advance) to determine whether there is a corresponding push message in the Redis cache middleware;

[0128] If it exists, the push message is read based on the Redis cache middleware;

[0129] If it does not exist, the push message is cached based on the Redis cache middleware.

[0130] The working principle and beneficial effects of the above technical solution are: by obtaining the information data corresponding to the push information and preprocessing the information data corresponding to the push information, the determination of multiple term data in the information data is effectively realized, thereby realizing the creation of index items, and by traversing the index items in the corresponding historical cache event set, the position similarity between the position of the marked data set in the target historical cache event and the position of each term data in the information data and the content similarity between the marked data set in the target historical cache event and the multiple term data in the information data are calculated through the traversal results, thereby determining the total similarity to determine whether there is a corresponding push message in the Redis cache middleware, effectively realizing the determination of the push message based on the Redis cache middleware, thereby avoiding the caching of repeated push messages based on the Redis cache middleware, and effectively improving the working efficiency of the Redis cache middleware.

[0131] Embodiment 6:

[0132] Based on Example 1, this example provides a method for quickly building a message push service based on Redis cache, such as Figure 3 As shown, in step 3, the cached push message is queried according to the Redis cache middleware to obtain the target user, and the push information is pushed to the target user based on the Redis cache middleware, including:

[0133] S301: Read the cached push message based on the Redis cache middleware to determine the push target corresponding to the push message;

[0134] S302: Querying user information in the Redis cache middleware based on the push target, and matching the target user that matches the push message based on the query result;

[0135] S303: Push the push information to the target user based on the Redis cache middleware.

[0136] The working principle and beneficial effect of the above technical solution are: by determining the push target, the user information is queried based on the Redis cache middleware, and then the target user is matched, which effectively improves the accuracy of locking the target user and ensures the accuracy of pushing information.

[0137] Embodiment 7:

[0138] Based on Example 6, this embodiment provides a method for quickly building a message push service based on Redis cache, and pushes push information to target users based on Redis cache middleware, including:

[0139] Obtain the target user's information reading requirements, and parse the push information based on the information reading requirements to determine the key fields of the push information. At the same time, split the push information according to the key fields of the push information to obtain several sub-push information segments;

[0140] Constructing a push tag corresponding to the sub-push information segment according to the key field, and encapsulating the sub-push information segment according to the push tag to obtain an information package to be pushed, wherein the information package to be pushed includes: the push tag, the sub-push information segment and the key field;

[0141] The push order of each information package to be pushed is determined based on the information reading requirements, and each information package to be pushed is pushed to the target user in the push order based on the Redis cache middleware.

[0142] In this embodiment, the key field may be, for example, the title of the push information, which is determined by the information reading requirement, that is, the title of the information that the user needs to read, and the title of the information that the user needs to read is matched with the push information to obtain the corresponding title of the push information.

[0143] In this embodiment, the information reading requirement includes: information reading content, information reading title, and a reading order corresponding to each information reading title.

[0144] In this embodiment, the push tag may be a representation identifier representing the sub-push information segment.

[0145] The beneficial effect of the above technical solution is: effectively achieving the accuracy and orderliness of pushing the push information, thereby improving the push efficiency of the push information based on the Redis cache middleware.

[0146] Embodiment 8:

[0147] Based on Example 1, this embodiment provides a method for quickly building a message push service based on Redis cache. In step 2, the push message is cached according to the Redis cache middleware, including:

[0148] Read the push information, determine the information content of the push information, and determine the content structure of the push information according to the information content of the push information;

[0149] Designing a data storage structure in the Redis cache middleware based on the content structure of the push information, and generating a first cache strategy according to the data storage structure;

[0150] Read the historical data caching process of the Redis cache middleware, obtain the cache monitoring indicators of the historical data caching process, and determine the optimal cache state of the Redis cache middleware under each cache monitoring indicator;

[0151] Generate a dynamic cache space adjustment strategy based on the optimal cache status of the Redis cache middleware under each cache monitoring indicator;

[0152] The Redis cache middleware is divided into multiple Redis nodes, and a working master node and a working slave node are allocated to the Redis nodes based on the working attributes of the Redis cache middleware. At the same time, a collaborative relationship between the working master node and the working slave node is determined according to the working attributes of the Redis cache middleware, and a second cache strategy is generated according to the collaborative relationship;

[0153] A comprehensive cache strategy for the push message is generated based on the first cache strategy, the dynamic cache space adjustment strategy, and the second cache strategy, and the push information is cached according to the comprehensive cache strategy based on the Redis cache middleware.

[0154] In this embodiment, the content structure may be the organization and composition of the push information, for example, including the message subject, title, attachments, etc. of the push message.

[0155] In this embodiment, a data structure suitable for storage in Redis is designed according to the content structure of the push information. For example, the storage structure for storing the push information can be determined by determining the content structure, thereby achieving effective storage of push information corresponding to different content structures.

[0156] In this embodiment, the first cache strategy can be used to implement a strategy for caching push messages based on the data storage structure.

[0157] In this embodiment, the monitoring index may be an index set according to the properties of the cache, wherein the properties of the cache include, for example, cache rate, cache memory, and the like.

[0158] In this embodiment, by reading the historical cache process corresponding to each cache monitoring indicator, the optimal cache state is effectively determined, wherein the optimal cache state may be, for example, the optimal cache rate, the optimal cache memory, and the like.

[0159] In this embodiment, the dynamic cache space adjustment strategy is a strategy for implementing real-time adjustment of cache rate, cache memory, etc. when dynamically caching push information.

[0160] In this embodiment, the working attributes of the Redis cache middleware may be the write operation capability and the read operation capability of the Redis cache middleware.

[0161] In this embodiment, the master node can perform write operations and synchronize data with the slave nodes.

[0162] In this embodiment, the slave node may perform a read operation, and the slave node provides fast read access by copying the data of the master node.

[0163] In this embodiment, the second cache strategy may be a strategy for performing read and write operations on push messages that is generated based on the collaborative relationship between the master node and the slave node.

[0164] The working principle and beneficial effects of the above technical solution are: by reading the push information, the information content of the push information is determined, and the content structure of the push information is determined according to the information content of the push information; based on the content structure of the push information, a data storage structure is designed in the Redis cache middleware, and a first cache strategy is generated according to the data storage structure; the historical data caching process of the Redis cache middleware is read, the cache monitoring index of the historical data caching process is obtained, and the optimal cache state of the Redis cache middleware under each cache monitoring index is determined; a dynamic cache space adjustment strategy is generated according to the optimal cache state of the Redis cache middleware under each cache monitoring index; the Redis cache middleware is divided into multiple Redis nodes, and a working master node and a working slave node are allocated to the Redis node based on the working attributes of the Redis cache middleware, and at the same time, the collaborative relationship between the working master node and the working slave node is determined according to the working attributes of the Redis cache middleware, and a second cache strategy is generated according to the collaborative relationship; a comprehensive cache strategy for push messages is generated based on the first cache strategy, the dynamic cache space adjustment strategy and the second cache strategy, and the push information is cached based on the Redis cache middleware according to the comprehensive cache strategy. By reasonably designing the cache strategy of Redis, the stability and scalability of the message push service can be ensured.

[0165] Embodiment 9:

[0166] Based on Example 1, this embodiment provides a method for quickly building a message push service based on Redis cache. After pushing the push information to the target user based on the Redis cache middleware, it also includes:

[0167] Read the push information sent to the target user, determine the type of the push information, and obtain the user code of the target user;

[0168] Retrieving a preset historical information push library, and performing a first search in the historical information push library according to the user code of the target user, and retrieving the historical information push document of the target user in the preset historical information push library according to the search result;

[0169] Performing a second search in the historical information push documents according to the information type of the push information to determine the push frequency to the target user in the current information type;

[0170] Determine the target user's satisfaction with the pushed information based on the push frequency of the target user, and compare the satisfaction with a preset satisfaction threshold;

[0171] When the satisfaction level is greater than or equal to the preset satisfaction level threshold, the information type of the pushed information is associated with the user code of the target user, and the associated result is stored in the Redis cache middleware;

[0172] Otherwise, the information type of the pushed information is not associated with the user code of the target user.

[0173] In this embodiment, the user code may be a code used to distinguish user information, and one target user corresponds to one user code.

[0174] In this embodiment, the satisfaction threshold may be set in advance and used to implement a measurement standard for associating the information type of the pushed information with the user code of the target user.

[0175] The working principle and beneficial effects of the above technical solution are: reading the push information pushed to the target user, determining the information type of the push information, and obtaining the user code of the target user; calling the preset historical information push library, and performing a first search in the historical information push library according to the user code of the target user, and calling the historical information push document of the target user in the preset historical information push library according to the search result; performing a second search in the historical information push document according to the information type of the push information, and determining the push frequency to the target user in the current information type; determining the target user's satisfaction with the push information according to the push frequency of the target user, and comparing the satisfaction with the preset satisfaction threshold; when the satisfaction is greater than or equal to the preset satisfaction threshold, the information type of the push information is associated with the user code of the target user, and the association result is stored in the Redis cache middleware; otherwise, the information type of the push information is not associated with the user code of the target user, which can improve the intelligence and convenience of information push to the target user, optimize the performance of the Redis cache middleware, and thereby improve the efficiency and satisfaction of information push for the target user.

[0176] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A method for quickly building a message push service based on Redis cache, characterized in that: include: Step 1: Integrate Redis cache middleware; Step 2: Accept the message push request, confirm the push message, and cache the push message according to the Redis cache middleware; Step 3: Query the cached push message according to the Redis cache middleware, obtain the target user, and push the push information to the target user based on the Redis cache middleware.

2. According to a method for quickly building a message push service based on Redis cache according to claim 1, it is characterized in that: In step 1, integrate the Redis cache middleware, including: First configure the operating environment for Redis; Obtain the message push service attributes, determine the relevant database of Redis according to the message push service attributes, and introduce the relevant database into Redis to complete the second configuration; Perform the third configuration for Redis connection information; Create a client object in Redis and complete the fourth configuration based on the creation result; Perform the fifth configuration for Redis cache operation; Integrate the Redis cache middleware according to the first configuration result, the second configuration result, the third configuration result, the fourth configuration result and the fifth configuration result.

3. According to a method for quickly building an information push service based on Redis cache according to claim 1, it is characterized in that: In step 2, the message push request is accepted, the push message is confirmed, and the push message is cached according to the Redis cache middleware, including: Receive a message push request, and parse the message push request based on the processor to determine the information address of the message source and the push information; Establish a connection between the information push terminal and the Redis cache middleware according to the information address of the message source; Based on the connection result, the push information is received according to the Redis cache middleware, and the push information is cached according to the preset method.

4. According to claim 3, a method for quickly building an information push service based on Redis cache is characterized in that: Cache push information according to preset methods, including: Read the preset method to determine the data storage structure and data caching strategy; Convert the push information into a format according to the data storage structure to obtain the first target push information; Based on the data cache strategy, the Redis cache middleware is configured to cache the push information for a certain period of time and a certain cache memory size. At the same time, the first target push information is compressed according to the cache memory size to obtain the second target push information. The second target push information is cached in the Redis cache according to the cache duration.

5. According to a method for quickly building an information push service based on Redis cache according to claim 1, it is characterized in that: In step 2, before the push message is cached according to the Redis cache middleware, the following steps are also included: Obtain information data corresponding to the push information based on Redis cache middleware; Retrieve the historical cache event set in the Redis cache middleware; Preprocessing the information data corresponding to the pushed information to obtain a plurality of word item data in the information data, and creating an index item for each word item data, wherein the index item includes: each word item data and the position of each word item data in the information data; The historical cache events are traversed centrally according to the index items, and the reading or caching of the push messages in the Redis cache middleware is completed based on the traversal results.

6. According to claim 5, a method for quickly building an information push service based on Redis cache is characterized in that: Based on the traversal results, the push message is read or cached in the Redis cache middleware, including: Based on the traversal results, the historical cache data in the historical cache event set that is consistent with the index item is marked, and the marked data set in each historical cache event is determined; Obtain the target ratio of the marked data set in each historical cache event to the total data set of the corresponding historical cache event; Obtain target historical cache events corresponding to target ratios greater than a preset ratio threshold; Calculate the content similarity of multiple word items in the tag data set and the information data in the target historical cache event; Get the position of the marked dataset in the target historical cache event; Based on the position similarity between the position of the labeled dataset in the target historical cache event and the position of each term data in the information data; Determine the total similarity between the push information and the target historical cache event based on the content similarity and the location similarity; Compare the total similarity between the push information and the target historical cache event with the preset similarity threshold to determine whether there is a corresponding push message in the Redis cache middleware; If it exists, the push message is read based on the Redis cache middleware; If it does not exist, the push message is cached based on the Redis cache middleware.

7. According to a method for quickly building a message push service based on Redis cache according to claim 1, it is characterized in that: In step 3, the cached push message is queried according to the Redis cache middleware to obtain the target user, and the push message is pushed to the target user based on the Redis cache middleware, including: Read the cached push message based on Redis cache middleware to determine the push target corresponding to the push message; Based on the push target, the user information is queried in the Redis cache middleware, and the target user that matches the push message is matched based on the query result; Push information to target users based on Redis cache middleware.

8. A method for quickly building a message push service based on Redis cache according to claim 7, characterized in that: Push information to target users based on Redis cache middleware, including: Obtain the target user's information reading requirements, and parse the push information based on the information reading requirements to determine the key fields of the push information. At the same time, split the push information according to the key fields of the push information to obtain several sub-push information segments; Constructing a push tag corresponding to the sub-push information segment according to the key field, and encapsulating the sub-push information segment according to the push tag to obtain an information package to be pushed, wherein the information package to be pushed includes: the push tag, the sub-push information segment and the key field; The push order of each information package to be pushed is determined based on the information reading requirements, and each information package to be pushed is pushed to the target user in the push order based on the Redis cache middleware.

9. According to a method for quickly building a message push service based on Redis cache according to claim 1, it is characterized in that: In step 2, push messages are cached according to the Redis cache middleware, including: Read the push information, determine the information content of the push information, and determine the content structure of the push information according to the information content of the push information; Designing a data storage structure in the Redis cache middleware based on the content structure of the push information, and generating a first cache strategy according to the data storage structure; Read the historical data caching process of the Redis cache middleware, obtain the cache monitoring indicators of the historical data caching process, and determine the optimal cache state of the Redis cache middleware under each cache monitoring indicator; Generate a dynamic cache space adjustment strategy based on the optimal cache status of the Redis cache middleware under each cache monitoring indicator; The Redis cache middleware is divided into multiple Redis nodes, and a working master node and a working slave node are allocated to the Redis nodes based on the working attributes of the Redis cache middleware. At the same time, a collaborative relationship between the working master node and the working slave node is determined according to the working attributes of the Redis cache middleware, and a second cache strategy is generated according to the collaborative relationship; A comprehensive cache strategy for the push message is generated based on the first cache strategy, the dynamic cache space adjustment strategy, and the second cache strategy, and the push information is cached according to the comprehensive cache strategy based on the Redis cache middleware.

10. A method for quickly building a message push service based on Redis cache according to claim 1, characterized in that: After pushing the push information to the target user based on the Redis cache middleware, it also includes: Read the push information sent to the target user, determine the type of the push information, and obtain the user code of the target user; Retrieving a preset historical information push library, and performing a first search in the historical information push library according to the user code of the target user, and retrieving the historical information push document of the target user in the preset historical information push library according to the search result; Performing a second search in the historical information push documents according to the information type of the push information to determine the push frequency to the target user in the current information type; Determine the target user's satisfaction with the pushed information based on the push frequency of the target user, and compare the satisfaction with a preset satisfaction threshold; When the satisfaction level is greater than or equal to the preset satisfaction level threshold, the information type of the pushed information is associated with the user code of the target user, and the associated result is stored in the Redis cache middleware; Otherwise, the information type of the pushed information is not associated with the user code of the target user.

Citation Information

Cited By

  • ACS server pre-management optimization method based on TR069 protocol

    CN120434116A

  • An ACS server pre-management optimization method based on TR069 protocol

    CN120434116B