A method, device, equipment and storage medium for improving local cache hit rate

By dividing dedicated and temporary storage space in the server local cache and preheating hotspot data, the low hit rate problem caused by hotspot data being kicked out is solved, significantly improving the response speed and user experience.

CN114003626BActive Publication Date: 2025-04-25VIPSHOP (GUANGZHOU) SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111171673.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-08
Publication Date
2025-04-25
Estimated Expiration
2041-10-08

AI Technical Summary

Technical Problem

In the existing server-side local cache, hotspot data is easily kicked out, resulting in low hit rate, slow response speed and poor user experience.

Method used

By dividing the local cache space into dedicated storage space and temporary storage space, it specifically stores hotspot data accessed by high frequency, and preheating the hotspot data in the business database into the local cache to ensure that the hotspot data is updated and stored in real time.

Benefits of technology

It effectively reduces the situation where hot data is kicked out, improves local cache hit rate, improves response speed and user experience, and reduces the pressure on server resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114003626B_ABST
    Figure CN114003626B_ABST
Patent Text Reader

Abstract

The present application relates to the field of data interaction technology, and in particular to a method, device, equipment and storage medium for improving the hit rate of local cache, wherein the method comprises the following steps: based on the request frequency of the data type and the space occupied by the corresponding type of data, the local cache space is divided into a dedicated storage space and a temporary storage space, wherein the dedicated storage space is used to store hot data that occupies a fixed space and is frequently accessed, and the temporary storage space is used to store non-hot data that occupies a large space and is infrequently accessed; preheating the hot data in the business database to the local cache; storing the updated hot data in real time to the dedicated storage space; and obtaining the required data from the local cache space when data request information is received. The problem that the hot data in the existing server-side local cache is easily kicked out is solved. The present application has the effect of improving the hit rate of the server-side local cache and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data interaction technology, and in particular to a method, device, equipment and storage medium for improving a local cache hit rate. Background Art

[0002] Every year, e-commerce platforms hold big promotions. In order to create a tense atmosphere for rush buying, they usually start the corresponding promotions at designated times, such as 8 pm or 0 am. During the corresponding peak time, the request pressure of the business system is very high, up to 1 million QPS (Query Per Second).

[0003] At present, in order to improve user experience and save machine resources, the QPS of a single application is improved by introducing local cache on the server side.

[0004] However, the local cache on the server has an upper limit on its capacity. The cache maintained using the common LRU (Least Recently Used) algorithm often has hot data kicked out under the condition of limited space. For example, the data that is most commonly used at the business level and must be accessed for every request is kicked out, resulting in a low overall hit rate, slow response speed, and the user experience needs to be improved.

[0005] With respect to the above-mentioned related technologies, the inventor believes that there is a defect that the hot data in the existing server-side local cache is easily kicked out, resulting in a low hit rate. Summary of the invention

[0006] In order to reduce the situation where hot data is kicked out, the present application provides a method, apparatus, device and storage medium for improving the local cache hit rate.

[0007] On the first aspect, the present application provides a method for improving the local cache hit rate, which has the characteristic of reducing the kicking out of hot data.

[0008] This application is achieved through the following technical solutions:

[0009] A method for improving a local cache hit rate comprises the following steps:

[0010] Based on the request frequency of data types and the space occupied by data of corresponding types, the local cache space is divided into dedicated storage space and temporary storage space. The dedicated storage space is used to store hot data that occupies a fixed space and is frequently accessed, and the temporary storage space is used to store non-hot data that occupies a large space and is infrequently accessed.

[0011] Preheat the hot data in the business database to the local cache;

[0012] The updated hotspot data is stored in the dedicated storage space in real time;

[0013] When data request information is received, required data is obtained from the local cache space.

[0014] By adopting the above technical solution, the local cache space is divided into dedicated storage space and temporary storage space based on the request frequency of the data type and the space occupied by the corresponding type of data, so as to ensure that the cache type data with high request frequency and fixed space occupation can be permanently stored in the local cache, and the data can be guaranteed to be valid for a long time. When external requests access these data types, the data can be directly obtained from the local cache; in order to make the data in the local cache consistent with the data in the business database, the local cache is preheated to ensure that the hot data is set to the local cache. At the same time, if the message is lost, the erroneous data in the cache can be corrected, thereby further reducing the impact of the message loss; the hot data in the business database is preheated to the local cache In the local cache, after the background management of the business database changes the information, the latest data is pushed to the local cache in real time, so that the hot data in the local cache is updated and kept consistent with the data records in the business database; when data request information is received, the required data is directly obtained from the local cache space, and the requester is quickly responded to, which improves QPS, reduces response latency, and improves user experience. At the same time, it reduces the situation where hot data is kicked out and improves the local cache hit rate of the server; the method to improve the local cache hit rate is to intervene in the local cache space through partitioning, so that a part of the hot data can always hit the cache, which improves the hit rate of the local cache on the server, ensures the overall performance of the business system, and improves the user experience.

[0015] In a preferred example, the present application can be further configured as follows: the step of preheating the hot data in the business database to the local cache includes:

[0016] Scan the business database regularly and obtain the corresponding business type data from the business database;

[0017] Scanning the business database regularly, obtaining corresponding business type data from the business database is defined as a first message, and notifying each business application of the first message;

[0018] After receiving the first message, the service application sets the corresponding service type data obtained from the service database into the local cache.

[0019] By adopting the above technical solution, the business database is scanned regularly, the corresponding business type data is obtained from the business database, and the message is notified to each business application. After receiving the message, the business application sets the obtained business type data to the local cache, thereby ensuring that the local cache data is consistent with the data in the business database; and because the server application may be restarted during version release or daily processes, and the local cache space is empty after the restart, the business data can be preheated in advance, thereby improving the hit rate of the server local cache; at the same time, if the message is lost, the erroneous data in the cache can be corrected, thereby further reducing the impact of the message loss.

[0020] In a preferred example, the present application may be further configured as follows: the step of storing the updated hotspot data in real time to the dedicated storage space includes:

[0021] Parse and obtain the changed business type data;

[0022] The business type data obtained by parsing the change is defined as a second message, and the second message is notified to each business application;

[0023] After receiving the second message, the business application queries whether the local cache space has the same data type;

[0024] When the same data type exists, the business application stores the changed business type data in the dedicated storage space in real time according to the second message.

[0025] By adopting the above technical solution, the changed business data is parsed and the message is notified to each business application. After receiving the message, the business application queries whether there is existing data in the local cache to confirm whether the updated data is hot data. If so, the hot data in the local cache is actively updated so that the updated hot data can be stored in a dedicated storage space in real time, which is conducive to some of the hot data always hitting the cache.

[0026] In a preferred example, the present application may be further configured as follows: the step of storing the updated hotspot data in real time to the dedicated storage space further includes:

[0027] When there is no identical data type, determine whether the data is hot data;

[0028] When the data is not hot data, the business application discards the received second message.

[0029] By adopting the above technical solution, when there is no identical data type in the local cache space and the data to be updated is non-hotspot data, since the local cache space is limited, there is no need to store the non-hotspot data in the local cache space and occupy precious cache space, and the non-hotspot data can be directly discarded.

[0030] In a preferred example, the present application can be further configured to include the following steps:

[0031] When the result obtained from the local cache space is empty, the required data is obtained from the secondary central cache.

[0032] By adopting the above technical solution, when the result obtained from the local cache space is empty, the required data is obtained from the secondary central cache, and a secondary strategy is adopted to ensure that the required data is obtained.

[0033] In a preferred example, the present application can be further configured to include the following steps:

[0034] When the result obtained from the secondary central cache is empty, the required data is obtained from the tertiary business database or external application service.

[0035] By adopting the above technical solution, when the result obtained from the secondary central cache is empty, the required data is obtained from the tertiary business database or external application service, and the data is obtained back to the business database to ensure that the required data is obtained.

[0036] In a preferred example, the present application can be further configured to include the following steps:

[0037] After the required data is obtained from the third-level business database or external application service, the obtained data information is written back to the corresponding local cache space and central cache.

[0038] By adopting the above technical solution, after the required data is obtained from the third-level business database or external application service, the obtained data information is written back to the corresponding local cache space and central cache, and the data in the local cache or central cache is updated to ensure that when the same request demand is encountered again, there is no need to penetrate the business database again to obtain the required data, thereby improving QPS, reducing response latency, and ensuring that a part of the hot data can always hit the cache, thereby improving the hit rate of the local cache on the server side and improving the user experience.

[0039] On the second aspect, the present application provides a device for improving the local cache hit rate, which has the characteristic of reducing the hot data being kicked out.

[0040] This application is achieved through the following technical solutions:

[0041] A device for improving a local cache hit rate, comprising:

[0042] A cache management module is used to divide the local cache space into dedicated storage space and temporary storage space based on the request frequency of the data type and the space occupied by the corresponding type of data, wherein the dedicated storage space is used to store hot data that occupies a fixed space and is frequently accessed, and the temporary storage space is used to store non-hot data that occupies a large space and is infrequently accessed;

[0043] Full update task module, used to preheat hot data in the business database to the local cache;

[0044] An incremental update task module, used to store the updated hotspot data in the dedicated storage space in real time;

[0045] The data acquisition module is used to acquire required data from the local cache space when receiving data request information.

[0046] On the third aspect, the present application provides a computer device having the feature of reducing the chance of hotspot data being kicked out.

[0047] This application is achieved through the following technical solutions:

[0048] A computer device comprises a memory, a processor and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the above-mentioned method for improving the local cache hit rate when executing the computer program.

[0049] In a fourth aspect, the present application provides a computer-readable storage medium having the characteristic of reducing the chance of hotspot data being kicked out.

[0050] This application is achieved through the following technical solutions:

[0051] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for improving the local cache hit rate.

[0052] In summary, the present application includes at least one of the following beneficial technical effects:

[0053] 1. A method to improve the hit rate of local cache: By intervening in the local cache space through partitioning, the situation where hot data is kicked out is reduced, so that a part of the hot data can always hit the cache, which improves the hit rate of the local cache on the server side, ensures the overall performance of the business system, and improves the user experience;

[0054] 2. Preheat the hot data in the business database to the local cache to preheat the business data in advance, thereby improving the hit rate of the local cache on the server. At the same time, if the message is lost, the wrong data in the cache can be corrected to further reduce the impact of the message loss;

[0055] 3. Directly choose to discard non-hotspot data to be updated to release valuable local cache space;

[0056] 4. When the result obtained from the local cache space is empty, obtain the required data from the secondary central cache, from the tertiary business database or external application service to ensure that the required data is obtained;

[0057] 5. Reversely write the acquired data information into the corresponding local cache space and central cache, and update the data in the local cache or central cache to ensure that when the same request requirement is encountered again, there is no need to penetrate into the business database again to obtain the required data, thereby improving QPS and reducing response latency. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 It is a flowchart of a method for improving the local cache hit rate according to one embodiment of the present application.

[0059] Figure 2 This is an interactive schematic diagram of a method for improving the local cache hit rate according to one embodiment of the present application.

[0060] Figure 3 It is a flowchart of the steps to preheat the hot data in the business database into the local cache.

[0061] Figure 4 It is a flowchart of the steps for storing updated hotspot data in a dedicated storage space in real time.

[0062] Figure 5 This is a structural block diagram of a device for improving the local cache hit rate according to one embodiment of the present application.

[0063] Figure 6 It is a comparison chart of the hit rate of the daily local cache and the hit rate of the local cache of this application. DETAILED DESCRIPTION

[0064] This specific embodiment is only an explanation of the present application, and it is not a limitation of the present application. After reading this specification, those skilled in the art can make modifications to the present embodiment without creative contribution as needed, but as long as it is within the scope of the claims of the present application, it is protected by the patent law.

[0065] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0066] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. 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 article, unless otherwise specified, generally means that the associated objects before and after are in an "or" relationship.

[0067] The local cache on the server side exists in the memory of IIS (Internet Information Services) running on the server. For example, if the local cache on the server side is set for certain pages, the client's request can be responded to quickly within the cache time interval.

[0068] However, since the local cache on the server has a capacity limit, hot data is often kicked out. For example, the data that is most commonly used at the business level and must be accessed for each request is kicked out, resulting in a low overall hit rate, slow response speed, and poor user experience.

[0069] This application intervenes in the local cache space through partitioning to ensure that a portion of hot data can always hit the cache, ultimately improving the hit rate of the local cache of the server application, ensuring the overall performance of the business system, and improving the user experience.

[0070] The embodiments of the present application are further described in detail below in conjunction with the drawings in the specification.

[0071] Reference Figure 1 and Figure 2 , an embodiment of the present application provides a method for improving the local cache hit rate, and the main steps of the method are described as follows.

[0072] S1: Based on the request frequency of the data type and the space occupied by the corresponding type of data, the local cache space is divided into a dedicated storage space and a temporary storage space, wherein the dedicated storage space is used to store hot data that occupies a fixed space and is frequently accessed, and the temporary storage space is used to store non-hot data that occupies a large space and is infrequently accessed;

[0073] S2: Preheat the hot data in the business database to the local cache;

[0074] S3: Store the updated hotspot data in a dedicated storage space in real time;

[0075] S4: When data request information is received, the required data is obtained from the local cache space.

[0076] Specifically, there are more than 20 types of data stored in the local cache of the server, such as information on products on sale, product size information, product special event information, product-related inventory information, product-related purchase schedule information, barcode whitelist information, etc. The data volume of these cache types is not at the same level. For example, the information on products on sale is about several million, while the information on product special events is only tens of thousands. At the same time, the frequency of requests for different types of data is also different.

[0077] Reference Figure 2 Based on the request frequency of data types and the space occupied by the corresponding data types, the data stored in the local cache of the server is classified, including hot data that occupies a fixed space and is frequently accessed, and non-hot data that occupies a large space and is infrequently accessed. At the same time, the local cache space is divided into a dedicated storage space SpecialCache and a temporary storage space Other Cache. The dedicated storage space is used to store hot data, and the temporary storage space is used to store non-hot data, to ensure that cache type data with high request frequency and fixed space can be permanently stored in the local cache, and then when external requests access these data types, the data can be directly obtained from the local dedicated storage space SpecialCache.

[0078] Reference Figure 3 , further, S2: the step of preheating the hot data in the business database to the local cache of the server application includes:

[0079] S21: Scan the business database regularly to obtain corresponding business type data from the business database;

[0080] S22: scanning the service database regularly, obtaining corresponding service type data from the service database and defining it as a first message, and notifying each service application of the first message;

[0081] S23: After receiving the first message, the service application sets the corresponding service type data obtained from the service database into the local cache.

[0082] When scanning the service database regularly, the scanning time is set according to the data volume and service sensitivity of the service data type. In this embodiment, the interval of regular patrol for service types with large data volume is 1 hour or 30 minutes, and that for service types with small data volume is 5 minutes.

[0083] Scan the business database regularly, obtain the corresponding business type data from the business database, and asynchronously broadcast the message to each business application through the Kafka message channel; after the business application receives the message data, it actively sets the corresponding data to the local cache to complete the data update.

[0084] Preheat the hot data in the business database to the local cache of the server application to ensure that the hot data in the business database can be set in the local cache, preheat the data for the local cache, and thus improve the cache hit rate. For example, when the server application is restarted, the data in the local cache is empty. By preheating the hot data in the business database to the local cache of the server application, the cache data can be preheated in advance.

[0085] At the same time, by preheating the hot data in the business database to the local cache of the server application, the local cache data is kept consistent with the data in the business database. Furthermore, when the cache time is set to be longer, such as more than 2 hours, when the message of hot data stored in real time in the dedicated storage space is lost, the erroneous data can be corrected with the help of the local cache data, thereby further reducing the impact of data loss.

[0086] Reference Figure 4 Further, S3: the step of storing the updated hotspot data in real time to the dedicated storage space includes:

[0087] S31: parse and obtain the changed business type data;

[0088] S32: defining the parsed and changed business type data as a second message, and notifying each business application of the second message;

[0089] S33: After receiving the second message, the business application queries whether the local cache space has the same data type;

[0090] S34: When the same data type exists, the business application stores the changed business type data in real time to a dedicated storage space based on the second message; when there is no same data type, it determines whether the data is hot data. When the data is not hot data, the business application discards the received second message.

[0091] In this embodiment, by parsing the business database BinLog file, such as the business DB change records of the background's product delisting and listing operations, inventory modification operations, product attribute modification operations, etc., the changed business data is obtained, and the message is asynchronously broadcast to each business application through the Kafka message channel.

[0092] After receiving the incrementally updated data, the business application queries the local cache to see whether there is existing data.

[0093] If the local cache contains data of the same type, it will be updated proactively so that when the backend management system of the business database changes, the latest data can be pushed to the local cache of the server application in real time, so that the data in the local cache can be updated and kept consistent with the records in the business database.

[0094] If there is no data of the same type in the local cache, and it is determined that the business data is not hot data, it will be discarded directly. Because the space of the local cache is limited, non-hot data is cold data and there is no need to store it in the local cache to occupy valuable cache space. Therefore, the direct discard strategy is selected to release local cache space.

[0095] In particular, when judging whether it is hot data, it is also necessary to combine the specific scenarios of the business. If a product changes from the off-shelf state to the on-shelf state, this data is hot data, because only users can buy products that are on the shelves.

[0096] S4: When receiving data request information, obtain the required data from the local cache space. Based on the received business request, obtain the required data from the local cache space, that is, the basic type of data returned by the business request, and return it after processing. For example, obtain the corresponding size information, price and inventory information based on the product size information. The business data returned after processing depends on the data of each dimension in the cache. After processing according to certain business rules, the returned data is assembled.

[0097] Furthermore, when the result obtained from the local cache space is empty, the required data is obtained from the secondary central cache, so as to penetrate into the secondary central cache to obtain the data.

[0098] Further, when the result obtained from the secondary central cache is empty, the required data is obtained from the tertiary business database or external application service to continue penetrating to the tertiary business database or external application service.

[0099] After obtaining the required data from the third-level business database or external application service, the obtained data information is written back to the corresponding local cache space and central cache, so that the data obtained from the source is reversely updated to the local cache, thereby ensuring that subsequent requests for the same type of data can directly obtain data from the local cache space or central cache without having to go back to the source to penetrate the business or external application service, thereby improving QPS and reducing response latency.

[0100] Furthermore, a method for improving the hit rate of the local cache is to intervene in the local cache space through partitioning, so that a part of the hot data can always hit the cache, reducing the situation where the hot data is kicked out; preheating the hot data in the business database to the local cache, so as to preheat the business data in advance, thereby improving the hit rate of the local cache on the server side; at the same time, when the message of the hot data stored in the dedicated storage space in real time is lost, the erroneous data can be corrected with the help of the local cache data, thereby further reducing the impact of data loss; improving the hit rate of the local cache on the server side, ensuring the overall performance of the business system, and improving the user experience.

[0101] It should be understood that the size of the serial numbers of the steps in the above embodiments 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 the present application.

[0102] Reference Figure 5 The embodiment of the present application also provides a device for improving the local cache hit rate, and the device for improving the local cache hit rate corresponds one-to-one with the method for improving the local cache hit rate in the above embodiment. The device for improving the local cache hit rate includes:

[0103] A cache management module is used to divide the local cache space into dedicated storage space and temporary storage space based on the request frequency of the data type and the space occupied by the corresponding type of data, wherein the dedicated storage space is used to store hot data that occupies a fixed space and is frequently accessed, and the temporary storage space is used to store non-hot data that occupies a large space and is infrequently accessed;

[0104] Full update task module, used to make the local cache data consistent with the data in the business database;

[0105] The incremental update task module is used to store the updated hotspot data in a dedicated storage space in real time; when the data is not hotspot data, the updated data is discarded;

[0106] The data acquisition module is used to obtain the required data from the local cache space when receiving data request information; when the result obtained from the local cache space is empty, the required data is obtained from the secondary central cache; when the result obtained from the secondary central cache is empty, the required data is obtained from the tertiary business database or external application service, and the obtained data information is reversely written into the corresponding local cache space and central cache.

[0107] For the specific definition of a device for improving the local cache hit rate, please refer to the definition of a method for improving the local cache hit rate above, which will not be repeated here. Each module in the above method for improving the local cache hit rate can be implemented in whole or in part through software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0108] Reference Figure 6 When the solution of the present application is not implemented and is run online, the daily hit rate of the local cache is about 75%. After using the solution of the present application, the hit rate of the local cache can be increased to 99%, which is a very significant effect.

[0109] In one embodiment, a computer device is provided, which may be a server. The computer device includes a processor, a memory, a network interface, and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the above-mentioned method for improving the local cache hit rate is implemented.

[0110] In one embodiment, a computer-readable storage medium is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:

[0111] Based on the request frequency of data types and the space occupied by data of corresponding types, the local cache space is divided into dedicated storage space and temporary storage space. The dedicated storage space is used to store hot data that occupies a fixed space and is frequently accessed, and the temporary storage space is used to store non-hot data that occupies a large space and is infrequently accessed.

[0112] Preheat the hot data in the business database to the local cache;

[0113] The updated hotspot data is stored in a dedicated storage space in real time;

[0114] When a data request message is received, the required data is obtained from the local cache space.

[0115] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory.

[0116] Those skilled in the art will clearly understand that for the sake of convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.

Claims

1. A method for improving a local cache hit rate, characterized in that: The following steps are involved: Based on the request frequency of data types and the space occupied by data of corresponding types, the local cache space is divided into dedicated storage space and temporary storage space. The dedicated storage space is used to store hot data that occupies a fixed space and is frequently accessed, and the temporary storage space is used to store non-hot data that occupies a large space and is infrequently accessed. Preheat the hot data in the business database to the local cache, including: Scan the business database regularly and obtain the corresponding business type data from the business database; Scanning the business database regularly, obtaining corresponding business type data from the business database is defined as a first message, and notifying each business application of the first message; After receiving the first message, the business application sets the corresponding business type data obtained from the business database into the local cache; The updated hotspot data is stored in the dedicated storage space in real time, including: Parse and obtain the changed business type data; The business type data obtained by parsing the change is defined as a second message, and the second message is notified to each business application; After receiving the second message, the business application queries whether the local cache space has the same data type; When the same data type exists, the business application stores the changed business type data in the dedicated storage space in real time according to the second message; When data request information is received, required data is obtained from the local cache space.

2. The method for improving the local cache hit rate according to claim 1, characterized in that: The step of storing the updated hotspot data in the dedicated storage space in real time also includes: When there is no identical data type, determine whether the data is hot data; When the data is not hot data, the business application discards the received second message.

3. The method for improving the local cache hit rate according to any one of claims 1 to 2, characterized in that: The following steps are also included: When the result obtained from the local cache space is empty, the required data is obtained from the secondary central cache.

4. The method for improving the local cache hit rate according to claim 3, characterized in that: The following steps are also included: When the result obtained from the secondary central cache is empty, the required data is obtained from the tertiary business database or external application service.

5. The method for improving the local cache hit rate according to claim 4, characterized in that: The following steps are also included: After the required data is obtained from the third-level business database or external application service, the obtained data information is written back to the corresponding local cache space and central cache.

6. A device for improving local cache hit rate, characterized in that: include: A cache management module is used to divide the local cache space into dedicated storage space and temporary storage space based on the request frequency of the data type and the space occupied by the corresponding type of data, wherein the dedicated storage space is used to store hot data that occupies a fixed space and is frequently accessed, and the temporary storage space is used to store non-hot data that occupies a large space and is infrequently accessed; The full update task module is used to preheat the hot data in the business database to the local cache, including scanning the business database at regular intervals to obtain the corresponding business type data from the business database; defining the scheduled scanning of the business database to obtain the corresponding business type data from the business database as a first message, and notifying each business application of the first message; upon receiving the first message, the business application sets the corresponding business type data obtained from the business database to the local cache; The incremental update task module is used to store the updated hotspot data in real time to the dedicated storage space, including parsing to obtain the changed business type data; defining the parsed business type data to obtain the changed business type data as a second message, and notifying each business application of the second message; after receiving the second message, the business application queries the local cache space for the same data type; when the same data type exists, the business application stores the changed business type data in real time to the dedicated storage space according to the second message; The data acquisition module is used to acquire required data from the local cache space when receiving data request information.

7. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and running on the processor, wherein when the processor executes the computer program, the steps of the method for improving the local cache hit rate according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for improving the local cache hit rate according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Distributed cache system and cache data updating method

    CN110753099A

  • Cache optimization via topics in web search engines

    US10503792B1