Cache processing methods, devices, terminal equipment, and storage media

By generating cache processing strategies through a multi-level caching architecture and a sliding window algorithm, the performance and stability issues of core businesses in high-traffic scenarios are resolved, and cache coverage is improved in low-traffic scenarios. This enables dynamic scaling of business scenarios and improves cache processing efficiency.

CN116719849BActive Publication Date: 2026-04-03CHINA MERCHANTS BANK
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-07
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies cannot prioritize the performance and stability of core businesses in high-traffic scenarios, and have low cache coverage in low-traffic scenarios, making it impossible to dynamically scale business scenarios, resulting in low cache processing efficiency.

Method used

A multi-level caching architecture is adopted, combined with a sliding window algorithm and filters. Caching processing strategies are generated according to business scenarios. By comparing the traffic ratio with the rate limiting threshold, an appropriate caching processing strategy is selected to prioritize core business processing in high-traffic scenarios and improve cache coverage in low-traffic scenarios.

Benefits of technology

It ensures the performance and stability of core businesses in high-traffic scenarios, improves the coverage of cache services in low-traffic scenarios, dynamically scales business scenarios, and improves cache processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116719849B_ABST
    Figure CN116719849B_ABST
Patent Text Reader

Abstract

This invention discloses a caching processing method, apparatus, terminal device, and storage medium. The method includes: obtaining a business scenario based on a preset multi-level caching architecture; generating a caching processing strategy based on the business scenario using a preset filter; obtaining the traffic percentage of the total application interface in the system's maximum traffic using a sliding window algorithm; comparing the traffic percentage with a preset rate limiting threshold, and selecting a corresponding caching processing strategy. This invention solves the problem of dynamic scaling of business scenarios in caching, reduces network data consumption, improves cache hit rate and utilization efficiency, and enhances system performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of caching technology, and in particular to a caching processing method, apparatus, terminal device, and storage medium. Background Technology

[0002] Currently, when processing business data through caching, it is impossible to prioritize the performance and stability of core business operations during high-traffic scenarios, leading to operational delays and customer dissatisfaction. In low-traffic scenarios, the caching coverage of business operations is low, and advanced caching cannot be used to process business data during low-traffic scenarios, resulting in wasted resources.

[0003] Furthermore, it cannot dynamically scale business scenarios based on the current volume of business traffic, resulting in a low cache hit rate.

[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this invention is to provide a caching processing method, apparatus, terminal device, and storage medium, aiming to solve the technical problem of low caching processing efficiency due to the inability to dynamically scale business scenarios.

[0006] To achieve the above objectives, the present invention provides a caching method, the caching method comprising:

[0007] Based on the pre-defined multi-level caching architecture, obtain the business scenario;

[0008] Based on the business scenario, a caching strategy is generated using preset filters;

[0009] The sliding window algorithm is used to obtain the percentage of total application interface traffic in the system's maximum traffic.

[0010] The traffic percentage is compared with a preset rate limiting threshold, and the corresponding caching strategy is selected.

[0011] Optionally, the step of obtaining the business scenario based on a preset multi-level caching architecture includes:

[0012] Based on the preset multi-level caching architecture, obtain the first-level cache, second-level cache, and third-level cache;

[0013] Delete the original application interface data in the first-level cache;

[0014] Based on the secondary cache, preset core business application interface data is pushed to the primary cache through a preset transmission mode;

[0015] Based on the core business application interface data, analysis is performed using preset filters;

[0016] If the analysis result indicates that the core business application interface exists in the preset filter, then the core business application interface data is saved to the first-level cache to generate the first business scenario;

[0017] Based on the secondary cache, a second business scenario is generated through the core business application interface and the preset important business application interfaces;

[0018] Based on the three-level cache, a third business scenario is generated through the core business application programming interface, the important business application programming interface, and the preset ordinary business application programming interface.

[0019] Optionally, the step of generating a caching strategy based on the business scenario using a preset filter includes:

[0020] Write the interfaces of the first business scenario, the second business scenario, and the third business scenario into the configuration to generate configuration file one, configuration file two, and configuration file three.

[0021] Based on configuration files 1, 2, and 3, preset filters are written to generate cache processing strategy 1, cache processing strategy 2, and cache processing strategy 3, respectively.

[0022] Optionally, the step of comparing the traffic percentage with a preset threshold and selecting a corresponding caching strategy includes:

[0023] Based on the traffic percentage, a comparison is obtained by comparing the data with a preset first traffic limiting threshold and a second traffic limiting threshold.

[0024] If the comparison result shows that the traffic percentage is less than the first rate limiting threshold, then the third caching strategy is selected.

[0025] If the comparison result is that the traffic percentage is above the first rate limiting threshold and less than the second rate limiting threshold, then the second caching strategy is selected.

[0026] If the comparison result shows that the traffic percentage is greater than the second rate limiting threshold, then the first caching strategy is selected.

[0027] Optionally, after the step of comparing the traffic percentage with a preset rate limiting threshold and selecting the corresponding caching strategy, the method further includes:

[0028] According to the caching strategy, a query is performed by inputting a preset filter through the main application interface to obtain the query results;

[0029] Based on the query results, obtain the application interface that uses the first-level cache.

[0030] Optionally, after the step of obtaining the application interface using the preset first-level cache based on the query result, the method further includes:

[0031] The system monitors data from preset data sources using a pre-defined monitoring mechanism.

[0032] When the data in the data source changes, the changed data is synchronized to the three-level cache;

[0033] The changed data is synchronized to the second-level cache through the three-level cache;

[0034] Based on the secondary cache, the changed data is synchronized to the primary cache using a preset transmission mode.

[0035] Optionally, the step of synchronizing the changed data to the second-level cache through the third-level cache includes:

[0036] The secondary and tertiary caches are monitored through a preset monitoring mechanism.

[0037] If the number of keys in the second-level cache is not equal to the number of keys in the third-level cache, then the data in the third-level cache is pulled and synchronized to the second-level cache.

[0038] This invention also proposes a cache processing device, the cache processing device comprising:

[0039] The acquisition module is used to obtain the business scenario based on the preset multi-level caching architecture;

[0040] The generation module is used to generate caching strategies based on preset business scenarios and preset filters.

[0041] The calculation module is used to obtain the proportion of application interface traffic in the system's maximum traffic using a sliding window algorithm;

[0042] The selection module is used to compare the traffic percentage with a preset traffic limiting threshold and select the corresponding caching strategy.

[0043] This invention also proposes a terminal device, which includes a memory, a processor, and a cache processing program stored in the memory and executable on the processor. When the cache processing program is executed by the processor, it implements the steps of the cache processing method described above.

[0044] This invention also proposes a computer-readable storage medium storing a cache processing program, which, when executed by a processor, implements the steps of the cache processing method described above.

[0045] This invention proposes a caching processing method, apparatus, terminal device, and storage medium. Based on a preset multi-level caching architecture, it obtains a business scenario; based on the business scenario, it generates a caching processing strategy through a preset filter; it obtains the traffic percentage of the total application interface within the system's maximum traffic using a sliding window algorithm; and it compares the traffic percentage with a preset rate-limiting threshold to select the corresponding caching processing strategy. This achieves priority for ensuring the performance and stability of core services in high-traffic scenarios, improved cache coverage in low-traffic scenarios, and dynamic scaling of business scenarios. It solves the problems of low caching efficiency due to the inability to dynamically scale business scenarios, thus improving the caching efficiency for business processing. Attached Figure Description

[0046] Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the cache processing device of the present invention belongs;

[0047] Figure 2 This is a flowchart illustrating an exemplary embodiment of the caching method of the present invention;

[0048] Figure 3 This is a flowchart illustrating another exemplary embodiment of the caching method of the present invention;

[0049] Figure 4 This is a schematic diagram illustrating the multi-level caching involved in the caching processing method of the present invention;

[0050] Figure 5 This is a schematic diagram of the transmission model involved in the caching processing method of the present invention;

[0051] Figure 6 This is a flowchart illustrating another exemplary embodiment of the caching method of the present invention;

[0052] Figure 7 This is a schematic diagram illustrating the generation of a cache processing strategy in the cache processing method of the present invention;

[0053] Figure 8 This is a flowchart illustrating another exemplary embodiment of the caching method of the present invention;

[0054] Figure 9 This is a schematic diagram illustrating the selection of a caching strategy in the caching processing method of the present invention;

[0055] Figure 10 This is a flowchart illustrating another exemplary embodiment of the caching method of the present invention;

[0056] Figure 11 This is a schematic diagram illustrating the caching method of the present invention involving obtaining the application interface that uses the first-level cache;

[0057] Figure 12 This is a flowchart illustrating another exemplary embodiment of the caching method of the present invention;

[0058] Figure 13 This is a schematic diagram illustrating the three-level cache data synchronization involved in the cache processing method of the present invention;

[0059] Figure 14 This is a schematic diagram illustrating the data synchronization process involved in the caching method of the present invention;

[0060] Figure 15 This is a schematic diagram illustrating the data synchronization between the second-level cache and the third-level cache in the caching processing method of the present invention.

[0061] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0062] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0063] The main solution of this invention is as follows: Based on a preset multi-level caching architecture, a first-level cache, a second-level cache, and a third-level cache are obtained; the original application interface data in the first-level cache is deleted; based on the second-level cache, preset core business application interface data is pushed to the first-level cache through a preset transmission mode; based on the core business application interface data, it is analyzed through a preset filter; if the analysis result indicates that the core business application interface exists in the preset filter, the core business application interface data is saved to the first-level cache, generating a first business scenario; based on the second-level cache, a second business scenario is generated through the core business application interface and preset important business application interfaces; based on the third-level cache, a third business scenario is generated through the core business application interface, important business application interfaces, and preset ordinary business application interfaces. The interfaces of the first, second, and third business scenarios are written into configuration files to generate configuration file one, configuration file two, and configuration file three; based on configuration file one, configuration file two, and configuration file three, preset filters are written into them respectively to generate cache processing strategy one, cache processing strategy two, and cache processing strategy three. Based on the traffic percentage, a comparison is made using a preset first rate limiting threshold and a second rate limiting threshold to obtain a comparison result. If the comparison result shows that the traffic percentage is less than the first rate limiting threshold, then the third caching strategy is selected. If the comparison result shows that the traffic percentage is above the first rate limiting threshold and less than the second rate limiting threshold, then the second caching strategy is selected. If the comparison result shows that the traffic percentage is greater than the second rate limiting threshold, then the first caching strategy is selected. According to the caching strategy, a query is performed using a preset filter input through the main application interface to obtain a query result. Based on the query result, an application interface using the first-level cache is obtained. Data in a preset data source is monitored through a preset monitoring mechanism. When the data in the data source changes, the changed data is synchronized to the third-level cache. The changed data is synchronized to the second-level cache through the third-level cache. Based on the second-level cache, the changed data is synchronized to the first-level cache through a preset transmission mode. The system monitors the second-level and third-level caches through a pre-defined monitoring mechanism. If the number of keys in the second-level cache is not equal to the number of keys in the third-level cache, data from the third-level cache is retrieved and synchronized to the second-level cache. This solves the problems of inability to dynamically scale business scenarios and low cache processing efficiency. It enables priority to ensure the performance and stability of core businesses in high-traffic scenarios, improves cache coverage in low-traffic scenarios, and allows for dynamic scaling of business scenarios, thereby improving the cache's efficiency in processing business needs.

[0064] Based on the solution of this invention, starting from the problem that real-world caching processes cannot dynamically scale business scenarios and have low caching efficiency, a caching processing method is designed in combination with caching processing strategies. The effectiveness of the caching processing method of this invention is verified in actual caching processing. Finally, the caching efficiency of the method of this invention is significantly improved.

[0065] Technical terms involved in the embodiments of this invention:

[0066] Caffeine: Caffeine is a high-performance local caching framework based on Java 8. It adopts the W-TinyLFU algorithm (combining the advantages of LUR and LFU) to achieve high cache hit rate, low memory consumption, and cache performance close to the theoretical optimum. It is an enhanced version of Guava Cache. Caffeine has the best performance in three scenarios: concurrent read, concurrent write, and concurrent read and write.

[0067] Redis: Redis is a high-performance key-value database that is completely open-source and free. It's a NoSQL database designed to address issues such as high concurrency, high scalability, and large data storage. While it's a non-relational database, it cannot replace relational databases; it can only serve as an extension in specific environments. Redis is a key-value storage database structure server that supports data structures including strings, lists, hash tables, sets, and sorted sets (Zsets). To ensure efficient read operations, Redis stores data objects in memory. It supports periodically writing updated data to disk files and provides intersection and union operations, as well as various sorting methods.

[0068] ES: ElasticSearch is a search server based on Lucene. As a highly scalable open-source full-text search and analysis engine, ElasticSearch can be used to quickly store, search, and analyze big data. ElasticSearch is developed based on Java and released as open source under the Apache License. It is a popular enterprise-level search engine.

[0069] MongoDB is an open-source database system written in C++ based on distributed file storage. Under high load, adding more nodes can ensure server performance. MongoDB aims to provide scalable, high-performance data storage solutions for web applications. MongoDB stores data as documents, and the data structure consists of key-value pairs. MongoDB documents are similar to JSON objects, and field values ​​can contain other documents, arrays, and arrays of documents.

[0070] Bloom Filter: A Bloom filter is a space-efficient deduplication data structure used to quickly determine whether an element is in a set. It is commonly used for deduplication and filtering spam data. A Bloom filter consists of a long array of binary bits and a set of hash functions. To determine if an element is in a set, the element is first hashed using the hash functions, and then the corresponding position in the binary bit array is checked for a 1 based on the hash result. Bloom filters have a false positive rate; that is, if an element is not in the set, the Bloom filter may consider it to be in the set. Therefore, a Bloom filter is not a 100% accurate deduplication data structure. However, it is superior to other data structures in terms of both space and time efficiency, and thus it is widely used in many practical applications.

[0071] Sliding window algorithm: The sliding window algorithm is a commonly used algorithm to solve substring or subsequence problems of strings or arrays. Its basic idea is to maintain a window, the size of which can be adjusted according to the requirements of the problem, and then perform operations within the window until a solution that meets the requirements is found, or the window slides to the last position. In the sliding window algorithm, each time the window is moved, only the left and right boundaries of the window need to be changed, which can avoid repeated calculations and enumerations and improve the efficiency of the algorithm. Common applications include problems such as minimum subarray, maximum subarray, and longest substring without repeating characters.

[0072] Pub / sub pattern: Pub / sub pattern is a type of message communication that is similar to message queues to some extent. Pub / sub pattern decouples two interdependent modules through a publish-subscribe pattern. The message sender sends messages to a specific topic, rather than to a specific subscriber. Similarly, the subscriber subscribes to topics of interest and receives messages from those topics. By decoupling the two modules from each other through an intermediary topic, the two tightly coupled modules do not need to care whether the other end has subscribed or whether the subscription relationship has been modified.

[0073] Watchdog: A watchdog is a hardware or software mechanism used to monitor the operating status of a system so that it can restart, recover, or trigger an alarm when a system failure or error occurs. It typically consists of a timer and a counter. The timer sends a signal to the counter periodically. If the counter fails to respond within a specified time, it indicates that a system failure or error has occurred, and the watchdog will trigger operations such as restarting or alarming to ensure the stability and reliability of the system. Watchdogs can be applied to various embedded systems, servers, network devices, and other scenarios, and are a commonly used system protection mechanism.

[0074] The embodiments of the present invention take into account that, when related technologies perform caching, they cannot prioritize the performance and stability of core services in high-traffic scenarios, cannot improve the coverage of cached services in low-traffic scenarios, cannot dynamically scale service scenarios, and have a low cache hit rate.

[0075] Therefore, this invention addresses the problem of low caching efficiency in real-world caching scenarios where business scenarios cannot be dynamically scaled. It designs a caching method based on caching strategies and verifies the effectiveness of the method in actual caching. Finally, the caching efficiency is significantly improved using this method.

[0076] Specifically, refer to Figure 1 , Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the cache processing device of the present invention belongs. The cache processing device can be an independent device capable of cache processing, and it can be implemented on the terminal device in hardware or software form. The terminal device can be a smart mobile device with data processing capabilities, such as a mobile phone or tablet computer, or it can be a fixed terminal device or server with data processing capabilities.

[0077] In this embodiment, the terminal device to which the security protection device belongs includes at least an output module 110, a processor 120, a memory 130, and a communication module 140.

[0078] The memory 130 stores the operating system and cache processing program. The cache processing device can obtain the business scenario according to the preset multi-level cache architecture; generate a cache processing strategy according to the business scenario through a preset filter; obtain the traffic ratio of the total application interface in the system's maximum traffic through a sliding window algorithm; compare the traffic ratio with a preset rate limiting threshold, and select the corresponding cache processing strategy. The cache processing device processes the data, and the cache processing results are stored in the memory 130. The output module 110 can be a display screen, etc. The communication module 140 can include a WIFI module, a mobile communication module, and a Bluetooth module, etc., and communicates with external devices or servers through the communication module 140.

[0079] When the cache handler in memory 130 is executed by the processor, it performs the following steps:

[0080] Based on the pre-defined multi-level caching architecture, obtain the business scenario;

[0081] Based on the business scenario, a caching strategy is generated using preset filters;

[0082] The sliding window algorithm is used to obtain the percentage of total application interface traffic in the system's maximum traffic.

[0083] The traffic percentage is compared with a preset rate limiting threshold, and the corresponding caching strategy is selected.

[0084] Furthermore, when the cache handler in memory 130 is executed by the processor, it also performs the following steps:

[0085] Based on the preset multi-level caching architecture, obtain the first-level cache, second-level cache, and third-level cache;

[0086] Delete the original application interface data in the first-level cache;

[0087] Based on the secondary cache, preset core business application interface data is pushed to the primary cache through a preset transmission mode;

[0088] Based on the core business application interface data, analysis is performed using preset filters;

[0089] If the analysis result indicates that the core business application interface exists in the preset filter, then the core business application interface data is saved to the first-level cache to generate the first business scenario;

[0090] Based on the secondary cache, a second business scenario is generated through the core business application interface and the preset important business application interfaces;

[0091] Based on the three-level cache, a third business scenario is generated through the core business application programming interface, the important business application programming interface, and the preset ordinary business application programming interface.

[0092] Furthermore, when the cache handler in memory 130 is executed by the processor, it also performs the following steps:

[0093] Write the interfaces of the first business scenario, the second business scenario, and the third business scenario into the configuration to generate configuration file one, configuration file two, and configuration file three.

[0094] Based on configuration files 1, 2, and 3, preset filters are written to generate cache processing strategy 1, cache processing strategy 2, and cache processing strategy 3, respectively.

[0095] Furthermore, when the cache handler in memory 130 is executed by the processor, it also performs the following steps:

[0096] Based on the traffic percentage, a comparison is obtained by comparing the data with a preset first traffic limiting threshold and a second traffic limiting threshold.

[0097] If the comparison result shows that the traffic percentage is less than the first rate limiting threshold, then the third caching strategy is selected.

[0098] If the comparison result is that the traffic percentage is above the first rate limiting threshold and less than the second rate limiting threshold, then the second caching strategy is selected.

[0099] If the comparison result shows that the traffic percentage is greater than the second rate limiting threshold, then the first caching strategy is selected.

[0100] Furthermore, when the cache handler in memory 130 is executed by the processor, it also performs the following steps:

[0101] According to the caching strategy, a query is performed by inputting a preset filter through the main application interface to obtain the query results;

[0102] Based on the query results, obtain the application interface that uses the first-level cache.

[0103] Furthermore, when the cache handler in memory 130 is executed by the processor, it also performs the following steps:

[0104] The system monitors data from preset data sources using a pre-defined monitoring mechanism.

[0105] When the data in the data source changes, the changed data is synchronized to the three-level cache;

[0106] The changed data is synchronized to the second-level cache through the three-level cache;

[0107] Based on the secondary cache, the changed data is synchronized to the primary cache using a preset transmission mode.

[0108] Furthermore, when the cache handler in memory 130 is executed by the processor, it also performs the following steps:

[0109] The secondary and tertiary caches are monitored through a preset monitoring mechanism.

[0110] If the number of keys in the second-level cache is not equal to the number of keys in the third-level cache, then the data in the third-level cache is pulled and synchronized to the second-level cache.

[0111] This embodiment, through the above-described scheme, specifically obtains the business scenario based on a preset multi-level caching architecture; generates a caching processing strategy based on the business scenario using a preset filter; obtains the traffic percentage of the total application interface in the system's maximum traffic using a sliding window algorithm; compares the traffic percentage with a preset rate limiting threshold, and selects the corresponding caching processing strategy. Caching processing based on the caching strategy can solve the problems of inability to dynamically scale business scenarios and low caching processing efficiency. Based on the present invention, starting from the problem of inability to dynamically scale business scenarios and low caching processing efficiency in real-world caching processing, a caching processing method is designed in conjunction with a caching processing strategy. The effectiveness of the caching processing method of the present invention is verified in actual caching processing, and the caching processing efficiency is significantly improved by the method of the present invention.

[0112] Based on, but not limited to, the terminal device architecture described above, embodiments of the method of the present invention are proposed.

[0113] Reference Figure 2 , Figure 2 This is a flowchart illustrating an exemplary embodiment of the caching processing method of the present invention. The caching processing method includes:

[0114] Step S01: Obtain the business scenario based on the preset multi-level caching architecture;

[0115] The execution subject of the method in this embodiment can be a cache processing device, a cache processing terminal device, or a server. This embodiment takes a cache processing device as an example, which can be integrated into a terminal device with data processing function.

[0116] In order to enable the cache to be used for the corresponding business, the following steps are taken:

[0117] First, based on the multi-level caching architecture in the system, three levels of caching are obtained. The three levels of caching have different effects on business processing. The first-level cache, also known as the local cache, has the best processing effect and response speed, and corresponds to the core business. The second-level cache is slightly worse than the first-level cache in processing business, but has a higher coverage, and corresponds to important business. The third-level cache serves as a data backup solution for the second-level cache, ensuring the high availability of data query services, and corresponds to ordinary business.

[0118] Finally, based on the three levels of caching and their corresponding business applications, the application scenarios are categorized. Level 1 scenarios correspond to core business, aiming to ensure high processing and feedback performance of core business. Level 2 scenarios correspond to core and important business, meaning that when business traffic is moderate, Level 1 caching supports the operation of both core and important business. Level 3 scenarios correspond to core, important, and ordinary business, meaning that when business traffic is low, Level 1 caching supports the operation of core, important, and ordinary business.

[0119] Step S02: Based on the business scenario, generate a caching strategy using a preset filter;

[0120] After obtaining the business scenario, the following steps are taken to set the processing strategy:

[0121] First, obtain the business scenarios corresponding to the three levels. Each level corresponds to a local caching strategy under different traffic conditions.

[0122] Then, the interfaces for each business scenario are written into the configuration file, resulting in three corresponding configuration files;

[0123] Then, the configuration file is written into the Bloom filter, so that the Bloom filter can identify the corresponding application interface in the subsequent policy selection.

[0124] Finally, the first-level scenario corresponds to generation strategy one, where the first-level cache prioritizes core business operations under high traffic conditions. The second-level scenario corresponds to generation strategy two, where the first-level cache processes core and important business operations under moderate traffic conditions to improve business coverage. The third-level scenario corresponds to generation strategy three, where the first-level cache processes core, important, and ordinary business operations under low traffic conditions to facilitate efficient business operations and avoid wasting cache resources.

[0125] Step S03: Obtain the percentage of total application interface traffic in the system's maximum traffic using the sliding window algorithm;

[0126] After obtaining the caching strategy, the following steps are taken to determine the traffic scenario:

[0127] First, the sliding window algorithm is used to count the traffic used by the application interface currently processing business. The sliding window algorithm is a commonly used algorithm to solve some substring or subsequence problems of strings or arrays. Common applications include minimum subarray, maximum subarray, and longest substring without repeating characters.

[0128] Then, the maximum concurrent traffic capacity is determined through stress testing;

[0129] Finally, the application's usage traffic value is compared with the maximum traffic value to obtain the percentage of the application interface traffic currently processing business within the system's maximum traffic.

[0130] Step S04: Compare the traffic percentage with the preset traffic limiting threshold and select the corresponding caching strategy.

[0131] After obtaining the traffic percentage, the following steps are taken to select the appropriate caching strategy:

[0132] First, the traffic percentage is compared with the rate limiting threshold to obtain the comparison results. The rate limiting threshold is set according to the user and can be adjusted according to business needs or the popularity of the current business.

[0133] Then, based on the obtained comparison results, the corresponding caching strategy is selected to process the current business. In high-traffic scenarios, priority is given to ensuring the processing of core businesses. In moderate-traffic scenarios, priority is given to ensuring the processing of core and important businesses. In low-traffic scenarios, the cache coverage should be increased, and the first-level cache should be used to process core, important, and ordinary businesses.

[0134] This embodiment, through the above-described scheme, specifically obtains the business scenario based on a preset multi-level caching architecture; generates a caching processing strategy based on the business scenario using a preset filter; obtains the traffic percentage of the total application interface in the system's maximum traffic using a sliding window algorithm; compares the traffic percentage with a preset rate limiting threshold, and selects the corresponding caching processing strategy. This solves the problems of inability to dynamically scale business scenarios and low caching processing efficiency, achieving priority for ensuring the performance and stability of core businesses in high-traffic scenarios, improving cache coverage in low-traffic scenarios, and dynamically scaling business scenarios, thereby improving the caching efficiency for business processing.

[0135] Reference Figure 3 , Figure 3This is a flowchart illustrating another exemplary embodiment of the caching processing method of the present invention.

[0136] Based on the above Figure 2 In the embodiment shown, step S01, which involves obtaining the business scenario based on a preset multi-level caching architecture, includes:

[0137] Step S011: Obtain the first-level cache, second-level cache, and third-level cache according to the preset multi-level cache architecture;

[0138] Step S012: Delete the original application interface data in the first-level cache;

[0139] Step S013: Based on the secondary cache, push the preset core business application interface data to the primary cache through a preset transmission mode;

[0140] Step S014: Analyze the core business application interface data using a preset filter;

[0141] Step S015: If the analysis result indicates that the core business application interface exists in the preset filter, then the core business application interface data is saved to the first-level cache to generate the first business scenario.

[0142] Step S016: Based on the secondary cache, generate a second business scenario through the core business application interface and the preset important business application interface;

[0143] Step S017: Based on the three-level cache, a third business scenario is generated through the core business application interface, the important business application interface, and the preset ordinary business application interface.

[0144] Specifically, in order to achieve the mapping between corresponding scenarios and corresponding business operations, the following steps are taken:

[0145] First, based on the system's multi-level caching architecture, the first-level cache, second-level cache, and third-level cache are obtained, such as... Figure 4 As shown, Figure 4This diagram illustrates the multi-level caching method of the present invention. MongoDB is used as the database system. Under high load, adding more nodes can ensure server performance. The third-level cache refers to Elasticsearch (ES), which can quickly store, search, and analyze big data. The second-level cache refers to Redis, a NoSQL database that can solve a series of problems such as high concurrency, high scalability, and big data storage. The first-level cache can also be called a local cache. In this embodiment, it refers to Caffeine, which achieves high cache hit rate and low memory consumption. Its cache performance is close to the theoretical optimal, and it has the best performance in three scenarios: concurrent read, concurrent write, and concurrent read-write.

[0146] Then, the existing application interface data in the first-level cache is deleted. Based on the business adjustments, some business data is deleted from the first-level cache to facilitate the addition of application interfaces for core businesses in the future.

[0147] Then, through the second-level cache, the core business application interface data to be added to the first-level cache is pushed to the first-level cache, using a pub / sub pattern, such as... Figure 5 As shown, Figure 5 This is a schematic diagram of the transmission model involved in the caching processing method of the present invention. The pub / sub mode is a type of message communication, which is similar to message queues to some extent. The pub / sub mode decouples two interdependent modules through the subscription and publish pattern. The message sender sends messages to a specific topic, rather than to a specific subscriber. Similarly, the subscriber receives messages from topics of interest by subscribing to topics of interest.

[0148] Then, the application interface data received from the first-level cache is analyzed by a Bloom filter. If the result shows that the application interface exists in the Bloom filter, the core business application interface data is saved to the first-level cache and an expiration time is set, thus generating the first business scenario. When the application interface does not exist in the Bloom filter, the data change is ignored.

[0149] Then, the core business application interfaces and important business application interfaces are saved to the second-level cache to generate the second business scenario;

[0150] Finally, the core business application programming interfaces (APIs), important business APIs, and ordinary business APIs are all saved to a three-level cache to generate a third business scenario.

[0151] Furthermore, in this embodiment, the main purpose is to achieve multi-level scenario setup for different services. This is mainly reflected in the first-level scenario, where the first-level cache only prioritizes core services; in the second-level scenario, the first-level cache processes both core and important services; and in the third-level scenario, the cache processes core, important, and ordinary services simultaneously. In this embodiment, the processing scenarios and services of the first-level cache are limited, but in actual use, they should be considered adjustable, such as the cache level and the service level.

[0152] This embodiment, through the above-described scheme, specifically obtains a first-level cache, a second-level cache, and a third-level cache according to a preset multi-level caching architecture; deletes the original application interface data in the first-level cache; pushes preset core business application interface data to the first-level cache according to the second-level cache using a preset transmission mode; analyzes the core business application interface data through a preset filter; if the analysis result shows that the core business application interface exists in the preset filter, the core business application interface data is saved to the first-level cache, generating a first business scenario; based on the second-level cache, a second business scenario is generated through the core business application interface and preset important business application interfaces; based on the third-level cache, a third business scenario is generated through the core business application interface, important business application interfaces, and preset ordinary business application interfaces. This solves the problems of inability to dynamically scale business scenarios and low caching efficiency, achieving priority for core business performance and stability in high-traffic scenarios, improved cache business coverage in low-traffic scenarios, and dynamic scaling of business scenarios, thus improving the caching efficiency for business processing.

[0153] Reference Figure 6 , Figure 6 This is a flowchart illustrating another exemplary embodiment of the caching processing method of the present invention.

[0154] Based on the above Figure 2 In the embodiment shown, step S02, which involves generating a caching strategy based on a preset filter according to the business scenario, includes:

[0155] Step S021: Write the interfaces of the first business scenario, the second business scenario, and the third business scenario into the configuration to generate configuration file one, configuration file two, and configuration file three.

[0156] Step S022: Based on the configuration file 1, configuration file 2 and configuration file 3, write the preset filters respectively to generate cache processing strategy 1, cache processing strategy 2 and cache processing strategy 3.

[0157] Specifically, in order to implement corresponding caching strategies for business scenarios, the following steps are taken:

[0158] First, the interfaces for the first, second, and third business scenarios are written into configuration files, generating Configuration File 1, Configuration File 2, and Configuration File 3. The first business scenario stores core business application interfaces, the second business scenario stores core business application interfaces and important business application interfaces, and the third business scenario stores core business application interfaces, important business application interfaces, and ordinary business application interfaces. By writing these configurations, the business scenarios aggregate the application interfaces, reducing resource waste.

[0159] Finally, configuration files 1, 2, and 3 are written into the Bloom filter to generate cache processing strategies 1, 2, and 3, respectively.

[0160] More specifically, such as Figure 7 As shown, Figure 7 This is a schematic diagram illustrating the generation of cache processing strategies in the cache processing method of the present invention. After the business scenario is classified, the first-level scenario is added to the Bloom filter through configuration to generate cache processing strategy one, the second-level scenario is added to the Bloom filter through configuration to generate cache processing strategy two, and the third-level scenario is added to the Bloom filter through configuration to generate cache processing strategy three.

[0161] This embodiment, through the above-described scheme, specifically generates configuration files one, two, and three by writing the interfaces of the first, second, and third business scenarios into the configuration; and then, based on configuration files one, two, and three, pre-defined filters are written to generate cache processing strategy one, cache processing strategy two, and cache processing strategy three. This achieves the generation of cache processing strategies, solves the problem of dynamically processing different cache processing methods, and improves the efficiency of cache processing.

[0162] Reference Figure 8 , Figure 8 This is a flowchart illustrating another exemplary embodiment of the caching processing method of the present invention.

[0163] Based on the above Figure 2 In the embodiment shown, step S04, which compares the traffic percentage with a preset rate limiting threshold and selects the corresponding caching strategy, includes:

[0164] Step S041: Based on the traffic ratio, compare the data using a preset first traffic limiting threshold and a second traffic limiting threshold to obtain a comparison result;

[0165] Step S042: If the comparison result is that the traffic ratio is less than the first rate limiting threshold, then the third caching strategy is selected.

[0166] Step S043: If the comparison result is that the traffic ratio is above the first rate limiting threshold and less than the second rate limiting threshold, then the second caching strategy is selected.

[0167] Step S044: If the comparison result is that the traffic ratio is greater than the second rate limiting threshold, then the first caching strategy is selected.

[0168] Specifically, in order to select a caching strategy, the following steps are taken:

[0169] First, based on the pre-obtained traffic percentage, a comparison is made between the first and second rate limiting thresholds to obtain a comparison result. The size of the traffic percentage is determined by the currently running application and the caching strategy is selected dynamically based on changes in the actual traffic percentage. The first and second rate limiting thresholds can also be adjusted by the user. In this embodiment, the first rate limiting threshold is less than the second rate limiting threshold; in other embodiments, the opposite may be true.

[0170] Then, if the comparison result shows that the traffic percentage is less than the first rate limiting threshold, the current traffic is considered to be a low traffic scenario, and caching processing strategy three is used to process the current business using the first-level cache.

[0171] Then, if the comparison result shows that the traffic percentage is greater than or equal to the first rate limiting threshold and less than the second rate limiting threshold, then the current traffic is considered to be a moderate traffic scenario, and the second caching strategy is used for caching, that is, the first-level cache ensures the processing of core business and important business.

[0172] Finally, if the comparison result shows that the traffic percentage is greater than or equal to the second rate limiting threshold, then the current traffic is considered to be a high-traffic scenario, and caching processing strategy one is used for caching processing, that is, the first-level cache only guarantees the processing of core business.

[0173] More specifically, such as Figure 9 As shown, Figure 9This is a schematic diagram illustrating the selection of a caching strategy in the caching processing method of the present invention. First, the current system's TPS (transactions per second) is calculated using a sliding window, which can also be understood as traffic. Then, the proportion of traffic in the maximum system traffic is calculated using the traffic. If the traffic threshold A (i.e., the aforementioned traffic threshold 1) is not reached, strategy three is executed. If the traffic threshold A is reached, the traffic proportion is compared with the traffic threshold B (i.e., the aforementioned traffic threshold 2). If the traffic threshold B is not reached, strategy two is executed. If the traffic threshold B is reached, strategy one is executed.

[0174] This embodiment, through the above-described scheme, specifically compares the traffic percentage with preset first and second rate-limiting thresholds to obtain a comparison result. If the comparison result shows that the traffic percentage is less than the first rate-limiting threshold, then the third caching strategy is selected; if the comparison result shows that the traffic percentage is above the first rate-limiting threshold and less than the second rate-limiting threshold, then the second caching strategy is selected; if the comparison result shows that the traffic percentage is greater than the second rate-limiting threshold, then the first caching strategy is selected. Thus, the selection of caching strategies is achieved, solving the problem of the inability to dynamically process caches during caching and improving the efficiency of caching.

[0175] Reference Figure 10 , Figure 10 This is a flowchart illustrating another exemplary embodiment of the caching processing method of the present invention.

[0176] Based on the above Figure 2 In the embodiment shown, after step S04, which involves comparing traffic proportions using a preset threshold to select a corresponding caching strategy, the caching method further includes:

[0177] Step S05: According to the cache processing strategy, query the results by inputting a preset filter through the main application interface;

[0178] Step S06: Based on the query results, obtain the application interface that uses the first-level cache.

[0179] Specifically, after selecting the corresponding caching strategy, the following steps are taken to obtain the application interfaces that can currently use the first-level cache:

[0180] First, based on the selected caching strategy, the query application interface is determined and the query results are obtained. The query application interface uses a Bloom filter, which is a space-efficient deduplication data structure. Its function is to quickly determine whether an element is in a set. It is usually used for deduplication, filtering of garbage data, and other scenarios.

[0181] Finally, based on the results of the Bloom filter, the application interface currently using the first-level cache can be obtained.

[0182] More specifically, such as Figure 11 As shown, Figure 11 This is a schematic diagram illustrating the caching processing method of the present invention, which involves obtaining the application interface that uses the first-level cache.

[0183] First, the application interface is entered into a Bloom filter for querying. If it does not exist, it is entered into Redis (i.e., the second-level cache) for querying. If it exists, it is entered into Caddeine (i.e., the first-level cache) for querying.

[0184] Then, if the query result in Caffeine exists, it is returned, that is, the output result is the application using the first-level cache; if the query result does not exist, it is input to Redis for querying.

[0185] Then, if the query result in Redis does not exist, it continues to query ES (i.e., the third-level cache). If it exists, it is pushed to the first-level cache and the Bloom filter is used to query again.

[0186] Then, if the query result in ES does not exist, it is returned, that is, the output result is that the application interface does not use the first-level cache. If the query result exists, the data is stored in Redis and pushed to the first-level cache, and then the Bloom filter is used to query again.

[0187] Finally, Caffenine is verified again using the Bloom filter. If the data transmission from Redis to Caffenine is normal, the verification result is that the application interface exists. The application interface is then stored in Caffenine and returned, with the output result indicating that the application uses the first-level cache. If the data transmission is abnormal and the Bloom filter cannot verify it, the result is returned, with the output result indicating that the application does not use the first-level cache.

[0188] This embodiment, through the above-described scheme, specifically by querying the main application interface using a preset filter according to the caching strategy, obtains the query results; and based on the query results, retrieves the application interface that uses the first-level cache. This achieves querying using the first-level cache application interface, solving the problem of low caching efficiency and improving caching efficiency.

[0189] Reference Figure 12 , Figure 12 This is a flowchart illustrating another exemplary embodiment of the caching processing method of the present invention.

[0190] Based on the above Figure 10In the embodiment shown, after step S06, which involves obtaining the application programming interface (API) using the first-level cache based on the query result, the caching method further includes:

[0191] Step S07: Monitor data in a preset data source through a preset monitoring mechanism;

[0192] Step S08: When the data in the data source changes, the changed data is synchronized to the three-level cache;

[0193] Step S09: Synchronize the changed data to the second-level cache through the third-level cache;

[0194] Step S10: Based on the secondary cache, synchronize the changed data to the primary cache using a preset transmission mode.

[0195] Specifically, to achieve synchronization of the three-level cache data, the following steps are taken:

[0196] First, monitor the data in the data source to obtain information on data changes;

[0197] Then, if a data change notification is received, the changed data will be synchronized to the level 3 cache.

[0198] Then, the second-level cache obtains the changed data in the third-level cache through monitoring and pulls it into the second-level cache;

[0199] Finally, the second-level cache synchronizes updated data to the first-level cache using a pub / sub pattern.

[0200] More specifically, such as Figure 13 As shown, Figure 13 This is a schematic diagram illustrating the three-level cache data synchronization involved in the cache processing method of the present invention.

[0201] First, in this embodiment, there are two data synchronization schemes: full synchronization, which means that the data is fully synchronized to the third-level cache at a fixed time every day, and then synchronized from the third-level cache to the second-level cache; and incremental update, which means that changes to the data in the data source MongoDB are monitored through a strategy, and if there are changes, the second-level cache and the third-level cache are synchronized accordingly.

[0202] Alternatively, a combination of the two methods can be used, namely... Figure 13 As shown, the data from the data source is synchronized to the third-level cache every day at midnight, and then synchronized from the third-level cache to the second-level cache.

[0203] Finally, monitor data changes in the data source. If there are no changes, continue monitoring. If data changes occur, synchronize the data in the data source to the third-level cache, and then from the third-level cache to the second-level cache. The time for full synchronization can be changed by the user.

[0204] This embodiment, through the above-described scheme, specifically monitors data in a preset data source using a preset monitoring mechanism; when the data in the data source changes, the changed data is synchronized to the third-level cache; through the third-level cache, the changed data is synchronized to the second-level cache; and based on the second-level cache, the changed data is synchronized to the first-level cache using a preset transmission mode. This achieves data synchronization within the cache, solving the problem of slow processing speed caused by data asynchrony during cache use, and improving cache processing efficiency.

[0205] Reference Figure 14 , Figure 14 This is a schematic diagram illustrating the data synchronization process involved in the caching method of the present invention.

[0206] Based on the above Figure 12 In the embodiment shown, step S09, which involves synchronizing the changed data to the second-level cache through the third-level cache, includes:

[0207] Step S091: Monitor the level 2 cache and level 3 cache through a preset monitoring mechanism;

[0208] Step S092: If the number of keys in the second-level cache is not equal to the number of keys in the third-level cache, then pull the data from the third-level cache and synchronize it to the second-level cache.

[0209] Specifically, to synchronize data from the L3 cache to the L2 cache, the following steps are taken:

[0210] First, the watchdog task monitors whether the number of keys in the L2 and L3 caches are the same. A watchdog is a hardware or software mechanism used to monitor the operating status of a system so that it can restart, recover, or alarm when a system failure or error occurs. It usually consists of a timer and a counter. The timer sends a signal to the counter periodically. If the counter fails to respond within a specified time, it indicates that a system failure or error has occurred, and the watchdog will trigger operations such as restarting or alarming to ensure the stability and reliability of the system. Watchdogs can be applied to various embedded systems, servers, network devices, and other scenarios, and are a commonly used system protection mechanism.

[0211] Finally, when the number of keys in the L3 cache and the L2 cache are different, the L2 cache issues a data synchronization request and actively pulls data from Elasticsearch to synchronize it into the L2 cache.

[0212] More specifically, refer to Figure 15 , Figure 15 This is a schematic diagram of the caching processing method of the present invention involving the synchronization of data between the second-level cache and the third-level cache. A watchdog task monitors the data in the second-level cache and the third-level cache. If the data has not changed, the monitoring continues; if the data has changed, the data synchronization is performed.

[0213] This embodiment, through the above-described scheme, specifically through a preset monitoring mechanism, monitors the second-level cache and the third-level cache. If the number of keys in the second-level cache is not equal to the number of keys in the third-level cache, data is retrieved from the third-level cache and synchronized to the second-level cache. This achieves data synchronization between caches, solves the problem of slow processing speed caused by data asynchrony during cache use, and improves cache processing efficiency.

[0214] Furthermore, embodiments of the present invention also propose a cache processing device, the cache processing device comprising:

[0215] The acquisition module is used to obtain the business scenario based on the preset multi-level caching architecture;

[0216] The generation module is used to generate caching strategies based on preset business scenarios and preset filters.

[0217] The calculation module is used to obtain the proportion of application interface traffic in the system's maximum traffic using a sliding window algorithm;

[0218] The selection module compares the traffic percentage with a preset rate limiting threshold and selects the corresponding caching strategy.

[0219] Furthermore, this embodiment of the invention also proposes a terminal device, which includes a memory, a processor, and a cache processing program stored in the memory and executable on the processor. When the cache processing program is executed by the processor, it implements the steps of the cache processing method described above.

[0220] Since this cache processing program employs all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought about by all the technical solutions of all the aforementioned embodiments, which will not be elaborated here.

[0221] Furthermore, embodiments of the present invention also propose a computer-readable storage medium storing a cache processing program, which, when executed by a processor, implements the steps of the cache processing method described above.

[0222] Since this cache processing program employs all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought about by all the technical solutions of all the aforementioned embodiments, which will not be elaborated here.

[0223] Compared to existing technologies, the caching processing method, apparatus, terminal device, and storage medium proposed in this invention obtain business scenarios based on a preset multi-level caching architecture; generate caching processing strategies based on the business scenarios using preset filters; obtain the traffic percentage of the total application interface in the system's maximum traffic using a sliding window algorithm; compare the traffic percentage with a preset rate limiting threshold, and select the corresponding caching processing strategy. This solves the problems of inability to dynamically scale business scenarios and low caching processing efficiency, achieving priority for ensuring the performance and stability of core businesses in high-traffic scenarios, improved cache coverage in low-traffic scenarios, and dynamic scaling of business scenarios. Based on this invention, starting from the problem of inability to dynamically scale business scenarios and low caching processing efficiency in real-world caching, a caching processing method is designed in conjunction with caching processing strategies. The effectiveness of the caching processing method of this invention is verified in actual caching processing, and the caching processing efficiency is significantly improved by the method of this invention.

[0224] Compared with existing technologies, the solutions of the embodiments of the present invention have the following advantages:

[0225] 1. In high-traffic scenarios, priority should be given to ensuring the performance and stability of core business operations;

[0226] 2. Improve the coverage of cached services in low-traffic scenarios;

[0227] 3. Dynamically scale business scenarios to improve cache hit rate.

[0228] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0229] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0230] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the methods of each embodiment of the present invention.

[0231] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A caching method, characterized in that, The caching method includes the following steps: Based on the pre-defined multi-level caching architecture, obtain the business scenario; The step of obtaining the business scenario based on the preset multi-level caching architecture includes: Based on the preset multi-level caching architecture, obtain the first-level cache, second-level cache, and third-level cache; Delete the original application interface data in the first-level cache; Based on the secondary cache, preset core business application interface data is pushed to the primary cache through a preset transmission mode; Based on the core business application interface data, analysis is performed using preset filters; If the analysis result indicates that the core business application interface exists in the preset filter, then the core business application interface data is saved to the first-level cache to generate the first business scenario; Based on the secondary cache, a second business scenario is generated through the core business application interface and the preset important business application interfaces; Based on the three-level cache, a third business scenario is generated through the core business application programming interface, the important business application programming interface, and the preset ordinary business application programming interface. Based on the business scenario, a caching strategy is generated using preset filters; The sliding window algorithm is used to obtain the percentage of total application interface traffic in the system's maximum traffic. The traffic percentage is compared with a preset rate limiting threshold, and the corresponding caching strategy is selected.

2. The caching method according to claim 1, characterized in that, The step of generating a caching strategy based on the business scenario and using a preset filter includes: Write the interfaces of the first business scenario, the second business scenario, and the third business scenario into the configuration to generate configuration file one, configuration file two, and configuration file three. Based on configuration files 1, 2, and 3, preset filters are written to generate cache processing strategy 1, cache processing strategy 2, and cache processing strategy 3, respectively.

3. The caching method according to claim 2, characterized in that, The step of comparing the traffic percentage with a preset threshold and selecting the corresponding caching strategy includes: Based on the traffic percentage, a comparison is obtained by comparing the data with a preset first traffic limiting threshold and a second traffic limiting threshold. If the comparison result shows that the traffic percentage is less than the first rate limiting threshold, then the third caching strategy is selected. If the comparison result is that the traffic percentage is above the first rate limiting threshold and less than the second rate limiting threshold, then the second caching strategy is selected. If the comparison result shows that the traffic percentage is greater than the second rate limiting threshold, then the first caching strategy is selected.

4. The caching method according to claim 3, characterized in that, Following the step of comparing the traffic percentage with a preset rate limiting threshold and selecting the corresponding caching strategy, the process further includes: According to the caching strategy, a query is performed by inputting a preset filter through the main application interface to obtain the query results; Based on the query results, obtain the application interface that uses the first-level cache.

5. The caching method according to claim 4, characterized in that, After the step of obtaining the application interface using the preset first-level cache based on the query result, the method further includes: The system monitors data from preset data sources using a pre-defined monitoring mechanism. When the data in the data source changes, the changed data is synchronized to the three-level cache; The changed data is synchronized to the second-level cache through the three-level cache; Based on the secondary cache, the changed data is synchronized to the primary cache using a preset transmission mode.

6. The caching method according to claim 5, characterized in that, The step of synchronizing the changed data to the second-level cache through the third-level cache includes: The secondary and tertiary caches are monitored through a preset monitoring mechanism. If the number of keys in the second-level cache is not equal to the number of keys in the third-level cache, then the data in the third-level cache is pulled and synchronized to the second-level cache.

7. A cache processing device, characterized in that, The cache processing device includes: The acquisition module is used to obtain the business scenario based on the preset multi-level caching architecture; The acquisition module is also used to acquire the first-level cache, the second-level cache, and the third-level cache according to the preset multi-level cache architecture; Delete the original application interface data in the first-level cache; Based on the secondary cache, preset core business application interface data is pushed to the primary cache through a preset transmission mode; Based on the core business application interface data, analysis is performed using preset filters; If the analysis result indicates that the core business application interface exists in the preset filter, then the core business application interface data is saved to the first-level cache to generate the first business scenario; Based on the secondary cache, a second business scenario is generated through the core business application interface and the preset important business application interfaces; Based on the three-level cache, a third business scenario is generated through the core business application programming interface, the important business application programming interface, and the preset ordinary business application programming interface. The generation module is used to generate caching strategies based on preset business scenarios and preset filters. The calculation module is used to obtain the percentage of application interface traffic in the system's maximum traffic using a sliding window algorithm; The selection module is used to compare the traffic percentage with a preset traffic limiting threshold and select the corresponding caching strategy.

8. A terminal device, characterized in that, The terminal device includes a memory, a processor, and a cache processing program stored in the memory and executable on the processor. When the cache processing program is executed by the processor, it implements the steps of the cache processing method as described in any one of claims 1-6.

9. A calculator-readable storage medium, characterized in that, The computer-readable storage medium stores a cache processing program, which, when executed by a processor, implements the steps of the cache processing method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Data caching method and device, equipment and storage medium

    CN115687423A

  • Cache elimination strategy switching method and device, electronic equipment and storage medium

    CN115858423A