Data cache management method and system and electronic equipment
By using a dynamic sliding time window detection algorithm and multi-dimensional information perception, the caching strategy is dynamically adjusted, which solves the performance problem of the caching system caused by the fixed time-to-live strategy and achieves more efficient cache management and adaptive capabilities.
Patent Information
- Application Number
- CN202610002858.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-05
- Publication Date
- 2026-02-03
AI Technical Summary
Existing data caching strategies based on fixed lifespans result in hot data becoming invalid prematurely and cold data occupying storage space for extended periods, impacting caching system performance and resource utilization. They also lack adaptability, have inadequate time window management, and lack load awareness, making them unable to meet the needs of different business scenarios.
By employing a dynamic sliding time window detection algorithm and multi-dimensional information perception, and by acquiring cached data access events, application business scenarios, and system load status in real time, the algorithm dynamically calculates the strategy adjustment factor to adjust the lifetime and lifecycle management of cached data.
It improves the effective utilization of cache space, enhances the system's adaptability in the face of business changes and sudden access pressure, improves the performance and resource utilization efficiency of the caching system, and ensures the accuracy and flexibility of lifecycle management.
Smart Images

Figure CN121456017A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data cache management technology, and in particular to a data cache management method, system and electronic device. Background Technology
[0002] Currently, mainstream data caching systems generally employ a fixed-time-to-live (TTL) caching strategy for managing the lifecycle of cached data. The core implementation of this strategy involves setting a fixed expiration time for data when it is written to the cache. Expired data is removed through a scheduled cleanup mechanism or a lazy deletion strategy; that is, cached data automatically expires after its cached time exceeds the set TTL. During subsequent data usage, if the required data is not found in the cache, it needs to be reloaded from the backend data source.
[0003] While this fixed-lifetime data caching strategy is simple to implement and can meet basic data caching needs in most scenarios, its fixed lifetime leads to problems such as hot or valuable data becoming invalid prematurely, while cold or worthless data occupying valuable storage space for extended periods, resulting in poor performance of the data caching system.
[0004] Therefore, current data caching strategies based on fixed lifespans have the problem of affecting the performance of data caching systems. Summary of the Invention
[0005] The purpose of this application is to address the performance issues of data caching systems caused by data caching strategies based on fixed lifespan.
[0006] To address the aforementioned technical problems, in a first aspect, this application discloses a data cache management method applied to a data caching system. The method includes: acquiring target information, which includes at least one of cached data access event information, application business scenario information, and system load status information; the cached data access event information is obtained based on window data of a target detection time window acquired using a dynamic sliding time window detection algorithm; determining a corresponding strategy adjustment factor based on the target information using a data cache strategy adjustment algorithm, and adjusting the data caching strategy for the corresponding cached data based on the strategy adjustment factor; the data caching strategy includes a lifetime; and performing cache management on the corresponding cached data according to the adjusted data caching strategy, the cache management including lifecycle management.
[0007] By employing the above method, during the data cache management process, multi-dimensional target information such as cached data access events, application business scenarios, and system load status are acquired in real time. This allows for real-time perception of target information and dynamic calculation of strategy adjustment factors. This enables cache data adjustment strategies, such as cached data lifetime, to be more closely matched with factors like the actual popularity, business value, and system environment of the cached data, thereby improving the effective utilization of cache space. Furthermore, by comprehensively considering cached data access events, application business scenarios, and system load status, the actual value and necessity of cached data can be assessed more comprehensively and accurately. For example, under high load, the cache lifecycle of non-critical data can be shortened to release resources, while under low load, the cache time of potentially hot data can be appropriately extended to prevent performance fluctuations. Therefore, this dynamic data cache strategy adjustment method based on multi-source, multi-dimensional information not only improves the performance indicators of the data caching system, such as hit rate, response time, and throughput, but also enhances the system's adaptability to business changes, sudden access pressure, or scenario switching, thus improving the overall performance of the data caching system.
[0008] Furthermore, by introducing a dynamic sliding time window detection algorithm, the accuracy and timeliness of capturing cache access timing characteristics are enhanced. Compared to a fixed time window, a dynamic sliding window can more sensitively identify abrupt changes, periodic patterns, or trend changes in access patterns, thus providing a more timely and accurate window data basis for policy adjustments. This allows cache policy adjustments to keep pace with changes in actual access demands, avoiding policy failures due to information lag, ensuring the accuracy of cache management decisions such as lifecycle management, improving system resource utilization efficiency, and further guaranteeing or enhancing the performance of the data caching system.
[0009] In one possible implementation of the first aspect above, when the target information only includes cached data access event information, the policy adjustment factor is an access adjustment factor. Based on the data caching policy adjustment algorithm, the corresponding policy adjustment factor is determined according to the target information, and the data caching policy of the corresponding cached data is adjusted according to the policy adjustment factor. This includes: determining the data popularity information of the corresponding cached data according to the cached data access event information, as the access adjustment factor; and determining the adjusted lifetime of the corresponding cached data according to the access adjustment factor and the basic lifetime.
[0010] By employing the above method, the actual usage frequency of data can be directly reflected through cached data access event information. By applying access adjustment factors to the base lifetime, the lifespan of cached data can be dynamically adjusted. This improves the utilization efficiency of cache space, ensures that frequently accessed data is retained for longer, reduces the risk of cache penetration due to unreasonable eviction, and makes lifecycle management of cached data more reasonable and accurate, thereby enhancing the performance of the data caching system.
[0011] In one possible implementation of the first aspect above, determining the data popularity information of the corresponding cached data based on the cached data access event information includes: determining data access frequency indication information, data access time freshness indication information, and data importance indication information based on the cached data access event information; and determining the data popularity information of the corresponding cached data based on the data access frequency indication information, data access time freshness indication information, and data importance indication information.
[0012] By employing the above method, features are comprehensively extracted from cached data access event information from three dimensions: access frequency, access time freshness, and data importance. This forms a multi-dimensional data popularity evaluation system, making the determination of data popularity more comprehensive and objective. Popularity calculation based on multi-dimensional features avoids the one-sidedness of single-indicator evaluation, more accurately distinguishes the actual value and usage trends of different data, and thus supports more refined cache lifecycle management decisions. This makes lifecycle management of cached data more reasonable and accurate, and improves the adaptability of the data caching system under diverse access modes, thereby enhancing the performance of the data caching system.
[0013] In one possible implementation of the first aspect above, when the cached data access event information includes the number of data accesses, the data access time, and the size of the accessed data, and the data popularity information is a data popularity score, the data access frequency indication information, the data access time freshness indication information, and the data importance indication information are determined based on the cached data access event information. This includes: determining the corresponding access frequency weight as the data access frequency indication information based on the number of data accesses; determining the corresponding time distribution weight as the data access time freshness indication information based on the data access time; and determining the corresponding data size weight as the data importance indication information based on the size of the accessed data. The data popularity information of the corresponding cached data is then determined based on the data access frequency indication information, the data access time freshness indication information, and the data importance indication information. This includes: determining the data popularity score of the corresponding cached data based on the access frequency weight, the time distribution weight, and the data size weight, as well as the weight coefficients corresponding to each weight.
[0014] By employing the above method, data access frequency, access time distribution, and access data size are quantified into corresponding weighted indicators, and configurable weight coefficients are introduced to form a structured data popularity score calculation model. This makes the popularity of different cached data comparable and sortable. It enhances the systematic nature and operability of cache management decisions, supports batch strategy adjustments based on score priorities, further improves the accuracy of cache management and system execution efficiency, and makes lifecycle management of cached data more reasonable and accurate, thereby improving the performance of the data caching system.
[0015] In one possible implementation of the first aspect above, when the target information includes cached data access event information and system load status information, the policy adjustment factor includes an access adjustment factor and a load adjustment factor. Based on the data caching policy adjustment algorithm, the corresponding policy adjustment factor is determined according to the target information, and the data caching policy of the corresponding cached data is adjusted according to the policy adjustment factor. This includes: determining the access adjustment factor based on the cached data access event information; determining the load adjustment factor based on the system load status information; and determining the adjusted lifetime of the corresponding cached data based on the access adjustment factor, the load adjustment factor, and the base lifetime.
[0016] By employing the above method and simultaneously introducing access and load adjustment factors, the caching strategy achieves bidirectional adjustment capabilities when adjusting the lifetime of cached data, taking into account both data access characteristics and the real-time system load. Under high system load, the load adjustment factor can appropriately suppress the lifetime of low-priority data, freeing up cache and system resources; under low load, it can appropriately extend the data's lifetime based on access frequency to improve subsequent access performance. This enhances the adaptive resource adaptation capability of the data caching system under different load scenarios, making the lifecycle management of cached data more reasonable and accurate, and ultimately improving the performance of the data caching system.
[0017] In one possible implementation of the first aspect above, when the target information includes cached data access event information, application business scenario information, and system load status information, the policy adjustment factors include access adjustment factors, business adjustment factors, and load adjustment factors. Based on the data caching policy adjustment algorithm, the corresponding policy adjustment factors are determined according to the target information, and the data caching policy for the corresponding cached data is adjusted according to the policy adjustment factors. This includes: determining the access adjustment factor based on the cached data access event information, determining the business adjustment factor based on the application business scenario information, and determining the load adjustment factor based on the system load status information; and determining the adjusted lifetime of the corresponding cached data based on the access adjustment factor, business adjustment factor, and load adjustment factor, the factor coefficients corresponding to each factor, and the basic lifetime.
[0018] By employing the above method, and integrating three types of information—data access behavior, business scenario semantics, and system operating status—and leveraging configurable factor coefficients, a multi-factor collaborative caching strategy adjustment model is constructed. This enables cache lifecycle management to respond to multi-dimensional environmental changes. The introduction of business adjustment factors imbues the caching strategy with business awareness, allowing for dynamic adjustments to data persistence priorities based on the needs of different business stages. The weighting mechanism supports flexible strategy preference configuration, enabling the system to achieve multi-objective collaborative optimization under different business goals and performance constraints, thereby enhancing the data caching system's adaptability in complex business environments. This makes lifecycle management of cached data more rational and accurate, further improving the overall performance and adaptability of the data caching system in complex business environments.
[0019] In one possible implementation of the first aspect above, when the target information only includes system load status information, the strategy adjustment factor is a load adjustment factor. Based on the data caching strategy adjustment algorithm, the strategy adjustment factor is determined according to the target information, and the data caching strategy of the corresponding cached data is adjusted according to the strategy adjustment factor. This includes: inputting the system load status information into the corresponding system load prediction model so that the system load prediction model obtains the predicted system load status information within the future target time based on the system load status information; determining the load adjustment factor based on the predicted system load status information; determining the strategy adjustment mode based on the load adjustment factor; and determining the adjusted lifetime of the corresponding cached data based on the strategy adjustment mode.
[0020] By employing the above method, a system load prediction model is used to analyze future load trends. Based on the prediction results, load adjustment factors and strategy adjustment modes are determined in advance, enabling the caching strategy to have predictive adjustment capabilities. Through the prediction mechanism, the system can proactively compress the lifespan of non-critical data and release resources before the load increases, or extend the caching period of potentially hot data before the load decreases, thereby achieving resource optimization. This effectively mitigates performance fluctuations caused by sudden load changes, making the lifecycle management of cached data more reasonable and accurate, and improving system performance under dynamic load environments.
[0021] In one possible implementation of the first aspect above, the algorithm parameters of the dynamic sliding window detection algorithm are dynamically determined based on the system load state, and the algorithm parameters of the dynamic sliding window detection algorithm include the window size; and / or the algorithm parameters of the data caching strategy adjustment algorithm are dynamically determined based on the system load state, and the algorithm parameters of the data caching strategy adjustment algorithm include the calculation parameters of the lifetime.
[0022] By employing the above method, and using system load status as the parameter adjustment basis for the dynamic sliding window detection algorithm and the data caching strategy adjustment algorithm, the algorithm acquires adaptive optimization capabilities. Under high load, the detection window can be dynamically shrunk to improve the real-time performance of event capture, or the time-to-live (TTL) calculation parameters can be adjusted to accelerate cache turnover; under low load, the window can be expanded or the calculation parameters can be relaxed to enhance the comprehensiveness of data behavior analysis. This improves the algorithm's adaptability under different load conditions and further enhances the performance of the cache management system.
[0023] Secondly, embodiments of this application disclose a data caching management system. The system includes a client layer and a data caching system layer. The data caching system layer includes a client access layer, a cache management and analysis layer, a storage layer, and a data layer. The client layer includes at least one application. The application in the client layer is used to send a data access request for cached data to the client access layer in the data caching system layer. The client access layer is used to receive the data access request and send the data access request to the cache management and analysis layer. The cache management and analysis layer is used to perform corresponding processing based on the data stored in the storage layer and / or the data layer according to the data access request, and is used to execute the data caching management method provided in any embodiment of the first aspect above to realize cached data management. The storage layer is used to store cached data. The data layer is used to store statistical data and metadata of the data caching system operation.
[0024] Thirdly, this application also discloses an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to enable the electronic device to implement the data cache management method provided in any of the embodiments of the first aspect.
[0025] The relevant beneficial effects of the second and third aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0026] To more clearly illustrate the technical solution of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below.
[0027] Figure 1 A flowchart illustrating a data cache management method provided in an embodiment of this application;
[0028] Figure 2 A schematic diagram of the structure of a data caching management system provided in an embodiment of this application;
[0029] Figure 3 A schematic diagram illustrating the principle of the data caching management system and method provided in this application embodiment;
[0030] Figure 4 A schematic diagram illustrating the principle of a data caching system and method for a large e-commerce platform provided in this application embodiment;
[0031] Figure 5 A flowchart illustrating the time window division process in the data cache management method provided in this application embodiment;
[0032] Figure 6 A schematic diagram of the first type of data cache management method for a large e-commerce platform provided in this application embodiment;
[0033] Figure 7 A flowchart illustrating the dynamic time-to-live (TTL) calculation process in the data cache management method provided in this application embodiment;
[0034] Figure 8 A second flowchart illustrating a data cache management method for a large e-commerce platform provided in this application embodiment;
[0035] Figure 9 A schematic diagram of the third process of the data cache management method for a large e-commerce platform provided in the embodiments of this application;
[0036] Figure 10 A flowchart illustrating the adaptive optimization process in the data cache management method provided in this application embodiment;
[0037] Figure 11 A flowchart illustrating the access processing flow in the data cache management method provided in this application embodiment;
[0038] Figure 12 A schematic diagram of the data interaction process in the data cache management method provided in this application embodiment;
[0039] Figure 13 A flowchart illustrating the module interaction process in the data caching management system provided in this application embodiment;
[0040] Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0041] As mentioned earlier, current mainstream caching systems primarily employ fixed TTL (Time-To-Live) strategies for data lifecycle management. Typical implementations include commands from Remote Dictionary Server (Redis), expiration mechanisms in Memory Cache Daemon (Memcached), and various application-layer caching frameworks such as Caffeine (a high-performance Java local caching library) and Google's open-source Java core library (Guava). These systems control the validity period of cached data through preset time values, automatically invalidating data after the set time. The core implementation process of existing technologies is as follows: first, a fixed expiration time is set when data is written to the cache; then, expired data is removed through a timed cleanup mechanism or lazy deletion strategy; finally, data is reloaded from the backend data source when a cache miss occurs. This approach is simple, direct, easy to understand and implement, and can meet basic caching needs in most scenarios.
[0042] However, existing technologies have the following drawbacks: First, they lack adaptability. Fixed TTL cannot be adjusted according to the actual access patterns of data, leading to hot data potentially becoming invalid prematurely, while cold data occupies valuable cache space for a long time. This one-size-fits-all strategy ignores the differences in access characteristics of different data, resulting in low caching efficiency. Second, time window management is insufficient. Existing systems lack effective time window analysis mechanisms and cannot identify the time patterns and trends in data access popularity. For example, some data may be frequently accessed during specific time periods but almost never accessed during other periods; fixed TTL strategies cannot capture this time-related access pattern. Third, load awareness is lacking. Existing caching systems cannot adjust caching strategies according to real-time system load. In high-concurrency scenarios, problems such as cache avalanche and cache penetration may occur, leading to a sharp decline in system performance. When the system load is high, frequent cache invalidation and rebuilding will further increase system pressure. Fourth, resource utilization is low. Due to the inability to accurately control the data lifecycle, valuable data is often prematurely cleaned up, while worthless data occupies memory for a long time. This improper resource allocation directly affects the overall performance and cost-effectiveness of the caching system. Fifth, there is a lack of business scenario adaptation. Existing fixed TTL strategies cannot adapt to the special needs of different business scenarios, such as popular products during e-commerce promotions, popular content on social media, and real-time data of financial transactions. These scenarios require more flexible and intelligent cache management strategies.
[0043] In summary, traditional data caching strategies that use a fixed TTL suffer from a lack of adaptability, insufficient time window management, lack of load awareness, low resource utilization, and lack of adaptability to business scenarios. This seriously affects the stability and resource utilization efficiency of the system, as well as the performance of the data caching system.
[0044] Based on this, the present application discloses a data cache management method, such as... Figure 1 As shown in the figure, the data cache management method provided in this application includes the following steps.
[0045] S100, Obtain target information, which includes at least one of the following: cached data access event information, application business scenario information, and system load status information. The cached data access event information is obtained based on the window data of the target detection time window obtained by the dynamic sliding time window detection algorithm.
[0046] S200, based on the data caching strategy adjustment algorithm, determines the corresponding strategy adjustment factor according to the target information, and adjusts the data caching strategy of the corresponding cached data according to the strategy adjustment factor. The data caching strategy includes the lifetime.
[0047] The S300 manages the cached data according to the adjusted data caching strategy, including lifecycle management.
[0048] Among these, cached data access event information refers to access information related to data access, such as the number of accesses, access timestamps, accessed data types, and accessed data sizes, or other cached data access event information. Application business scenario information refers to business rule information and other business scenario-related information, such as product category configuration, promotional activity configuration, and inventory synchronization configuration, or other application business scenario information. System load status information refers to various system resource indicators monitored in real time by the system, such as memory utilization, network throughput, and cache hit rate, or other system load status information. Additionally, the dynamic sliding time window detection algorithm is a data acquisition algorithm based on a time window processing mechanism, and the data caching strategy adjustment algorithm is an algorithm that dynamically adjusts data caching strategies such as lifetime.
[0049] Among them, cached data access event information can be obtained from the window data of the target detection time window obtained by the time window controller based on the dynamic sliding time window detection algorithm.
[0050] Furthermore, the target detection time window can be any time window within a sliding time window. The window data of the target detection time window includes: window data within the target detection time window, or window data within the target detection time window and window data within the corresponding historical target detection window. Additionally, adjacent detection time windows partially overlap. Window overlap is handled using a weighted average method to avoid data loss, the window size is dynamically adjusted automatically based on system load, and cross-window data consistency ensures the continuity of statistical data.
[0051] Furthermore, window data includes window identifier, window start time, window end time and unique key, as well as data related to cached data access events within the window, such as the number of accesses to cached data, access time, access response time, access hit rate and access data size.
[0052] By employing the above method, during the data cache management process, multi-dimensional target information such as cached data access events, application business scenarios, and system load status are acquired in real time. This allows for real-time perception of target information and dynamic calculation of strategy adjustment factors. This enables cache data adjustment strategies, such as cached data lifetime, to be more closely matched with factors like the actual popularity, business value, and system environment of the cached data, thereby improving the effective utilization of cache space. Furthermore, by comprehensively considering cached data access events, application business scenarios, and system load status, the actual value and necessity of cached data can be assessed more comprehensively and accurately. For example, under high load, the cache lifecycle of non-critical data can be shortened to release resources, while under low load, the cache time of potentially hot data can be appropriately extended to prevent performance fluctuations. Therefore, this dynamic data cache strategy adjustment method based on multi-source, multi-dimensional information not only improves the performance indicators of the data caching system, such as hit rate, response time, and throughput, but also enhances the system's adaptability to business changes, sudden access pressure, or scenario switching, thus improving the overall performance of the data caching system.
[0053] Furthermore, by introducing a dynamic sliding time window detection algorithm, the accuracy and timeliness of capturing cache access timing characteristics are enhanced. Compared to a fixed time window, a dynamic sliding window can more sensitively identify abrupt changes, periodic patterns, or trend changes in access patterns, thus providing a more timely and accurate window data basis for policy adjustments. This allows cache policy adjustments to keep pace with changes in actual access demands, avoiding policy failures due to information lag, ensuring the accuracy of cache management decisions such as lifecycle management, improving system resource utilization efficiency, and further guaranteeing or enhancing the performance of the data caching system.
[0054] In one possible implementation of the above method, application business scenario information can also be obtained based on window data of the target detection time window acquired using a dynamic sliding time window detection algorithm. Therefore, the window data can also include data related to the application business scenario, such as the aforementioned product category configuration data.
[0055] In one possible implementation of the above method, the system load status information can also be obtained from the window data of the target detection time window acquired based on the dynamic sliding time window detection algorithm. Therefore, the window data can also include data related to the system load status, such as the aforementioned memory usage data.
[0056] Of course, application business scenario information and system load status information can also be obtained through other means.
[0057] In this way, during the data caching management process, the data caching strategy can be dynamically adjusted in real time or periodically based on the acquired target information.
[0058] In one possible implementation of the above method, when the target information only includes cached data access event information, the policy adjustment factor is an access adjustment factor. Based on the data caching policy adjustment algorithm, the policy adjustment factor is determined according to the target information, and the data caching policy of the corresponding cached data is adjusted according to the policy adjustment factor. This includes: determining the data popularity information of the corresponding cached data according to the cached data access event information, as the access adjustment factor; and determining the adjusted lifetime of the corresponding cached data according to the access adjustment factor and the base lifetime.
[0059] The access adjustment factor is a calculated factor used to dynamically adjust the caching strategy. It is calculated based on the access behavior characteristics of cached data, such as access frequency and time distribution. The access adjustment factor can be an access frequency factor, a time decay factor, a popularity score factor, or other access adjustment factors. Data popularity information is a comprehensive indicator that quantitatively evaluates the popularity or access value of cached data. It is usually expressed as a numerical score, and data popularity information is calculated through a combination of multiple dimensions.
[0060] By employing the above method, the actual usage frequency of data can be directly reflected through cached data access event information. By applying access adjustment factors to the base lifetime, the lifespan of cached data can be dynamically adjusted. This improves the utilization efficiency of cache space, ensures that frequently accessed data is retained for longer, reduces the risk of cache penetration due to unreasonable eviction, and makes lifecycle management of cached data more reasonable and accurate, thereby enhancing the performance of the data caching system.
[0061] In one possible implementation of the above method, the data popularity information of the corresponding cached data is determined based on the cached data access event information, including: determining data access frequency indication information, data access time freshness indication information, and data importance indication information based on the cached data access event information; and determining the data popularity information of the corresponding cached data based on the data access frequency indication information, data access time freshness indication information, and data importance indication information.
[0062] Among them, data access frequency indication information can be obtained by statistically analyzing and normalizing the number of accesses within a time window, reflecting the relative popularity of the data; data access time freshness indication information can be calculated based on the interval between the most recent access time and the current time, reflecting the timeliness of data access, with a shorter interval indicating higher freshness; data importance indication information usually refers to attributes such as data size, business type, or predefined priority, used to measure the value weight of data in the business.
[0063] By employing the above method, features are comprehensively extracted from cached data access event information from three dimensions: access frequency, access time freshness, and data importance. This forms a multi-dimensional data popularity evaluation system, making the determination of data popularity more comprehensive and objective. Popularity calculation based on multi-dimensional features avoids the one-sidedness of single-indicator evaluation, more accurately distinguishes the actual value and usage trends of different data, and thus supports more refined cache lifecycle management decisions. This makes lifecycle management of cached data more reasonable and accurate, and improves the adaptability of the data caching system under diverse access modes, thereby enhancing the performance of the data caching system.
[0064] In one possible implementation of the above method, when the cached data access event information includes the number of data accesses, the data access time, and the size of the accessed data, and the data popularity information is a data popularity score, the data access frequency indication information, the data access time freshness indication information, and the data importance indication information are determined based on the cached data access event information. This includes: determining the corresponding access frequency weight as the data access frequency indication information based on the number of data accesses; determining the corresponding time distribution weight as the data access time freshness indication information based on the data access time; and determining the corresponding data size weight as the data importance indication information based on the size of the accessed data. Based on the data access frequency indication information, the data access time freshness indication information, and the data importance indication information, the data popularity information of the corresponding cached data is determined, including: determining the data popularity score of the corresponding cached data based on the access frequency weight, the time distribution weight, and the data size weight, as well as the weight coefficients corresponding to each weight.
[0065] Furthermore, access frequency weight can be calculated as a ratio between 0 and 1, obtained by dividing the actual number of times a specific data item is accessed within a time window by the maximum number of times all data within that window. This ratio reflects the relative popularity of the data. Time distribution weight can be calculated as the ratio of the interval between the current time and the last access time to the entire time window size, then subtracting this ratio from 1. This gives higher weight to more recently accessed data, reflecting its freshness. Data size weight can be calculated as comparing the data size to the system's maximum allowed data size, then subtracting this ratio from 1. This means that, under the same conditions, the system tends to assign higher caching value to smaller data to optimize storage space utilization.
[0066] For example, the data popularity information of corresponding cached data can be determined by calculating the data popularity score using the following formula:
[0067] Data popularity score = (access frequency weight × W1) + (time distribution weight × W2) + (data size weight × W3)
[0068] Access frequency weight = access_count / max_access_in_window
[0069] Time distribution weight = 1 - (current_time - last_access_time) / window_size
[0070] Data size weight = 1 - (data_size / max_data_size)
[0071] Where `access_count` is the number of accesses, `max_access_in_window` is the maximum number of accesses within the window, `current_time` is the current time, `last_access_time` is the last access time, `window_size` is the window size or time interval, `data_size` is the data size, and `max_data_size` is the maximum data size. `W1`, `W2`, and `W3` are weight coefficients, and their sum is 1. For example, `W1`, `W2`, and `W3` can be 0.4, 0.3, and 0.3, or other values.
[0072] Then, based on the obtained data popularity score and the base lifetime, the adjusted lifetime of the corresponding cached data is determined. For example, if the data popularity score is high, the lifetime of the corresponding cached data is increased; if the data popularity score is low, the lifetime of the corresponding cached data is decreased. The method of increasing or decreasing can be, for example, increasing or decreasing by a certain value or proportion, which can be set as needed. Of course, the method of adjusting the lifetime can be other methods, which can be set as needed. In addition, the base lifetime can be a pre-set initial lifetime or the lifetime after the previous adjustment.
[0073] By employing the above method, data access frequency, access time distribution, and access data size are quantified into corresponding weighted indicators, and configurable weight coefficients are introduced to form a structured data popularity score calculation model. This makes the popularity of different cached data comparable and sortable. It enhances the systematic nature and operability of cache management decisions, supports batch strategy adjustments based on score priorities, further improves the accuracy of cache management and system execution efficiency, and makes lifecycle management of cached data more reasonable and accurate, thereby improving the performance of the data caching system.
[0074] In one possible implementation of the above method, when the target information includes cached data access event information and system load status information, the policy adjustment factor includes an access adjustment factor and a load adjustment factor. Based on the data caching policy adjustment algorithm, the policy adjustment factor is determined according to the target information, and the data caching policy of the corresponding cached data is adjusted according to the policy adjustment factor. This includes: determining the access adjustment factor based on the cached data access event information; determining the load adjustment factor based on the system load status information; and determining the adjusted lifetime of the corresponding cached data based on the access adjustment factor, the load adjustment factor, and the base lifetime.
[0075] Furthermore, when the cached data access event information includes the number of accesses and the access time, the access adjustment factor includes an access frequency factor and a time decay factor determined based on the cached data access event information.
[0076] Furthermore, determining the adjusted lifetime of the corresponding cached data can be done by multiplying the base lifetime by an access frequency factor, a time decay factor, and a load adjustment factor in sequence. The access frequency factor can be calculated, for example, using a logarithmic normalization method based on the actual number of accesses to the data and the maximum number of accesses within a time window; the time decay factor can be calculated, for example, using an exponential decay model, combined with a decay constant and the time interval since the last access; and the load adjustment factor can be calculated, for example, based on the inverse square relationship between the current system load and the system's maximum carrying capacity.
[0077] For example, the adjusted lifetime of the corresponding cached data can be determined using the following formula:
[0078] TTL_dynamic=TTL_base×α×β×γ
[0079] α=log(access_count+1) / log(max_access+1)
[0080] β=e^(-λt)
[0081] γ=1-(current_load / max_load)^2
[0082] Where TTL_dynamic is the adjusted time to live, TTL_dynamic is within the preset adjustable boundary range, TTL_base is the base time to live, α is the access frequency factor, access_count is the number of data accesses, max_access is the maximum number of data accesses, β is the time decay factor, λ is the decay constant, t is the time interval, γ is the load adjustment factor, current_load is the current system load, and max_load is the maximum system load.
[0083] Furthermore, TTL_dynamic is within a preset adjustable boundary range. For example, the minimum value of TTL_dynamic could be 30 seconds to prevent frequent failures from affecting performance, and the maximum value could be 3600 seconds to prevent data from occupying memory for extended periods. Ultimately, the TTL value is adjusted within this boundary range. Of course, the adjustable boundary range can also be other values, which can be set as needed.
[0084] By employing the above method and simultaneously introducing access and load adjustment factors, the caching strategy achieves bidirectional adjustment capabilities when adjusting the lifetime of cached data, taking into account both data access characteristics and the real-time system load. Under high system load, the load adjustment factor can appropriately suppress the lifetime of low-priority data, freeing up cache and system resources; under low load, it can appropriately extend the data's lifetime based on access frequency to improve subsequent access performance. This enhances the adaptive resource adaptation capability of the data caching system under different load scenarios, making the lifecycle management of cached data more reasonable and accurate, and ultimately improving the performance of the data caching system.
[0085] In one possible implementation of the above method, when the target information includes cached data access event information, application business scenario information, and system load status information, the policy adjustment factors include access adjustment factors, business adjustment factors, and load adjustment factors. Based on the data caching policy adjustment algorithm, the policy adjustment factors are determined according to the target information, and the data caching policy for the corresponding cached data is adjusted according to the policy adjustment factors. This includes: determining the access adjustment factor based on the cached data access event information, determining the business adjustment factor based on the application business scenario information, and determining the load adjustment factor based on the system load status information; and determining the adjusted lifetime of the corresponding cached data based on the access adjustment factor, business adjustment factor, and load adjustment factor, the factor coefficients corresponding to each factor, and the basic lifetime.
[0086] The factor coefficients corresponding to each factor can also be called the factor weight coefficients corresponding to each factor.
[0087] Furthermore, when the cached data access event information includes the number of accesses and the access time, the access adjustment factor includes an access frequency factor and a time decay factor determined based on the cached data access event information.
[0088] Furthermore, determining the adjusted lifetime of the corresponding cached data can be achieved by multiplying the base lifetime by the weighted sum of various adjustment factors. Specifically, this involves multiplying the access frequency factor, time decay factor, load adjustment factor, and business adjustment factor by their respective preset weight coefficients P1, P2, P3, and P4, and then summing the results. Here, the access frequency factor reflects the access frequency of the data within the recent window, the time decay factor quantifies the degree of value decay of the data since the last access, the load adjustment factor is dynamically adjusted based on the current system resource pressure, and the business adjustment factor incorporates specific policy requirements from the business level.
[0089] For example, the adjusted lifetime of the corresponding cached data can be determined using the following formula:
[0090] Final_ttl=base_ttl×(frequency_factor×P1+decay_factor×P2+load_factor×P3+business_factor×P4)
[0091] Where Final_ttl is the adjusted time to life, which is the final time to life after this adjustment, base_ttl is the base time to life, frequency_factor is the access frequency factor, decay_factor is the time decay factor, load_factor is the load adjustment factor, and business_factor is the business adjustment factor, which can also be called the business rule factor. The coefficients of each factor, P1, P2, P3, and P4, can be, for example, 0.4, 0.3, 0.2, and 0.1, or other values, and their sum is 1.
[0092] By employing the above method, and integrating three types of information—data access behavior, business scenario semantics, and system operating status—and leveraging configurable factor coefficients, a multi-factor collaborative caching strategy adjustment model is constructed. This enables cache lifecycle management to respond to multi-dimensional environmental changes. The introduction of business adjustment factors imbues the caching strategy with business awareness, allowing for dynamic adjustments to data persistence priorities based on the needs of different business stages. The weighting mechanism supports flexible strategy preference configuration, enabling the system to achieve multi-objective collaborative optimization under different business goals and performance constraints, thereby enhancing the data caching system's adaptability in complex business environments. This makes lifecycle management of cached data more rational and accurate, further improving the overall performance and adaptability of the data caching system in complex business environments.
[0093] In one possible implementation of the above method, when the target information only includes system load status information, the strategy adjustment factor is a load adjustment factor. Based on the data caching strategy adjustment algorithm, the strategy adjustment factor is determined according to the target information, and the data caching strategy of the corresponding cached data is adjusted according to the strategy adjustment factor. This includes: inputting the system load status information into the corresponding system load prediction model so that the system load prediction model obtains the predicted system load status information within the future target time based on the system load status information; determining the load adjustment factor based on the predicted system load status information; determining the strategy adjustment mode based on the load adjustment factor; and determining the adjusted lifetime of the corresponding cached data based on the strategy adjustment mode.
[0094] System load status information refers to a series of key data and metrics used to quantify and evaluate the workload, resource consumption, and performance saturation of a computer system or its components, such as memory, network, disk, and cache, at a specific point in time.
[0095] Furthermore, the process of determining the load adjustment factor based on system load status information is achieved through a multi-index weighted fusion model. Moreover, the system load prediction model can be trained based on historical system load data and can predict future system load conditions.
[0096] Furthermore, the load adjustment factor can be obtained by multiplying the four key performance indicators—CPU load factor, memory pressure factor, input / output performance factor, and cache hit rate factor—by their respective weighting coefficients w1, w2, w3, and w4, and then summing them up.
[0097] For example, the load adjustment factor can be determined based on system load status information in the following ways:
[0098] adjustment_factor=w1×cpu_factor+w2×memory_factor+w3×io_factor+w4×hit_rate_factor
[0099] Among them, adjustment_factor is the load adjustment factor, used to reflect the current overall load and health status of the system; cpu_factor is the Central Processing Unit (CPU) load factor; memory_factor is the memory pressure factor; io_factor is the input / output (I / O) performance factor; and hit_rate_factor is the cache hit rate factor. w1, w2, w3, and w4 are the factor coefficients corresponding to each factor, representing the importance of each factor in the comprehensive evaluation, and their sum is 1.
[0100] In addition, the future target time can be, for example, 10 minutes from now, which can be set as needed.
[0101] Furthermore, the data caching strategy for the corresponding cached data is adjusted according to the load adjustment factor, including: determining the adjustment mode based on the adjustment factor; and adjusting the lifetime of the corresponding cached data based on the adjustment mode.
[0102] For example, the strategy adjustment mode may include a first strategy adjustment mode, a second strategy adjustment mode, and a third strategy adjustment mode, which can be determined based on the magnitude of the load adjustment factor. For instance, if the load adjustment factor is greater than or equal to a first threshold and less than or equal to a second threshold, the load is considered balanced, and the strategy adjustment mode is determined to be the first strategy adjustment mode. If the load adjustment factor is less than the first threshold, the load is considered low, and the strategy adjustment mode is determined to be the second strategy adjustment mode. If the load adjustment factor is greater than the second threshold, the load is considered high, and the strategy adjustment mode is determined to be the third strategy adjustment mode. Furthermore, if the strategy adjustment mode is the first strategy adjustment mode, the current lifetime can be maintained; if the strategy adjustment mode is the second strategy adjustment mode, the lifetime can be increased; and if the strategy adjustment mode is the third strategy adjustment mode, the lifetime can be urgently reduced.
[0103] Of course, the method for determining the adjustment mode based on the adjustment factor, and the method for adjusting the lifetime of the corresponding cached data based on the adjustment mode, can also be other methods, which can be set as needed.
[0104] By employing the above method, a system load prediction model is used to analyze future load trends. Based on the prediction results, load adjustment factors and strategy adjustment modes are determined in advance, enabling the caching strategy to have predictive adjustment capabilities. Through the prediction mechanism, the system can proactively compress the lifespan of non-critical data and release resources before the load increases, or extend the caching period of potentially hot data before the load decreases, thereby achieving resource optimization. This effectively mitigates performance fluctuations caused by sudden load changes, making the lifecycle management of cached data more reasonable and accurate, and improving system performance under dynamic load environments.
[0105] Furthermore, in some other embodiments of this application, the business adjustment factor can be directly determined based on the aforementioned application business scenario information, and the adjusted lifetime of the corresponding cached data can be determined based on the business adjustment factor and the base lifetime. Alternatively, the access adjustment factor can be determined based on the aforementioned cached data access event information, and the business adjustment factor can be determined based on the application business scenario information; then, the adjusted lifetime of the corresponding cached data can be determined based on the access adjustment factor, the business adjustment factor, and the base lifetime. Alternatively, the load adjustment factor can be determined based on the aforementioned system load status information, and the business adjustment factor can be determined based on the application business scenario information; then, the adjusted lifetime of the corresponding cached data can be determined based on the load adjustment factor, the business adjustment factor, and the base lifetime. The specific implementation process of these adjustment methods can be similar to the adjustment methods provided above, and the specific implementation process can be set as needed.
[0106] Furthermore, in the aforementioned different implementations, the methods for determining the access adjustment factor, service adjustment factor, and load adjustment factor can be used interchangeably to adjust the data caching strategy.
[0107] In this way, based on at least one of the following information—cache data access event information, application business scenario information, and system load status information—the data caching strategy can be adjusted, making cache management of cached data more reasonable and accurate, and improving the performance of the data caching system.
[0108] In one possible implementation of the above method, the algorithm parameters of the dynamic sliding time window detection algorithm are dynamically determined based on the system load status. The algorithm parameters of the dynamic sliding time window detection algorithm include the window size, and may also include other window information; and / or the algorithm parameters of the data caching strategy adjustment algorithm are dynamically determined based on the system load status. The algorithm parameters of the data caching strategy adjustment algorithm include the calculation parameters of the lifetime, and may also include the calculation parameters of other caching strategies.
[0109] The system load status is determined based on the system load status indication information, which may include information related to system load such as CPU utilization, memory pressure, network read / write status, and cache hit rate.
[0110] By employing the above method, and using system load status as the parameter adjustment basis for the dynamic sliding window detection algorithm and the data caching strategy adjustment algorithm, the algorithm acquires adaptive optimization capabilities. Under high load, the detection window can be dynamically shrunk to improve the real-time performance of event capture, or the time-to-live (TTL) calculation parameters can be adjusted to accelerate cache turnover; under low load, the window can be expanded or the calculation parameters can be relaxed to enhance the comprehensiveness of data behavior analysis. This improves the algorithm's adaptability under different load conditions and further enhances the performance of the cache management system.
[0111] Furthermore, in one possible implementation of the above method, if a data cache anomaly is detected, the method also includes anomaly resolution processing to restore the data cache to a normal state.
[0112] Furthermore, it should be noted that the foregoing embodiments primarily use data lifetime as an example of a data caching strategy to illustrate the data caching management method provided in this application. In other embodiments of this application, the data caching strategy may also include other cache-related caching strategies such as cleaning up expired data and adjusting cache fragments, which can be set as needed. Based on the data caching management method provided in this application, adjustments to different types of data caching strategies can be implemented to make the management of data caching more reasonable and accurate, thereby improving the performance of the data caching system.
[0113] The method described above, provided in the embodiments of this application, can be applied to a data caching management system, such as... Figure 2As shown in the figure, an embodiment of this application also discloses a data caching management system. This system includes a client layer and a data caching system layer. The data caching system layer includes a client access layer, a cache management and analysis layer, a storage layer, and a data layer. The client layer includes at least one application. Specifically, the application in the client layer sends data access requests for cached data to the client access layer in the data caching system layer; the client access layer receives the data access requests and forwards them to the cache management and analysis layer; the cache management and analysis layer processes the data based on the data access requests and the data stored in the storage layer and / or the data layer, and executes data cache management methods to achieve cached data management; the storage layer stores cached data; and the data layer stores statistical data and metadata related to the operation of the data caching system.
[0114] The client layer is the external requester, and the data caching system layer is the core processing part, which includes the client access layer, cache management and analysis layer, storage layer and data layer.
[0115] The client access layer, also known as the request processing layer or access layer, includes a client request receiving module. This module receives cached requests from various clients, including requests for data retrieval (GET), data setting (SET), and data deletion (DELETE). The client access layer also includes a load balancer. The load balancer uses a consistent hashing algorithm to distribute requests, ensuring that requests with the same key are routed to the same node, and supports dynamic scaling.
[0116] The cache management and analysis layer consists of a core management layer and an intelligent analysis layer. This layer can also be called the cache management layer or cache cluster layer. The core management layer, including the cache management layer, acts as the system's core control center, coordinating the work of various subsystems and implementing unified cache policy management. Internally, it contains four key modules: a request routing module that determines data storage location based on the hash value of the key; a policy execution module specifically responsible for executing dynamic TTL and adaptive policies; a consistency guarantee module that ensures data consistency across multiple nodes; and a monitoring interface module that provides an interface for querying system status. These modules work together to form the central hub for system policy execution and coordination.
[0117] The intelligent analysis layer comprises a time window controller, a dynamic TTL engine, and an adaptive optimizer. The time window controller is specifically responsible for managing sliding time windows. It mainly consists of two modules: a window data collection module and a heat analysis module. Its core functions include two aspects: first, collecting access data in real time within each time window, such as access frequency, response time, and data size, through the window data collection module; second, calculating the heat score of cached items based on this multi-dimensional data, thereby accurately identifying hot and cold data and providing a basis for subsequent strategy adjustments. The dynamic TTL engine is responsible for intelligent TTL calculation and full lifecycle management. It mainly consists of two modules: a TTL calculation module and a lifecycle management module. The TTL calculation module dynamically calculates the optimal TTL value based on multiple factors such as access frequency, time decay, and system load. The lifecycle management module manages the complete lifecycle of cached items from creation, update, expiration to cleanup, ensuring that data status is synchronized with the strategy. The adaptive optimizer is a key component for enabling the system to self-adjust. It mainly consists of two modules: a load monitoring module and a policy adjuster. The load monitoring module monitors the usage of system resources such as CPU, memory, and network I / O in real time, while the policy adjuster dynamically adjusts various parameters of the caching policy based on these load data and performance indicators, enabling the system to adaptively cope with different operating environments and stress states.
[0118] The storage layer, also known as the cache storage layer, provides a unified storage interface and supports multiple storage backends. Among them, memory caching is a high-speed memory storage based on a remote dictionary service (RemoteDictionaryServer, Redis) or a memory cache daemon (MemoryCacheDaemon, Memcached), providing millisecond-level access performance; persistent storage is, for example, persistent storage based on RocksDB or LevelDB, used for data backup and cold data storage.
[0119] The data layer includes an access statistics database, which stores various statistical data and metadata related to system operation, supporting historical data querying and analysis. Examples include time window data, popularity score records, load monitoring history, and business rule configurations.
[0120] Furthermore, the modules of the system communicate asynchronously through a publish-subscribe model; to achieve efficient data exchange, data sharing is achieved through shared memory and message queue mechanisms; to ensure system consistency, the status of each module is synchronized periodically; at the same time, a circuit breaker mode is introduced to achieve fault isolation, ensuring that the failure of a single module will not affect the stable operation of the overall system.
[0121] Furthermore, the aforementioned data caching management system may also include other data layers, which can be configured as needed.
[0122] like Figure 3 As shown, the client layer sends a client request as a data access request. This request is first received and routed by the load balancer in the client access layer. The request then enters the cache management layer, which coordinates the processing of the time window controller, the dynamic TTL engine, and the adaptive optimizer. The time window controller includes a window data collection and heat analysis module, the dynamic TTL engine includes a TTL calculation module and lifecycle management, and the adaptive optimizer includes a load monitoring and policy adjustment module. The instructions and data processed by these modules work together to act on the cache storage layer, which includes in-memory caching and persistent storage. At the same time, the access statistics and data throughout the process are finally stored in the access statistics database, thus forming a complete closed-loop system.
[0123] The following section uses a large e-commerce platform's product data caching scenario as an example to further illustrate the data caching management method and system provided in this application.
[0124] A large e-commerce platform's business scale might be, for example, 50 million daily active users, 10 million stock keeping units (SKUs), and 2 million daily orders. Access characteristics include 100 million daily visits to product detail pages and a peak query per second (QPS) of 500,000. Data characteristics include multi-dimensional data such as basic information, price, inventory, reviews, and recommendations for products. Business pain points include a tenfold surge in traffic during promotional events like Singles' Day (11.11), slow system response, significant differences in access between popular and long-tail products, difficulty in unifying caching strategies, frequent price and inventory changes, high cache consistency requirements, immense database pressure, and peak query response times exceeding 500 milliseconds.
[0125] The client access layer can be referred to as the access layer. The cache management and analysis layer can be referred to as the cache cluster layer. Its core functional modules, including a cache management layer for core coordination, a time window controller for data collection and popularity analysis, a dynamic TTL engine for time-to-live (TTL) calculation, and an adaptive optimizer for system tuning, are all integrated into each cache node. Furthermore, the Redis used by these nodes is the in-memory caching technology implemented in the storage layer. The data layer contains business databases such as those for products, users, and orders, used for persistent storage of business data as well as for storing system operation statistics and metadata.
[0126] like Figure 4 As shown, the system includes a client layer, an access layer, a cache cluster layer, and a data layer.
[0127] The client layer includes applications such as mobile applications (APP), web browsers (WebBrowser), and mini-programs.
[0128] The access layer consists of an Application Programming Interface Gateway (API) or a Content Delivery Network (CDN), and a Load Balancer (such as Nginx-EngineX or HAProxy-High AvailabilityProxy).
[0129] The cache cluster layer comprises multiple cache nodes, each integrating a request router, cache management layer, time window control, dynamic TTL engine, adaptive optimizer, and clustering capabilities such as a Redis cluster. The data layer includes a product database (MySQL master-slave), a user database (MySQL master-slave), and an order database (MySQL sharding). These layers are interconnected to form a complete processing chain from client requests to final data storage.
[0130] like Figure 5 As illustrated, in this exemplary embodiment, the time window controller updates window data by: initializing the time window, setting the window size (e.g., W seconds), and creating a sliding window queue. The system continuously receives access events, recording timestamps and key values. The system continuously determines whether the current time minus the window start time is greater than or equal to W. When the condition is met, the sliding window operation is executed, i.e., expired window data is removed, a new window is created, and statistical data within the window is calculated. When the condition is not met, the event is accumulated to the current window, and the window statistics are updated. Subsequently, data caching strategy analysis, such as popularity analysis, is triggered, and finally, the caching strategy is updated.
[0131] Specifically, during the initialization phase, the system creates a time window manager, sets the window size, and establishes a sliding window queue to store continuous time window data. During the event handling phase, the system listens for cached access events, records timestamps, cache keys, and other information, and determines whether to trigger window sliding. The window sliding mechanism is activated when the time exceeds the window size, removing expired window data and creating new windows, while simultaneously aggregating data and calculating statistical metrics for completed windows. In data accumulation processing, access events are added to the currently active window, and statistics are updated in real time. The policy update mechanism then triggers a heat analysis algorithm to calculate the heat score of cached items, and dynamically adjusts the TTL value and caching strategy based on this result, thus forming a closed-loop feedback loop for continuous optimization of system performance.
[0132] The window data structure definition includes core information such as time range and access frequency. It employs a circular buffer and atomic operations to implement an efficient and thread-safe sliding window algorithm. It uses a popularity calculation formula that comprehensively considers access frequency, time freshness, and data importance, and implements data protection mechanisms including time consistency checks and memory overflow protection. It supports multi-level time window management at the second, minute, and hour levels, updates statistical data in real time through the sliding window mechanism to avoid sudden changes, adopts a popularity scoring algorithm that comprehensively considers access frequency, time distribution, and data size, and has predictive analysis capabilities based on historical window data.
[0133] Specifically, the window data structure settings implemented in this application include window settings, commodity statistics settings, and system indicator settings.
[0134] For example, window settings could include setting the window's unique identifier (window_id) to "uuid or 2024-01-15T10:05:00Z", with the window's start time (start_time) recorded as a timestamp as 1640995200 or 1705312500, and the end time (end_time) as 1640995260 or 1705312800, indicating that the window covers a time period of 60 seconds or 300 seconds. The total number of requests (total_requests) is 125000, the cache hits (cache_hits) are 106250, the cache misses (cache_misses) are 18750, the cache hit rate (hit_rate) is 0.85, the average response time (avg_response_time) is 8.5, and the number of unique products (unique_products) is 45000.
[0135] Product statistics settings (product_stats) can be configured for two products, such as: product 12345 with 1250 access counts (access_count), 1705312750 last access timestamp, 3.2 seconds average response time, 2048 data size, and a category such as "mobile phones" and is currently on promotion (is_promotion set to true); and product 67890 with 5 access counts, 1705312600 last access timestamp, 45.0 seconds average response time, 1024 data size, and a category such as "books" and is not currently on promotion (is_promotion set to false).
[0136] System metrics settings could include, for example, setting CPU usage to 0.65, memory usage to 0.78, IO wait to 0.12, and network throughput to 850000000.
[0137] Furthermore, the system employs efficient concurrency control strategies to ensure data consistency and system performance, a read-write lock mechanism to guarantee data consistency, a lock-free data structure to improve concurrency performance, atomic operations to ensure the accuracy of statistical data, and a window number limit and automatic cleanup mechanism to prevent memory overflow.
[0138] like Figure 6 As shown, a data caching management method, taking a product data caching scenario on a large e-commerce platform as an example, may include the following steps. The target information includes cached data access event information, application business scenario information, and system load status information.
[0139] Step S201: Based on the dynamic sliding time window detection algorithm, cached data access event information is collected from the target detection time window. The adaptive optimizer monitors and obtains system load status information in real time, and also obtains business rule information (i.e., application business scenario information).
[0140] Specifically, cached data access event information includes the number of times a product is accessed within a time window, the last access time, and the data size.
[0141] The business rules information includes the configuration of the popular product category to which the product belongs, as well as the rules of the current promotional activities. For example, the popular product category configuration is for mobile phone products.
[0142] System load status information includes current CPU utilization, memory usage, and I / O wait time.
[0143] Step S202: Based on the above information, calculate the access frequency factor based on the number of accesses, the time decay factor based on the last access time, the load adjustment factor based on the system load index, and the business adjustment factor based on the business rule information. Then, based on these policy adjustment factors and the preset base lifetime, calculate the adjusted lifetime using a weighted combination formula, and constrain the result within the preset lifetime boundary, thereby completing the adjustment of the lifetime in the data caching strategy.
[0144] Specifically, such as Figure 7As shown, taking a mobile phone on promotion with product ID 12345 as an example, the number of visits within a single window is access_count=1250, and the last access time is last_access_time=50 seconds.
[0145] CPU utilization (cpu_usage=0.65), memory usage (memory_usage=0.78), and I / O wait time (io_wait=0.12) are all calculated as follows:
[0146] Final_ttl=base_ttl×(frequency_factor×0.4+decay_factor×0.3+load_factor×0.2+business_factor×0.1).
[0147] Among them, frequency_factor is the access frequency factor, decay_factor is the time decay factor, load_factor is the load adjustment factor, and business_factor is the business application rule factor. The calculation methods of each factor are as follows.
[0148] In the calculation of the access frequency factor:
[0149] Since access_count (number of accesses within 5 minutes) = 1250 and max_access_in_window (maximum number of accesses within a window) = 2000, then frequency_factor = min(access_count / max_access_in_window, 1.0) = 0.625.
[0150] In the calculation of the time decay factor:
[0151] current_time=1705312800,last_access_time=1705312750,
[0152] If time_since_access = 50 seconds and half_life = 3600 seconds, then:
[0153] decay_factor=exp(-0.693*50 / 3600)=0.99.
[0154] In the calculation of the load adjustment factor:
[0155] cpu_usage=0.65, memory_usage=0.78, io_wait=0.12, then:
[0156] load_factor=(1-cpu_usage)*0.4+(1-memory_usage)*0.4+(1-io_wait)*0.2=0.404
[0157] In the process of calculating application business rule factors:
[0158] If the product is a popular item (e.g., category_multiplier=2.0) and is currently on promotion (e.g., promotion_multiplier=3.0), then:
[0159] business_factor=category_multiplier*promotion_multiplier=6.0.
[0160] Where base_ttl=1800 seconds, weight configuration weights={frequency: 0.4, recency: 0.3,
[0161] If load: 0.2, business: 0.1, then:
[0162] Final_ttl=base_ttl*(frequency_factor*0.4+decay_factor*0.3+load_factor*0.2+business_factor*0.1)
[0163] thus:
[0164] Final_ttl=1800*(0.625*0.4+0.99*0.3+0.404*0.2+6.0*0.1)=1800*1.228=2210 seconds (approximately 37 minutes).
[0165] Additionally, regarding boundary checks and applications, the preset minimum time-to-live (min_ttl) is 300 seconds, and the maximum time-to-live (max_ttl) is 7200 seconds. After checking, 2210 seconds is within the boundary range; therefore, the Final_ttl value is updated to the cache's time-to-live, and the TTL adjustment log is recorded.
[0166] Step S203: Based on the adjusted data caching strategy that includes the new lifecycle time, perform cache management, including lifecycle management, on the cached data corresponding to the product.
[0167] like Figure 8 As shown, when the target information includes cached data access event information and system load status information, the data cache management method further includes the following steps.
[0168] Step S301: Based on the dynamic sliding time window detection algorithm, cached data access event information is obtained, and the adaptive optimizer monitors the system resource pressure in real time to obtain load status information.
[0169] Among them, cached data access event information includes information such as the number of times a cached item is accessed within the window and the last access time, while system load status information can be specific indicators such as CPU utilization and memory utilization monitored during high load.
[0170] Step S302: Based on the above information, calculate the access frequency factor and time decay factor according to the cached data access event information, and calculate the load adjustment factor according to the system load status information. Then, based on these factors and the base lifetime, calculate the dynamic lifetime according to the formula, and apply the system's preset minimum and maximum lifetime boundary constraints to the calculation results to adjust the lifetime in the data caching strategy.
[0171] Specifically, the adjusted survival time formula described above can be:
[0172] TTL_dynamic=TTL_base×α×β×γ
[0173] α=log(access_count+1) / log(max_access+1)
[0174] β=e^(-λt)
[0175] γ=1-(current_load / max_load)^2
[0176] Where TTL_dynamic is the adjusted time to live, TTL_dynamic is within the preset adjustable boundary range, TTL_base is the base time to live, α is the access frequency factor, access_count is the number of data accesses, max_access is the maximum number of data accesses, β is the time decay factor, λ is the decay constant, t is the time interval, γ is the load adjustment factor, current_load is the current system load, and max_load is the maximum system load.
[0177] Furthermore, the base time to live (TTL_base) is set to 600 seconds.
[0178] α is the access frequency factor, calculated as: α = log(access_count + 1) / log(max_access + 1). The default value for max_access is 1000. Substituting these values, we get: α = log(201) / log(1001) ≈ 5.3 / 6.9 ≈ 0.77.
[0179] β is the time decay factor, calculated as: β=e^(-λt), where the decay constant λ is assumed to be 0.001, and t is the time interval of 30 seconds. Substituting these values, we get: β=e^(-0.001*30)≈e^(-0.03)≈0.97.
[0180] γ is the load adjustment factor, calculated as: γ = 1 - (current_load / max_load)^2, where max_load is 1.0 (i.e., 100%). Substituting, we get: γ = 1 - (0.7 / 1.0)^2 = 1 - 0.49 = 0.51.
[0181] Substituting the factors into the main formula: TTL_dynamic = 600 × 0.77 × 0.97 × 0.51 ≈ 600 × 0.38 ≈ 228 seconds. The system's preset adjustable boundary range for TTL is [60, 1800] seconds. Upon inspection, 228 seconds falls within this range; therefore, this value is the new survival time.
[0182] Step S303: Based on the adjusted data caching strategy that includes the new lifecycle time, perform cache management, including lifecycle management, on the cached data corresponding to the product.
[0183] like Figure 9 As shown, when the target information only includes cached data access event information, the data cache management method also includes the following steps.
[0184] Step S401: Obtain cached data access event information from the window data of the target detection time window obtained based on the dynamic sliding time window detection algorithm.
[0185] The cached data access event information includes statistics such as the number of times a cached item is accessed within the window, the last access time, and the data size.
[0186] Step S402: Based on the above information, calculate data popularity information as an access adjustment factor according to the number of accesses, time interval, and data size. Then, based on the access adjustment factor and the preset base lifetime, determine the adjusted lifetime of the corresponding cached data, and ensure that the lifetime falls within the globally configured lifetime boundary range, thereby completing the adjustment of the lifetime in the data caching strategy.
[0187] Specifically, firstly, the popularity analysis module calculates the popularity score using a formula, for example:
[0188] Data popularity score = (access frequency weight × 0.4) + (time distribution weight × 0.3) + (data size weight × 0.3).
[0189] Access frequency weight = access_count / max_access_in_window
[0190] Time distribution weight = 1 - (current_time - last_access_time) / window_size
[0191] Data size weight = 1 - (data_size / max_data_size)
[0192] Where access_count is the number of accesses, max_access_in_window is the maximum number of accesses within the window, current_time is the current time, last_access_time is the last access time, window_size is the window size or time interval, data_size is the data size, and max_data_size is the maximum data size.
[0193] Subsequently, the heat score calculated above is used as an access adjustment factor. Based on the formula TTL_adjusted = TTL_base × heat score, the adjusted lifetime of the corresponding cached data is determined. This calculation result falls within the system's globally configured lifetime boundaries, for example, a minimum of 30 seconds and a maximum of 3600 seconds. These boundaries are constrained, thus completing the adjustment of the lifetime in the data caching strategy.
[0194] Furthermore, taking the static resource common.js in the CDN as an example, its access_count is 800 and data_size is 15KB. Its popularity score is calculated to be 0.916. When the popularity score > 0.7, the TTL increases linearly between 1800 and 3600 seconds. The final TTL is 3096 seconds. After passing the boundary check [30, 3600] seconds, this value is applied as the new lifetime.
[0195] Step S403: Based on the adjusted data caching strategy that includes the new lifecycle time, perform cache management, including lifecycle management, on the cached data corresponding to the product.
[0196] Furthermore, in one embodiment of this application, adaptive optimization is primarily based on system load state information. For example, the system can calculate the comprehensive adjustment factor using the following formula:
[0197] adjustment_factor=0.3×cpu_factor+0.3×memory_factor+0.2×io_factor+0.2×hit_rate_factor
[0198] Among them, adjustment_factor is the overall adjustment factor, cpu_factor is the CPU load factor, memory_factor is the memory pressure factor, io_factor is the I / O performance factor, and hit_rate_factor is the cache hit rate factor.
[0199] The CPU load factor is divided into four ranges based on utilization. When the CPU utilization is below 30%, the load factor is 1.0; when the utilization is between 30% and 60%, it is 0.8; when it is between 60% and 80%, it is 0.5; and when it reaches or exceeds 80%, it is 0.2.
[0200] The memory stress factor is divided according to memory usage: 1.0 when below 40%; 0.7 when between 40% and 70%; 0.4 when between 70% and 90%; and 0.1 when at or above 90%.
[0201] I / O performance factors are based on average response time: 1.0 for less than 10 milliseconds; 0.8 for 10 to 50 milliseconds; 0.5 for 50 to 100 milliseconds; and 0.2 for 100 milliseconds or more.
[0202] The cache hit rate factor is divided according to the hit rate: 0.5 for below 50%; 0.7 for between 50% and 70%; 1.0 for between 70% and 90%; and 1.2 for 90% or above.
[0203] These factors together constitute the basic indicator system for system perception and quantification of load status and cache performance.
[0204] Furthermore, the policy adjuster switches policy modes based on the calculation result of adjustment_factor. For example, when the calculated adjustment_factor decreases significantly due to high load, the system enters conservative mode and performs global policy adjustments, such as uniformly reducing the base TTL of all cached items and increasing the global LRU eviction frequency, in order to quickly release resources and cope with system pressure, regardless of the business scenario.
[0205] The strategy adjustment includes: the system uses load prediction algorithms, such as models, to predict the system load for the next 5 minutes and updates parameters in real time to provide a forward-looking basis for adaptive optimization; strategy switching based on calculated adjustment factors includes: when the adjustment factor > 0.8, an aggressive mode is adopted to increase the TTL value; between 0.4 and 0.8, a balanced mode is adopted to maintain the default parameters; when the adjustment factor < 0.4, a conservative mode is switched to decrease the TTL value to release memory. To ensure the stability and reliability of the adjustment process, the system has built-in multiple protection mechanisms, limiting adjustments to a maximum of once per minute to avoid frequent changes, limiting the magnitude of a single adjustment to no more than 20% to achieve a smooth transition, using a moving average algorithm to handle index fluctuations to ensure the stability of the decision-making basis, and resolving potential conflicts between multiple strategies through a priority mechanism.
[0206] like Figure 10 As shown, implementing adaptive system load adjustment can include, for example, the following process: monitoring system load, assessing the load status based on the monitored system load information, and triggering events such as... when a clear high load threat is detected. Figure 10 The adaptive adjustment process is shown below. That is, when the system detects high load indicators, adaptive adjustment is triggered. It checks whether processor utilization is greater than 70%, memory utilization is greater than 75%, and cache hit rate is less than 80%. If processor utilization is greater than 70%, strategy adjustments are executed, such as increasing the TTL multiple of popular items (e.g., ×1.2) to reduce backend queries, decreasing the TTL multiple of less popular items (e.g., ×0.8) to accelerate memory release, and initiating aggressive preloading. If memory utilization is greater than 75%, memory optimization is performed, such as reducing cache item size limits (e.g., ×0.9), increasing LRU eviction frequency (e.g., ×1.5), and cleaning up cache cache. Expired data, etc.; if the cache hit rate is less than 80%, hit rate optimization is performed, such as increasing the TTL of hot data, optimizing loading strategies, and adjusting cache sharding. Then, application strategies are adjusted and a 30-second observation period is initiated. After collecting the adjusted metrics, the effect is evaluated. If the metrics improve, it is recorded as a successful adjustment, for example, CPU from 0.82 to 0.68, memory from 0.88 to 0.72, and the hit rate from 0.78 to 0.89. Then the optimization model is updated. If there is no improvement, the strategy adjustment is rolled back and failure cases are recorded. If the load status is critical, emergency optimization is initiated and emergency degradation is performed. If it is normal load, the current strategy is maintained. Ultimately, all situations return to the continued monitoring phase, and system load management is carried out cyclically.
[0207] Specifically, when the system detects a high load condition through real-time monitoring, such as CPU utilization reaching 82%, memory utilization reaching 88%, and cache hit rate at 78%, it will automatically trigger a multi-dimensional adaptive adjustment strategy. For CPU overload, the system increases the TTL multiple of popular items (e.g., ×1.2) to reduce backend queries, while decreasing the TTL multiple of less popular items (e.g., ×0.8) to accelerate memory release, and enables aggressive preloading. For memory pressure, the system reduces the cache item size limit (e.g., ×0.9) and increases the LRU eviction frequency (e.g., ×1.5). After these adjustments, the system load significantly improves; for example, CPU utilization drops to 68%, memory utilization drops to 72%, cache hit rate increases to 89%, and the average response time remains at a low latency of 12 milliseconds, effectively achieving resource optimization and performance balance under high load conditions.
[0208] Furthermore, such as Figure 11 As shown, in one embodiment of this application, the data cache management process can be as follows: The system begins with a user's access to cached data. Specifically, a user initiates a request for details of a product (e.g., product_id=12345). After the request is routed and rate-limited by the API gateway, the load balancer selects the optimal cache node, and the final processing node is determined by the request router using consistent hashing. The cache management layer then queries the cache. If the cache hit probability is approximately 85%, the system will directly return the cached data within 2-5 milliseconds, record the access statistics, trigger the time window controller to update the window data, and respond to the user. If the cache miss probability is approximately 15%, the system queries the backend database to assemble the data, triggers dynamic TTL calculation before writing to the cache, and then returns the data to the user, records the access statistics, updates the time window, and triggers TTL recalculation. The data is then returned to the user within 50-100 milliseconds, completing the closed-loop data collection of access records, window updates, and time-to-live recalculation.
[0209] like Figure 12 As shown, in one embodiment of this application, the data interaction process of the data cache management method may include: after a client request enters through the request router, it first determines whether the cache is hit. If it is hit, the cached data is returned directly; if it is not hit, the backend data is queried, the queried data is processed, stored in the cache, and then returned to the client. Simultaneously, regardless of whether there is a hit or not, access statistics collection and load monitoring are triggered. This is followed by two synchronously running branches: the first branch involves time window statistics followed by window-side data aggregation, hotspot analysis of the aggregated data, dynamic lifetime adjustment, lifetime calculation, and finally, cache policy update; the second branch involves load monitoring for adaptive optimization and policy adjustment, followed by parameter update. The results of these two branches are ultimately summarized at the cache management layer, which then stores the cached data, completing the closed loop of the entire process.
[0210] like Figure 13 As shown, in one embodiment of this application, the module interaction process of the data caching management system may include: the client sending a request to the cache management layer; if the cache is hit, the cache management layer queries the cache storage and returns the cached data, and returns a response to the client; if the cache is not hit, the cache management layer queries the backend data from the cache storage, returns the original data and stores it in the cache, and returns a response to the client. At the same time, the cache management layer records access events, the time window controller updates the time window every 60 seconds, sends statistical data to the dynamic TTL engine, and the dynamic TTL engine calculates the dynamic time to live and updates the time to live strategy; the adaptive optimizer monitors the system load every 30 seconds and sends load data to the dynamic TTL engine, which then adjusts the caching strategy. In the entire process, the request and response between the client and the cache management layer, and the operations between each module are executed in a branch (alt) and parallel (par) manner, respectively.
[0211] Furthermore, the e-commerce platform implementation configuration provided in this application includes: cache optimization configuration, adaptive optimization configuration, and business-specific configuration. The cache optimization configuration includes cluster configuration, time window configuration, dynamic TTL algorithm configuration, weight configuration, frequency factor calculation, and time decay configuration; the adaptive optimization configuration includes system load threshold and adjustment strategy; and the business-specific configuration includes product category configuration, promotional activity configuration, new product configuration, inventory synchronization configuration, monitoring configuration, and log configuration.
[0212] Furthermore, the cluster configuration in the cache optimization configuration (ecommerce_cache_config) can be set to, for example, the number of cache nodes (nodes) to 12, the replication factor (replication_factor) to 2, consistent hashing to be enabled, and the number of virtual nodes (virtual_nodes) to 150.
[0213] The time window configuration (time_window) can be set to, for example, a window size of 300 seconds to adapt to the 5-minute window of e-commerce access mode, a slide interval of 60 seconds to ensure real-time sliding of 1 minute, a maximum number of windows to retain (max_windows) of 48, which corresponds to 4 hours of historical data, a hot product access threshold of 1000, and an analysis interval of 30 seconds, etc.
[0214] The dynamic TTL algorithm configuration (ttl_algorithm) can be set to, for example, a base TTL (base_ttl) of 1800 seconds, a minimum TTL (min_ttl) of 300 seconds (5 minutes for frequent updates), and a maximum TTL (max_ttl) of 7200 seconds (2 hours for stable products).
[0215] Weight configurations can include, for example, access frequency weight of 0.4, recency weight of 0.3, load adjustment weight of 0.2, and business rule weight of 0.1.
[0216] Frequency factor calculation can be achieved by setting the low-frequency access threshold (threshold_low) to 10, the mid-frequency access threshold (threshold_medium) to 100, and the high-frequency access threshold (threshold_high) to 1000, with corresponding multipliers of (multiplier_low) 0.5, (multiplier_medium) 1.0, and (multiplier_high) 2.0, etc.
[0217] The time decay (time_decay) configuration can be, for example, a half-life of 3600 seconds, a decay rate of 0.693, and a minimum decay value of 0.1.
[0218] In the adaptive optimizer, system load thresholds can include, for example, a CPU warning threshold of 70, a CPU critical threshold of 85, a memory warning threshold of 75, a memory critical threshold of 90, an I / O warning threshold of 80, and an I / O critical threshold of 95.
[0219] Adjustment strategies could include setting the base adjustment factor to 0.1, the maximum adjustment range to 0.3, the minimum adjustment interval to 30 seconds, and the rollback threshold to 0.05.
[0220] In business-specific configurations (business_rules), product category configurations (categories) can be configured as follows: hot products (such as mobile phones, computers, and home appliances) can be set to a TTL multiplier of 2.0 and a high priority; seasonal products (such as clothing and outdoor products) can be set to a TTL multiplier of 1.5 and a medium priority; and stable products (such as books and daily necessities) can be set to a TTL multiplier of 1.0 and a normal priority.
[0221] Promotional activity configurations can include setting the TTL factor (boost_factor) for the promotion period to 3.0, the pre-warm time (pre_warm_hours) to 2 hours, and the cool-down time (cool_down_hours) to 1 hour.
[0222] New product configurations (new_products) can include setting the initial TTL (initial_ttl) to 600 seconds, the observation period (observation_period) to 3600 seconds, and the promotion threshold (promotion_threshold) to 50, etc.
[0223] Inventory synchronization configurations can include setting the synchronization interval (sync_interval) to 30 seconds, the low stock threshold (low_stock_threshold) to 10 seconds, and the out-of-stock TTL (out_of_stock_ttl) to 60 seconds.
[0224] Monitoring configurations can include setting the metrics collection interval to 10 seconds, and alarm thresholds such as a low hit rate threshold of 0.8, a high response time threshold of 50 milliseconds, and a high error rate threshold of 0.01.
[0225] Log configuration can include setting the level to "INFO" and enabling access logging, performance logging, and adjustment logging.
[0226] Furthermore, the target information may also include information other than cached data access event information, application business scenario information, and system load status information. Implementation methods for other scenarios will not be elaborated here.
[0227] By adopting the above solution, a three-layer architecture of time window analysis, multi-factor TTL calculation, and load adaptive adjustment is used to deeply integrate access pattern analysis, system status monitoring, and business rule configuration, bringing intelligent management to the caching system.
[0228] First, the multi-granularity time window management achieved through the sliding time window analyzer, such as second-level, minute-level, and hour-level time windows, along with efficient data storage using a circular buffer, enables the system to continuously and accurately capture and analyze real-time data access patterns. This overcomes the shortcomings of traditional fixed TTL strategy time window management, such as its inability to identify data access time patterns and popularity trends, providing an accurate and timely data foundation for intelligent decision-making.
[0229] Secondly, the multi-factor TTL calculation engine comprehensively calculates access frequency factors (such as those based on logarithmic functions), time decay factors (such as those based on exponential decay models), load adjustment factors, and business rule factors, and fuses them according to preset weights. This enables it to dynamically calculate a personalized lifetime for each cached item that best matches its current value, system state, and business importance. This solves the problems of lack of adaptability and low resource utilization caused by the one-size-fits-all approach of traditional strategies, achieving optimal configuration of cache resources based on popularity, load, and business needs, thereby improving cache hit rate and memory value output.
[0230] Finally, the adaptive optimization controller, through real-time load monitoring and a strategy adjustment decision engine based on machine learning algorithms, enables the system to keenly perceive changes in system resource pressure such as CPU, memory, and I / O, and automatically trigger multi-dimensional strategy adjustments, such as adjusting the TTL ratio and eviction frequency. This effectively compensates for the lack of load awareness in traditional systems. During high concurrency or load surges, such as e-commerce promotions, it can automatically scale back defenses to avoid cache avalanche and system overload, while actively maximizing performance under normal load conditions, thereby enhancing system stability.
[0231] In summary, this application, through precise heat analysis and intelligent TTL management, ensures that hot data remains valid in the cache for a longer period, while cold data is promptly cleaned up, thereby significantly improving the cache hit rate. This aims to increase the hit rate from 70-80% to over 90% and improve resource utilization efficiency. By dynamically adjusting the caching strategy, optimal memory resource allocation is achieved, reducing invalid data usage and increasing the value output per unit of memory. It is expected to support more valid data caching with the same memory capacity. Through load awareness and adaptive adjustment mechanisms, the performance of the caching system is prevented from drastically declining under high load, ensuring stable service quality under various load conditions. Automated strategy adjustment and intelligent parameter optimization reduce the need for manual intervention, lowering the complexity and cost of system operation and maintenance. A flexible configuration mechanism and scalable algorithm framework are designed to enable the system to adapt to the specific needs of different industries and business scenarios, providing personalized caching optimization solutions.
[0232] The data caching management method provided in this application can be applied to electronic devices, such as computers, servers, and other electronic devices.
[0233] like Figure 14 The diagram shown is a structural schematic of an electronic device provided in an embodiment of this application. Figure 14 As shown, the electronic device may include: transceiver 121, processor 122, and memory 123.
[0234] The processor 122 executes computer execution instructions stored in the memory, causing the processor 122 to perform the technical solution of the data cache management method in the above embodiments. The memory 123 is connected to the processor 122 via the system bus and completes mutual communication; the memory 123 is used to store computer program instructions. The transceiver 121 can be used to obtain the task to be run and its configuration information.
[0235] This application also provides a computer program product containing instructions. The computer program product may be a software or program product containing instructions, capable of running on a computing device or stored on any usable medium. When the computer program product runs on at least one computing device, it causes the at least one computing device to perform the data cache management method described above.
[0236] This application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium capable of being stored by a computing device, or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive). The computer-readable storage medium includes instructions that instruct the computing device to execute the aforementioned data cache management method.
[0237] It should be noted that, in addition to the specific embodiments described above, those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Although the description of this application is presented in conjunction with preferred embodiments, this does not mean that the features of this application are limited to these embodiments. On the contrary, the purpose of describing the application in conjunction with the embodiments is to cover other options or modifications that may be derived based on the claims of this application. To provide a thorough understanding of this application, many specific details are included in the above description, and this application may also be implemented without using these details. Furthermore, to avoid confusion or obscuring the focus of this application, some specific details will be omitted in the description. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0238] It should be noted that in this specification, similar reference numerals and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0239] Although this application has been illustrated and described with reference to certain preferred embodiments, those skilled in the art should understand that the above description is a further detailed explanation of the application in conjunction with specific embodiments, and should not be construed as limiting the specific implementation of the application to these descriptions. Those skilled in the art can make various changes in form and detail, including some simple deductions or substitutions, without departing from the spirit and scope of this application.
Claims
1. A data cache management method, characterized in that, The method, applied to a data caching system, includes: Obtain target information, which includes at least one of cached data access event information, application business scenario information, and system load status information. The cached data access event information is obtained based on the window data of the target detection time window obtained by the dynamic sliding time window detection algorithm. The algorithm parameters of the dynamic sliding time window detection algorithm are dynamically determined based on the system load status, and the algorithm parameters of the dynamic sliding time window detection algorithm include the window size. Based on the data caching strategy adjustment algorithm, a corresponding strategy adjustment factor is determined according to the target information, and the data caching strategy for the corresponding cached data is adjusted according to the strategy adjustment factor. The algorithm parameters of the data caching strategy adjustment algorithm are dynamically determined based on the system load status, and the algorithm parameters of the data caching strategy adjustment algorithm include a lifetime calculation parameter. The data caching strategy includes a lifetime. According to the adjusted data caching strategy, cache management is performed on the corresponding cached data, including lifecycle management.
2. The method according to claim 1, characterized in that, When the target information only includes the cached data access event information, the policy adjustment factor is an access adjustment factor. Based on the data caching policy adjustment algorithm, the corresponding policy adjustment factor is determined according to the target information, and the data caching policy for the corresponding cached data is adjusted according to the policy adjustment factor, including: Based on the cached data access event information, the data popularity information of the corresponding cached data is determined and used as the access adjustment factor; Based on the access adjustment factor and the base lifetime, the adjusted lifetime of the corresponding cached data is determined.
3. The method according to claim 2, characterized in that, Based on the cached data access event information, determine the data popularity information of the corresponding cached data, including: Based on the cached data access event information, determine the data access frequency indication information, the data access time freshness indication information, and the data importance indication information; Based on the data access frequency indication information, the data access time freshness indication information, and the data importance indication information, the data popularity information of the corresponding cached data is determined.
4. The method according to claim 3, characterized in that, When the cached data access event information includes the number of data accesses, the data access time, and the size of the accessed data, and the data popularity information is a data popularity score. Based on the cached data access event information, determine data access frequency indication information, data access time freshness indication information, and data importance indication information, including: The access frequency weight is determined based on the number of data accesses as the data access frequency indication information; the time distribution weight is determined based on the data access time as the data access time freshness indication information; and the data size weight is determined based on the size of the accessed data as the data importance indication information. Based on the data access frequency indication information, the data access time freshness indication information, and the data importance indication information, the data popularity information of the corresponding cached data is determined, including: The data popularity score of the corresponding cached data is determined based on the access frequency weight, the time distribution weight, the data size weight, and the weight coefficients corresponding to each weight.
5. The method according to claim 1, characterized in that, When the target information includes the cached data access event information and the system load status information, the policy adjustment factor includes an access adjustment factor and a load adjustment factor. Based on the data caching policy adjustment algorithm, the corresponding policy adjustment factor is determined according to the target information, and the data caching policy for the corresponding cached data is adjusted according to the policy adjustment factor, including: The access adjustment factor is determined based on the cached data access event information, and the load adjustment factor is determined based on the system load status information; Based on the access adjustment factor, the load adjustment factor, and the base lifetime, determine the adjusted lifetime of the corresponding cached data.
6. The method according to claim 1, characterized in that, When the target information includes the cached data access event information, the application business scenario information, and the system load status information, the policy adjustment factor includes an access adjustment factor, a business adjustment factor, and a load adjustment factor. Based on the data caching policy adjustment algorithm, the corresponding policy adjustment factor is determined according to the target information, and the data caching policy for the corresponding cached data is adjusted according to the policy adjustment factor, including: The access adjustment factor is determined based on the cached data access event information, the service adjustment factor is determined based on the application service scenario information, and the load adjustment factor is determined based on the system load status information; Based on the access adjustment factor, the service adjustment factor, and the load adjustment factor, the factor coefficients corresponding to each factor, and the basic lifetime, the adjusted lifetime of the corresponding cached data is determined.
7. The method according to claim 1, characterized in that, When the target information only includes the system load status information, the policy adjustment factor is a load adjustment factor. Based on the data caching policy adjustment algorithm, the corresponding policy adjustment factor is determined according to the target information, and the data caching policy for the corresponding cached data is adjusted according to the policy adjustment factor, including: The system load status information is input into the corresponding system load prediction model so that the system load prediction model can obtain the predicted system load status information for the future target time based on the system load status information. The load adjustment factor is determined based on the predicted system load status information; The strategy adjustment mode is determined based on the load adjustment factor. Based on the strategy adjustment mode, determine the adjusted lifetime of the corresponding cached data.
8. A data caching management system, characterized in that, The system comprises a client layer and a data caching system layer. The data caching system layer includes a client access layer, a cache management and analysis layer, a storage layer, and a data layer. The client layer includes at least one application. The application in the client layer is used to send a data access request for cached data to the client access layer in the data caching system layer; The client access layer is used to receive the data access request and send the data access request to the cache management and analysis layer; The cache management and analysis layer is used to perform corresponding processing based on the data stored in the storage layer and / or the data layer according to the data access request, and is used to execute the data cache management method as described in any one of claims 1-7 to realize cache data management; The storage layer is used to store cached data; The data layer is used to store statistical data and metadata about the operation of the data caching system.
9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes the computer execution instructions stored in the memory to cause the electronic device to perform the data cache management method as described in any one of claims 1-7.
Citation Information
Patent Citations
Data cache node management method
CN117472279A
Database caching strategy adjusting method, device and equipment
CN118796896A
Cache management optimization method and system
CN119961189A
Hybrid high-performance storage method and system and medium
CN120179173A