Cache data processing method, system and device and storage medium

By recalling and cacheing the required data from the database in advance according to the attribute information of the target service during data query, and directly sending cached data when establishing a connection on the query side, the avalanche effect problem in low cached data preparation efficiency and large concurrency scenarios is solved, and faster query time and more stable system performance are achieved.

CN119961302APending Publication Date: 2025-05-09JIALIAN PAYMENTS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411950503.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

In the prior art, when processing data queries, the cached data preparation efficiency is low, resulting in a long query time and is prone to trigger cached data breakdown and avalanche effects in large concurrency scenarios.

Method used

By obtaining the attribute information of the target service, the demand data is retrieved from the database and cached. When establishing a connection with the query end, if it is determined to be the query end of the target service, the cached data will be directly sent.

Benefits of technology

It improves the efficiency of cached data preparation, reduces query time on the query side, and avoids cached data breakdown and avalanche effects in large concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119961302A_ABST
    Figure CN119961302A_ABST
Patent Text Reader

Abstract

The invention discloses a cache data processing method, system and device and a storage medium, which are used for improving the preparation efficiency of cache data and reducing the query time of a query end. The method comprises the steps of obtaining attribute information of a target service; calling demand data of the target business from a database according to the attribute information; caching the demand data to obtain cached data; and when a connection is established with a first query end, if it is determined that the first query end is a query end serving the target service, sending the cache data to the first query end.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data communication technology, and in particular to a method, system, device and storage medium for processing cache data. Background Art

[0002] As network data transmission capabilities become faster and faster and server processing capabilities become stronger and stronger, many developers will only retain basic application operation functions on the user side of the application, while data calculation, query and other processing functions are more deployed on the server, and the server can also deploy multiple applications from multiple different developers.

[0003] When the user's operation instructions involve data query, the current mainstream method is to request data query from the server, and the server reads the relevant data from the database and writes the read data into the cache so that the next time the user accesses, the data can be directly read from the cache. This is a passive processing method of caching only when requested. However, this cache processing method is not only slow, but also in large concurrency scenarios, it will cause an avalanche effect caused by cache data breakdown. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides a method, system, device and storage medium for processing cache data, which are used to improve the preparation efficiency of cache data and reduce the query time of the query end.

[0005] The first aspect of the present application provides a method for processing cache data, including:

[0006] Obtaining attribute information of the target business;

[0007] Retrieving the demand data of the target business from a database according to the attribute information;

[0008] Cache the demand data to obtain cache data;

[0009] When establishing a connection with the first query end, if it is determined that the first query end is a query end serving the target service, the cached data is sent to the first query end.

[0010] Optionally, the processing method further includes:

[0011] receiving an operation instruction from the first query end;

[0012] When the operation instruction generates an update of the demand data for the target service, the database is updated according to the operation instruction, and the updated demand data is cached to obtain updated cache data.

[0013] Optionally, the processing method further includes:

[0014] When a connection is established with the first query end, the updated cache data is sent to the first query end.

[0015] Optionally, the attribute information includes a data update condition of the target service, and the processing method further includes:

[0016] When the data update condition of the target service is triggered, the database is updated according to the data update condition, and the updated demand data is cached to obtain updated cache data;

[0017] When a connection is established with the first query end, the updated cache data is sent to the first query end.

[0018] Optionally, the data update condition is that the life span of part or all of the data of the target service has expired.

[0019] Optionally, the processing method further includes:

[0020] When establishing a connection with the second query end, if it is determined that the second query end is a query end serving the target service, the cached data is sent to the second query end.

[0021] Optionally, sending the cache data to the first query end includes:

[0022] According to the transmission record with the first query end, an unsent portion of the cached data is sent to the first query end.

[0023] A second aspect of the present application provides a cache data processing system, the processing system comprising:

[0024] An acquisition unit, used to acquire attribute information of a target service;

[0025] A retrieving unit, configured to retrieve the demand data of the target business from a database according to the attribute information;

[0026] A cache unit, used for caching the demand data to obtain cache data;

[0027] A sending unit is configured to send the cached data to a first query end when establishing a connection with the first query end, if it is determined that the first query end is a query end serving the target service.

[0028] A third aspect of the present application provides a cache data processing device, the processing device comprising:

[0029] Processor, memory, input-output unit, and bus;

[0030] The processor is connected to the memory, the input and output unit, and the bus;

[0031] The memory stores a program, and the processor calls the program to execute the processing method as described in the first aspect and any optional item in the first aspect.

[0032] A fourth aspect of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the program executes the first aspect and any optional processing method in the first aspect.

[0033] It can be seen from the above technical solutions that this application has the following advantages:

[0034] First, the target business demand data is retrieved from the database according to the attribute information of the target business, and cached to obtain cached data; once a connection is established with the first query end, if the first query end is a query end serving the target business, the cached data is directly sent to the first query end. In this way, there is no need to wait for the first query end to send a query instruction before retrieving relevant data from the database. Instead, once a connection is established with a query end related to the target business, the target business demand data is sent to the query end, which not only improves the efficiency of preparing cached data, but also reduces the query time of the query end. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0036] Figure 1 A schematic diagram of an embodiment of a method for processing cache data provided by the present application;

[0037] Figure 2 A schematic diagram of an embodiment of updating a cache database through an operation instruction of a query end in the cache data processing method provided by the present application;

[0038] Figure 3 A schematic diagram of an embodiment of updating cache data by using a data update condition in the cache data processing method provided by the present application;

[0039] Figure 4 A schematic diagram of an embodiment of a system for processing cache data in an embodiment of the present application;

[0040] Figure 5 A schematic diagram of an embodiment of a device for processing cache data in an embodiment of the present application. DETAILED DESCRIPTION

[0041] It should be noted that the cache data processing method, system, device and storage medium provided in this application can be applied to a terminal, a system or a server. For example, the terminal can be a smart phone or a computer, a tablet computer, a smart TV, a smart watch, a portable computer terminal or a fixed terminal such as a desktop computer. For the convenience of explanation, this application uses a server as an example for explanation.

[0042] See also Figure 1 , Figure 1 An embodiment of a method for processing cache data provided by the present application includes:

[0043] S101, obtaining attribute information of a target service;

[0044] The server generally does not maintain only one type of business data, especially servers like aggregation platforms, which generally deploy different applications from multiple developers. The purpose of the embodiment of the present application is to quickly provide cache data to the query end that needs target business data, so it is necessary to first obtain the target business and the attribute information of the target business.

[0045] Optionally, the method of obtaining the attribute information of the target business can be that when the first query end establishes a connection with the server for the first time and sends a query request, the server determines the target business and its attribute information according to the query needs of the first query end. For example, a user visits the "A store" of a sales website through a mobile phone and performs a query operation for "B watch". The server determines that the target business is "A store" and its attribute information is a commodity.

[0046] Optionally, the method of obtaining the attribute information of the target service can also be that the developer or operator pre-sets the target service and its attribute information. For example, the operator of "Store A" is preparing to advertise "Watch B" within a week, and it can be expected that a large number of users will visit "Store A" and search for "Watch B" in the near future. Therefore, the server can obtain the target service and its attribute information by directly sending the demand to the server.

[0047] S102, retrieve the target business demand data from the database according to the attribute information;

[0048] Even if the target business and its attribute information are determined, there may be a large amount of relevant data for the target business in the server. The server does not need to retrieve all the data of the target business in the database, but determines the demand data of the target business based on the attribute information of the target business, and then retrieves the demand data. For example, the server retrieves the data of the top 20 sales of "Store A" based on historical records. For another example, the server retrieves the data of the "Watch B" product that is about to be promoted based on the preset requirements of the operator.

[0049] S103, caching the demand data to obtain cache data;

[0050] After the server retrieves the target business demand data, in order to quickly send the demand data to the query end in need, the server caches the demand data to obtain cache data. The cache data can be stored in a JSON format so that the query end can quickly parse the message format to read the data after receiving it.

[0051] S104: When establishing a connection with the first query end, if it is determined that the first query end is a query end serving the target business, the cached data is sent to the first query end.

[0052] Because the server will have a large number of query end access connections, and in order to save server resources, the server will actively disconnect the connection for the query end that has established a connection but has not responded for a long time. Or because of network delays or too many server processes, the server will also actively disconnect some low-priority connections. Therefore, even if the first query end has sent a query request to the server, it may need to reconnect to the server. When the server establishes a connection with the first query end, it is necessary to determine that the first query end is the query end that serves the target business, and then send the pre-cached cache data to the first query end.

[0053] Optionally, the method of determining that the first query terminal is the query terminal serving the target business may be to determine, based on the ID or IP address of the first query terminal, that the first query terminal has visited the server within a preset time and performed a query operation for the target business. For example, a user visited "Shop A" 1 minute ago and searched for "Watch B". After the server promptly fed back the search results, the connection was disconnected because the user did not have any operation instructions. After the server reestablished the connection with the user, it determined the pre-retrieved cache data required by the user based on the user's access record, and therefore sent the cache data to the user.

[0054] Optionally, the method for determining that the first query terminal is the query terminal serving the target business can also be that the server detects the operation command of the first query terminal in real time, and when it detects that the first query terminal enters the access page of the target business, the pre-retrieved cache data is sent to the first query terminal. For example, a user visits a sales website and establishes a connection with the server. The server detects the user's operation command on the sales website. When it detects that the user clicks to enter the target business "Store A", the cache data of the target business "Store A" (for example, the data of the top 20 sales products, or the data of the products promoted by the operator) is sent to the user.

[0055] Optionally, the server may also send the unsent portion of the cached data to the first query end based on the transmission record with the first query end. When the message content of the cached data is large, the server cannot quickly send all the cached data to the first query end during the instant feedback process with the first query end. Or because the connection is suddenly interrupted, it may also lead to the inability to send all the cached data. Therefore, in this optional embodiment, the server first queries the transmission record with the first query end, and according to the transmission record, it filters out the unsent portion of the cached data, and sends this portion of the cached data to the first query end, without having to resend all the cached data, thereby improving the transmission efficiency.

[0056] In the embodiment of the present application, the target business demand data is first retrieved from the database according to the attribute information of the target business, and cached to obtain the cached data; once a connection is established with the first query end, if the first query end is a query end serving the target business, the cached data is directly sent to the first query end. In this way, there is no need to wait for the first query end to send a query instruction before retrieving the relevant data from the database. Instead, once a connection is established with the query end related to the target business, the target business demand data is sent to the query end, which not only improves the efficiency of preparing cached data, but also reduces the query time of the query end.

[0057] Figure 1 In the embodiment, after S103 or S104, when the server retrieves the cached data, the first query end may have some operation instructions that require the server's database to be updated, and the cached data needs to be updated at this time. Figure 2 As shown, Figure 2 An embodiment of updating cache data according to an operation instruction of a first query end includes:

[0058] S201, receiving an operation instruction from a first query end;

[0059] After the first query terminal establishes a connection with the server, some operation instructions will be performed on the access page. The server receives the operation instructions of the first query terminal, and the operation instructions can be generated by the first query terminal and sent to the server, or the server can obtain the operation instructions of the first query terminal by real-time detection.

[0060] S202: When the operation instruction generates an update of the demand data for the target business, the database is updated according to the operation instruction, and the updated demand data is cached to obtain updated cache data;

[0061] The first query end may execute multiple operation instructions, but not every operation instruction will have an impact on the demand data of the target business in the server. Therefore, the server first determines whether the operation instruction needs to update the demand data of the target business. If the demand data of the target business needs to be updated after the operation instruction is executed, the server will update the cached data at the same time after updating the database. For example, a user visits "Store A" and places an order for the product "Watch B", and the cached data previously retrieved by the server contains the inventory information of the product "Watch B". Therefore, the user's order operation will not only update the inventory data of "Watch B" in the database, but also update the cached data. If the user places an order for the product "Toy C", because the basic information of "Toy C" has not been maintained in the cached data, the order operation instruction will only update the database, but will not update the cached data.

[0062] S203: When a connection is established with the first query end, the updated cache data is sent to the first query end.

[0063] Because the task of updating the database and cache data by the server is not a task that needs to be met in time, the server does not need to process it immediately and may complete the update within a certain period of time. Before the server completes the update, it may be disconnected from the first query end, but when the connection with the first query end is reestablished, the updated cache data is sent to the first query end.

[0064] In the above embodiment, when the server retrieves the cached data, it may generate an update requirement for the cached data when the data update condition of the target service is triggered. Figure 3 As shown, Figure 3 An embodiment of performing cache update when a data update condition of a target service is triggered includes:

[0065] S301. When a data update condition of a target business is triggered, the database is updated according to the data update condition, and the updated demand data is cached to obtain updated cache data;

[0066] In the embodiment of the present application, not only may the operation instructions of the query end have an update impact on the cached data, but the target business itself can also set data update conditions to update the cached data.

[0067] Optionally, the data update condition is that the life span of part or all of the data of the target business has expired. For example, the target business is "Store A", where the price of "Watch B" is 20% off during the promotion period. When the promotion period ends, the price of "Watch B" will be adjusted back to the original price. Alternatively, "Watch B" is only sold in "Store A" for one week. After one week, "Store A" will no longer sell "Watch B". Alternatively, the operator of "Store A" advertises 100 coupons, and these 100 coupons are valid for 1 month. Then the cached data must store the information of the coupon. After the 1-month period ends, the coupon capability disappears. Therefore, the cached data needs to be updated.

[0068] S302: When a connection is established with the first query end, the updated cache data is sent to the first query end;

[0069] After the cache data is updated according to the operation instruction of the first query end or according to the update condition of the target business, once the connection with the first query end is established, the updated cache data is sent to the first query end so that the first query end can obtain the latest data information.

[0070] S303: When establishing a connection with the second query end, if it is determined that the second query end is a query end serving the target business, the cached data is sent to the second query end.

[0071] In the embodiment of the present application, the cache data maintained by the server can serve a large number of query terminals. When the second query terminal also establishes a connection with the server and it is determined that the second query terminal has a demand for the target business, the cache data or the updated cache data will also be sent to the second query terminal.

[0072] The method of determining whether the second query end is the query end serving the target business can be to determine it according to the operation instruction of the second query end. For example, the second query end accesses the sales page of "Store A", so the server can send the cached data to the second query end.

[0073] The method of determining whether the second query end is the query end serving the target business can also be determined based on whether the physical location of the second query end is within a preset range. For example, the operator of "Store A" is a physical store that distributes coupon advertisements on the sales website so that surrounding users can receive the coupon. For this scenario, after the second query end establishes a connection with the server, the server obtains the positioning information of the second query end. If it is near "Store A", it is determined that the second query end has a demand for the target business, and therefore, the cached data of the target business is sent to the second query end.

[0074] See also Figure 4 As shown, Figure 4 An embodiment of a cache data processing system provided by the present application includes:

[0075] The acquisition unit 401 is used to acquire the attribute information of the target service;

[0076] The retrieving unit 402 is used to retrieve the target business demand data from the database according to the attribute information;

[0077] The cache unit 403 is used to cache the demand data to obtain cache data;

[0078] The sending unit 404 is configured to send the cached data to the first query end if it is determined that the first query end is a query end serving the target service when establishing a connection with the first query end.

[0079] Optionally, the processing system further includes:

[0080] A receiving unit 405, configured to receive an operation instruction from the first query end;

[0081] The first updating unit 406 is configured to update the database according to the operation instruction when the operation instruction generates an update of the demand data for the target service, and cache the updated demand data to obtain updated cache data.

[0082] Optionally, the sending unit 404 is further configured to:

[0083] When a connection is established with the first query end, the updated cache data is sent to the first query end.

[0084] Optionally, the attribute information includes a data update condition of the target business, and the processing system further includes:

[0085] The second updating unit 407 is used to update the database according to the data update condition when the data update condition of the target business is triggered, and cache the updated demand data to obtain updated cache data;

[0086] The sending unit 404 is further configured to:

[0087] When a connection is established with the first query end, the updated cache data is sent to the first query end.

[0088] Optionally, the data update condition is that the life span of part or all of the data of the target business has expired.

[0089] Optionally, the sending unit 404 is further configured to:

[0090] When establishing a connection with the second query end, if it is determined that the second query end is a query end serving the target business, the cached data is sent to the second query end.

[0091] Optionally, the sending unit 404 is specifically configured to send an unsent portion of the cached data to the first query end according to a transmission record with the first query end.

[0092] In the terminal of this embodiment, the functions of each unit are the same as those described above. Figures 1 to 3 The steps in the method embodiment shown correspond to each other and will not be repeated here.

[0093] See also Figure 5 As shown, Figure 5 An embodiment of a cache data processing device provided in the present application includes:

[0094] Processor 501, memory 502, input and output unit 503, bus 504;

[0095] The processor 501 is connected to the memory 502, the input and output unit 503 and the bus 504;

[0096] The memory 502 stores a program, and the processor 501 calls the program to execute any of the above cache data processing methods.

[0097] The present application also relates to a computer-readable storage medium on which a program is stored, wherein when the program is run on a computer, the computer is caused to execute any of the above cache data processing methods.

[0098] 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.

[0099] In the several embodiments provided in the present application, 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 units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that 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, which can be electrical, mechanical or other forms.

[0100] 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 solution of this embodiment.

[0101] In addition, each functional unit in each embodiment of the present application 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-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0102] 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 the present application, 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, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the various embodiments of the present application. 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, etc. Various media that can store program codes.

Claims

1. A method for processing cache data, characterized in that: The processing method comprises: Obtaining attribute information of the target business; Retrieving the demand data of the target business from a database according to the attribute information; Cache the demand data to obtain cache data; When establishing a connection with the first query end, if it is determined that the first query end is a query end serving the target service, the cached data is sent to the first query end.

2. The processing method according to claim 1, characterized in that: The processing method also includes: receiving an operation instruction from the first query end; When the operation instruction generates an update of the demand data for the target service, the database is updated according to the operation instruction, and the updated demand data is cached to obtain updated cache data.

3. The processing method according to claim 2, characterized in that: The processing method also includes: When a connection is established with the first query end, the updated cache data is sent to the first query end.

4. The processing method according to claim 1, characterized in that: The attribute information includes a data update condition of the target service, and the processing method further includes: When the data update condition of the target service is triggered, the database is updated according to the data update condition, and the updated demand data is cached to obtain updated cache data; When a connection is established with the first query end, the updated cache data is sent to the first query end.

5. The processing method according to claim 4, characterized in that: The data update condition is that the life span of part or all of the data of the target service expires.

6. The processing method according to any one of claims 1 to 5, characterized in that: The processing method also includes: When establishing a connection with the second query end, if it is determined that the second query end is a query end serving the target service, the cached data is sent to the second query end.

7. The processing method according to any one of claims 1 to 5, characterized in that: The sending the cache data to the first query end includes: According to the transmission record with the first query end, an unsent portion of the cached data is sent to the first query end.

8. A cache data processing system, characterized in that: The processing system comprises: An acquisition unit, used to acquire attribute information of a target service; A retrieving unit, configured to retrieve the demand data of the target business from a database according to the attribute information; A cache unit, used for caching the demand data to obtain cache data; A sending unit is configured to send the cached data to a first query end when establishing a connection with the first query end, if it is determined that the first query end is a query end serving the target service.

9. A cache data processing device, characterized in that: The processing device comprises: Processor, memory, input-output unit, and bus; The processor is connected to the memory, the input and output unit, and the bus; The memory stores a program, and the processor calls the program to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a program stored thereon, wherein the program, when executed on a computer, performs the method according to any one of claims 1 to 7.