Cache data optimization method and device based on service information, equipment and storage medium

CN121092582BActive Publication Date: 2026-10-09SHENZHEN FENGRUNDA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511025100.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-24
Publication Date
2026-10-09
Estimated Expiration
2045-07-24

AI Technical Summary

Technical Problem

[0005]本申请的主要目的在于提供一种基于业务信息的缓存数据优化方法、装置、设备及存储介质,旨在解决缓存系统在不同业务场景下无法合理匹配数据的实际使用周期,导致缓存数据的淘汰时机与业务需求不符的技术问题

Benefits of technology

[0052]This technical approach, which involves acquiring business information and initial cached data, determining the expiration time of the initial cached data based on the business information, selecting cached data to be tested from the initial cached data and judging its validity based on the expiration time, and finally deleting expired data and updating the expiration time based on the judgment results, addresses the shortcomings of existing technologies that often use fixed expiration times or time periods for cached data. These limitations include unreasonable expiration times, lack of flexibility, and high performance overhead due to comprehensive checks. Dynamically determining the expiration time based on business information allows for a better match between expiration times and business needs, avoiding premature or late data eviction. Furthermore, by selecting data to be tested instead of conducting a comprehensive check, the scope and frequency of checks are reduced. Therefore, this approach solves the problems of fixed expiration times not matching business needs, insufficient policy flexibility, and high performance overhead. Compared to existing technologies, it achieves reasonable cache data eviction, improves cache utilization, enhances the adaptability of the caching strategy to different business scenarios, reduces system performance overhead, and improves overall system efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121092582B_ABST
    Figure CN121092582B_ABST
Patent Text Reader

Abstract

The application discloses a cache data optimization method and device based on service information, equipment and a storage medium, relates to the technical field of data caching, and discloses a cache data optimization method based on service information, which comprises the following steps: obtaining service information and initial cache data; determining the expiration time of the initial cache data according to the service information; selecting to-be-detected cache data according to the initial cache data, and performing effective judgment on the to-be-detected cache data according to the expiration time to obtain a judgment result; and deleting expired data in the to-be-detected cache data and updating the expiration time according to the judgment result, thereby completing cache data optimization. The application realizes dynamic adjustment of a cache expiration strategy, improves cache utilization, and reduces system performance overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data caching technology, and in particular to methods, apparatus, devices and storage media for optimizing cached data based on business information. Background Technology

[0002] In modern high-concurrency business scenarios, caching technology is widely used in e-commerce, social media, finance, and other industries as a key means to improve system response speed and reduce backend database pressure. Redis, as a mainstream in-memory key-value database, undertakes the storage of a large amount of hot data in actual deployments due to its high performance and high availability. To control the lifecycle of cached data and prevent invalid or expired data from consuming memory resources, expiration policies are often used to automatically evict data.

[0003] However, traditional caching systems often manage data validity by using fixed expiration times. This is typically achieved by setting a static lifespan when data is written to the cache, or by using a pre-defined lifecycle management mechanism to batch clean up expired data. While static lifespans can meet basic cache eviction requirements in simple business scenarios, they often become rigid in complex business environments. Because they cannot perceive the actual usage value of data at different times, problems such as premature data deletion leading to decreased hit rates and prolonged cache retention causing resource waste can easily occur.

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

[0005] The main purpose of this application is to provide a method, apparatus, device and storage medium for optimizing cached data based on business information, which aims to solve the technical problem that the caching system cannot reasonably match the actual usage cycle of data in different business scenarios, resulting in the timing of cached data being inconsistent with business needs.

[0006] To achieve the above objectives, this application proposes a cache data optimization method based on business information, the method comprising:

[0007] Retrieve business information and initial cached data;

[0008] The expiration time of the initial cached data is determined based on the business information;

[0009] Based on the initial cache data, select the cache data to be detected, and make an effective judgment on the cache data to be detected based on the expiration time to obtain the judgment result;

[0010] Based on the judgment result, expired data in the cache data to be detected is deleted and the expiration time is updated to complete the cache data optimization.

[0011] In one embodiment, the step of determining the expiration time of the initial cached data based on the business information includes:

[0012] Obtain the preset dynamic buffer coefficient mapping rules, business end time, and preset calculation cycle, and obtain access volume data and cache hit rate based on the business information and the preset calculation cycle;

[0013] Calculate the historical standard deviation and historical mean of the access volume data based on the access volume data, and calculate the fluctuation coefficient based on the historical standard deviation and the historical mean;

[0014] The buffer coefficient is determined according to the mapping rule between the fluctuation coefficient and the preset dynamic buffer coefficient;

[0015] The expiration time of the initial cached data is determined based on the business end time, the buffer coefficient, and the historical standard deviation.

[0016] In one embodiment, the step of selecting cache data to be detected based on the initial cache data and effectively judging the cache data to be detected based on the expiration time to obtain a judgment result includes:

[0017] Obtain the preset sampling period, preset sampling ratio, and current time, and obtain the target access time based on the initial cache data;

[0018] According to the preset sampling period and the preset sampling ratio, cache data to be detected is selected from the initial cache data;

[0019] The expiration time interval is determined based on the current time and the target access time;

[0020] The cached data to be detected is effectively judged based on the expiration time interval and the expiration time to obtain the judgment result.

[0021] In one embodiment, the step of effectively judging the cached data to be detected based on the expiration time interval and the expiration time to obtain a judgment result includes:

[0022] Obtain a valid time window, and determine the expiration time window based on the expiration time interval and the expiration time;

[0023] The expired time window is compared with the valid time window to obtain the time comparison result;

[0024] When the time comparison result shows that the expiration time window is greater than the valid time window, the judgment result is confirmed to be that the cached data to be detected is invalid.

[0025] When the time comparison result shows that the expiration time window is less than or equal to the valid time window, the judgment result is confirmed to be that the cached data to be detected is valid.

[0026] In one embodiment, after the step of deleting expired data and updating the expiration time in the cached data to be detected based on the judgment result to complete the cache data optimization, the method further includes:

[0027] Detect whether sudden traffic events occur in cache access requests;

[0028] When the burst traffic event is detected in a cache access request, obtain the historical standard deviation and the duration of the burst traffic event;

[0029] The extension period is determined based on the duration of the emergency and the historical standard deviation.

[0030] The extended buffer time is determined based on the extended period and the historical standard deviation;

[0031] Update the cache data configuration of the cache access request according to the extended buffer time.

[0032] In one embodiment, the step of detecting whether a sudden traffic event has occurred in the cache access request includes:

[0033] Obtain historical averages, historical standard deviations, and burst traffic thresholds, and retrieve current access traffic data based on cached access requests;

[0034] The burst traffic value is determined based on the current access traffic data, the historical mean, and the historical standard deviation.

[0035] When the burst traffic value is greater than the burst traffic threshold, it is determined that the burst traffic event has occurred in the cache access request.

[0036] In one embodiment, the step of obtaining business information includes:

[0037] Obtain initial log data, initial API call records, preset statistical periods, preset timestamps, and the current business scenario;

[0038] Abnormal log data is determined based on the initial log data and the abnormal peak threshold, and the abnormal log data is deleted from the initial log data to obtain standard log data.

[0039] Align the standard log data and the initial interface call record according to the preset timestamp to obtain the target log data and the target interface call record;

[0040] The access volume data and data hit rate are calculated according to the preset statistical period;

[0041] Based on the current business scenario, determine the business statistics period, and identify the business pattern based on the access volume data and the business statistics period;

[0042] Business information is determined based on the target log data, the target interface call records, the data hit rate, and the business model.

[0043] Furthermore, to achieve the above objectives, this application also proposes a cache data optimization device based on business information, the cache data optimization device based on business information comprising:

[0044] The data acquisition module is used to acquire business information and initial cached data;

[0045] A time determination module is used to determine the expiration time of the initial cached data based on the business information.

[0046] The effective judgment module is used to select cache data to be detected based on the initial cache data, and to make an effective judgment on the cache data to be detected based on the expiration time, so as to obtain a judgment result;

[0047] The data optimization module is used to delete expired data and update the expiration time in the cached data to be detected based on the judgment result, thereby completing the cached data optimization.

[0048] In addition, to achieve the above objectives, this application also proposes a cache data optimization device based on business information, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the cache data optimization method based on business information as described above.

[0049] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the cache data optimization method based on business information as described above.

[0050] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the cache data optimization method based on business information as described above.

[0051] One or more technical solutions proposed in this application have at least the following technical effects:

[0052] This technical approach, which involves acquiring business information and initial cached data, determining the expiration time of the initial cached data based on the business information, selecting cached data to be tested from the initial cached data and judging its validity based on the expiration time, and finally deleting expired data and updating the expiration time based on the judgment results, addresses the shortcomings of existing technologies that often use fixed expiration times or time periods for cached data. These limitations include unreasonable expiration times, lack of flexibility, and high performance overhead due to comprehensive checks. Dynamically determining the expiration time based on business information allows for a better match between expiration times and business needs, avoiding premature or late data eviction. Furthermore, by selecting data to be tested instead of conducting a comprehensive check, the scope and frequency of checks are reduced. Therefore, this approach solves the problems of fixed expiration times not matching business needs, insufficient policy flexibility, and high performance overhead. Compared to existing technologies, it achieves reasonable cache data eviction, improves cache utilization, enhances the adaptability of the caching strategy to different business scenarios, reduces system performance overhead, and improves overall system efficiency. Attached Figure Description

[0053] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0054] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0055] Figure 1 This is a flowchart illustrating an embodiment of the business information-based cached data optimization method of this application.

[0056] Figure 2 This is a flowchart illustrating Embodiment 2 of the caching data optimization method based on business information provided in this application;

[0057] Figure 3 A simplified flowchart illustrating the cache data optimization method based on business information provided in Embodiment 2 of this application;

[0058] Figure 4 This is a schematic diagram of the module structure of the cache data optimization device based on business information according to an embodiment of this application;

[0059] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the cache data optimization method based on business information in the embodiments of this application.

[0060] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0061] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0062] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0063] The main solution of this application embodiment is: to obtain business information and initial cache data; to determine the expiration time of the initial cache data according to the business information; to select cache data to be tested according to the initial cache data, and to effectively judge the cache data to be tested according to the expiration time to obtain a judgment result; to delete the expired data in the cache data to be tested and update the expiration time according to the judgment result to complete the cache data optimization.

[0064] In this embodiment, for ease of description, the following description will focus on identifying a cache data optimization device based on business information.

[0065] Because existing caching systems cannot reasonably match the actual usage cycle of data in different business scenarios, the timing of cache data eviction does not match business needs. This application provides a solution that obtains business information and initial cache data, determines the expiration time of the initial cache data based on the business information, selects cache data to be tested from the initial cache data and judges its validity based on the expiration time, and finally deletes expired data and updates the expiration time based on the judgment result. Existing technologies often use fixed expiration times or time periods for cache data, which suffers from unreasonable expiration times, lack of flexibility, and high performance overhead due to comprehensive checks. Dynamically determining the expiration time based on business information allows the expiration time to better match business needs, avoiding premature or late data eviction. Furthermore, by selecting data to be tested instead of conducting a comprehensive check, the scope and frequency of checks are reduced. Therefore, this solves the problems of fixed expiration times not matching business needs, insufficient policy flexibility, and high performance overhead. Compared with existing technologies, this achieves reasonable cache data eviction, improves cache utilization, enhances the adaptability of the caching strategy to different business scenarios, reduces system performance overhead, and improves the overall system operating efficiency.

[0066] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions, a cached data optimization device based on business information, etc. The following description uses a cached data optimization device based on business information as an example to illustrate this embodiment and the subsequent embodiments.

[0067] Based on this, embodiments of this application provide a method for optimizing cached data based on business information, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the cached data optimization method based on business information in this application.

[0068] In this embodiment, the cache data optimization method based on business information includes steps S10 to S40:

[0069] Step S10: Obtain business information and initial cache data;

[0070] It's important to note that business information refers to various types of data related to business operations, primarily including peak business hours, off-peak business hours, and data usage frequency. Peak business hours are periods when business traffic is significantly higher than average, such as during promotional events or prime evening hours for e-commerce systems. Off-peak business hours are periods when business traffic is significantly lower than average, such as the early morning hours for e-commerce systems. Data usage frequency refers to the number of times various types of cached data are accessed and how frequently they are updated. For example, frequently accessed information about popular products indicates high usage frequency, while infrequent access to historical order details indicates low usage frequency.

[0071] Additionally, initial cache data refers to the raw cache data stored in Redis, that is, cache data that has not yet undergone optimization. Initial cache data is information generated by the business system during operation and temporarily stored in the cache, such as product prices, inventory quantities, and basic user information in an e-commerce system.

[0072] In one feasible implementation, step S10 may include steps S11 to S16:

[0073] Step S11: Obtain initial log data, initial interface call records, preset statistical period, preset timestamp, and current business scenario;

[0074] It should be noted that the initial log data is the raw record data generated during the operation of the business, which includes various raw information such as business access time, access count, and data calls.

[0075] In addition, the initial interface call record is the original record of various interfaces being called in the business system, including information such as the time of the interface call, the number of calls, and the specific data of the call.

[0076] In addition, the preset statistical period is a pre-set time interval for statistical analysis of data, that is, a fixed time length used for data aggregation and calculation, which is determined according to the regular fluctuation frequency of the business.

[0077] Additionally, a preset timestamp is a pre-defined unified time stamp used to synchronize data from different sources according to the time dimension. The timestamp is usually represented by a specific point in time.

[0078] Additionally, the current business scenario refers to the specific operating environment or business type of the business at the current moment. Different business scenarios have different operating characteristics and data requirements. For example, an e-commerce business may be in a daily sales scenario, where user traffic is relatively stable; it may be in a promotional activity scenario, where user traffic will increase significantly and be concentrated in a specific period; or it may be in a maintenance scenario in the early morning, where user traffic will decrease significantly.

[0079] Step S12: Determine abnormal log data based on the initial log data and the abnormal peak threshold, and delete the abnormal log data from the initial log data to obtain standard log data;

[0080] It should be noted that the abnormal peak threshold is a critical value used to determine whether there are extreme values ​​in the initial log data; that is, it is the standard used to define whether a log data is abnormal. This threshold is preset based on the historical normal operation data of the business, and the threshold may vary for different business scenarios.

[0081] Furthermore, abnormal log data refers to extreme data in the initial log data that exceeds the abnormal peak threshold, i.e., log records that do not conform to the normal operation rules of the business.

[0082] Additionally, standard log data is obtained by removing abnormal log data from the initial log data; in other words, it is cleaned and accurately reflects the normal operation of the business. This data removes the interference of extreme values, providing a reliable foundation for subsequent data analysis.

[0083] Understandably, each record in the initial log data is first compared with the abnormal peak threshold to identify all abnormal log data that exceeds the threshold; then, the abnormal log data is removed from the initial log data, and the remaining log data becomes the standard log data.

[0084] Step S13: Align the standard log data and the initial interface call record according to the preset timestamp to obtain the target log data and the target interface call record;

[0085] It should be noted that the target log data is standard log data aligned with a preset timestamp; that is, standard log data organized according to a unified time stamp. After alignment, this data is more regular in the time dimension, facilitating correlation analysis with time-aligned data from other sources.

[0086] Additionally, the target API call record is the API call record obtained by aligning the initial API call record with a preset timestamp; that is, the initial API call record is organized according to a unified timestamp. This alignment ensures that the API call record and the target log data are consistent in time, facilitating comprehensive analysis of the relationship between business access and API calls.

[0087] Understandably, standard log data and initial API call records are organized according to a preset unified timestamp, so that they correspond to each other at the same point in time. For example, the preset timestamp is every hour of the minute. Standard log data contains access records, and initial API call records contain API call records within the same minute. Through alignment, both parts of data are marked as records corresponding to the preset timestamp. The resulting log data organized according to this timestamp is the target log data, and the corresponding API call records are the target API call records.

[0088] Step S14: Statistically analyze access volume data and data hit rate according to the preset statistical period;

[0089] It is understandable that the access volume data is the total number of times the business is accessed within a preset statistical period, that is, the total number of times users access the business system within the preset statistical period.

[0090] Additionally, the data hit rate refers to the ratio of the number of times the required data is successfully retrieved from the cache to the total number of accesses during a business access process. Specifically, when a user accesses the business system, if the required data exists in the cache, it is successfully retrieved; this number is called the cache hit count. The ratio of the cache hit count to the total number of accesses is the data hit rate. The higher this ratio, the higher the efficiency of cache utilization.

[0091] Understandably, the system calculates access volume and data hit rate based on a preset statistical period. This means calculating the total number of business visits and the ratio of cache hits to total visits within a preset time interval. For example, if the preset statistical period is one hour, and the period is 10:00-11:00, the system records 5000 total visits, with 4000 successfully retrieving data from the cache. Therefore, the access volume for this period is 5000, and the data hit rate is the ratio of 4000 to 5000, which is 80%.

[0092] Step S15: Determine the business statistics period based on the current business scenario, and identify the business pattern based on the access volume data and the business statistics period;

[0093] It should be noted that the business statistics period is a statistical time granularity determined based on the characteristics of the current business scenario, that is, a time interval that is more in line with the dynamic changes of the specific business.

[0094] Additionally, the business model is the operational pattern identified based on traffic data and business statistical periods. This mainly includes peak business hours, off-peak business hours, and data popularity grading. Peak business hours refer to periods within the business statistical period where traffic is significantly higher than the average level; off-peak business hours are periods where traffic is significantly lower than the average level; data popularity grading categorizes data into high-frequency and low-frequency data based on the frequency of access. For example, the top 20% of data by access volume is considered high-frequency data, and the bottom 50% is considered low-frequency data.

[0095] Understandably, it's advisable to select an appropriate statistical time interval based on the characteristics of the current business scenario, and then summarize the operational patterns of the business based on the access volume data within that interval. For example, if the current business scenario is a 618 promotion on an e-commerce platform, and due to the drastic fluctuations in access volume, the business statistical period is determined to be 5 minutes. By analyzing the access volume data within this period, it is found that the access volume from 9:00 to 12:00 is consistently higher than the average level by 200%, thus identifying this period as the peak business period. At the same time, by statistically analyzing the access frequency of different data, it is found that the access volume of popular product data accounts for 30% of the total access volume and remains consistently high, thus identifying it as high-frequency data, while the access volume of historical order data only accounts for 5%, thus identifying it as low-frequency data. These peak periods and high-frequency data together constitute the business model.

[0096] Step S16: Determine business information based on the target log data, the target interface call record, the data hit rate, and the business mode.

[0097] Understandably, business information is determined based on target log data, target interface call records, data hit rate, and business model. In other words, the business information of business operation is extracted by integrating target log data, target interface call records, data hit rate, and business model.

[0098] Step S20: Determine the expiration time of the initial cached data based on the business information;

[0099] It's important to note that expiration time refers to the duration for which cached data remains valid in the cache. After this period, the cached data will be considered no longer needed and may be processed. The expiration time is dynamically adjusted based on business information. Its setting needs to consider factors such as peak and off-peak business hours and data usage frequency to ensure that cached data is valid when needed and promptly cleared when no longer required.

[0100] It is understandable that determining the expiration time of the initial cached data based on business information means using the collected business information and combining it with preset rules to calculate the effective duration of the initial cached data in the cache.

[0101] Specifically, the system references peak and off-peak hours and data usage frequency in the business information to match preset rules. For example, when the business information shows that the peak hours for an e-commerce system are 9:00-12:00 and a product's information is high-frequency data, the expiration time for that product's information is determined to be the peak end time of 12:00 plus a 30-minute buffer period, i.e., 12:30, according to the preset rule of peak hours plus high-frequency data. When the business information shows that a historical order's information is in the early morning off-peak hours and is low-frequency data, the expiration time is determined to be a fixed 10 minutes, according to the preset rule of off-peak hours plus low-frequency data. In this embodiment, the expiration time can also be adjusted by calculating the volatility of historical data. For example, if the data volatility coefficient for a certain period is 26.6%, which is considered moderate volatility, the expiration time, combined with the buffer coefficient, is determined to be the peak end time plus the adjusted buffer time.

[0102] In one feasible implementation, step S20 may include steps S21 to S24:

[0103] Step S21: Obtain the preset dynamic buffer coefficient mapping rule, business end time and preset calculation cycle, and obtain access volume data and cache hit rate according to the business information and the preset calculation cycle;

[0104] It should be noted that the preset dynamic buffer coefficient mapping rule is a pre-defined correspondence between different fluctuation coefficients and the buffer coefficients, that is, different buffer coefficient values ​​are determined according to the severity of data fluctuations.

[0105] Additionally, the business end time refers to the point in time when a specific business period ends, mainly referring to the end time of peak business periods or specific activities.

[0106] Additionally, the preset calculation period is a pre-defined time range for calculating historical data, i.e., the period of historical data selected for analysis. In this embodiment, it can be set to 30 days, meaning that relevant data from the past 30 days is selected as the calculation sample. Setting it to 30 days includes sufficient historical information to reflect business patterns while avoiding data staleness due to excessive time.

[0107] Furthermore, the access volume data refers to the total number of times the service is accessed within each unit of time during the preset calculation period. Cache hit rate refers to the ratio of the number of times the required data is successfully retrieved from the cache to the total number of accesses within the preset calculation period.

[0108] Step S22: Calculate the historical standard deviation and historical mean of the access volume data based on the access volume data, and calculate the fluctuation coefficient based on the historical standard deviation and the historical mean.

[0109] It should be noted that historical standard deviation is a statistical indicator that reflects the degree of fluctuation in traffic data within a preset calculation period, that is, the average degree to which the data deviates from the historical mean. The larger the standard deviation, the more drastic the fluctuation in traffic data; conversely, the smaller the standard deviation, the more stable the fluctuation.

[0110] Additionally, the historical average is the average of visitor volume data over a preset calculation period; it is calculated by summing all visitor volume data and dividing by the number of data points. The historical average reflects the average level of visitor volume within that period.

[0111] Furthermore, the volatility coefficient is the ratio of the historical standard deviation to the historical mean, usually expressed as a percentage, used to reflect the relative volatility of traffic data. That is, volatility coefficient = (historical standard deviation ÷ historical mean) × 100%. This coefficient is unaffected by the data volume and can more objectively compare the volatility of different datasets.

[0112] Understandably, by using traffic data, the historical mean and standard deviation of this data are first calculated, and then the fluctuation coefficient is calculated by the ratio of the two. By calculating the historical mean, historical standard deviation, and fluctuation coefficient, the degree of fluctuation of the traffic data is quantified, providing a scientific basis for subsequently determining the buffer coefficient based on the fluctuation situation, and ensuring that the setting of the buffer coefficient can accurately match the actual fluctuation characteristics of the data.

[0113] In one feasible implementation, to prioritize recent data when calculating historical standard deviation, an Exponentially Weighted Moving Average (EWMA) method is used. Specifically, data from the last 7 days is assigned a higher weight, with the weight decreasing exponentially. That is, data closer to the current time has a higher weight, and data further back has a lower weight. The weight calculation formula can be expressed as weight = 0.9 raised to the power of i, where i is an integer from 30 to 1, taken in descending order. The weighted standard deviation is calculated based on this weight. The calculation method involves first calculating the square of the difference between each data point and the mean, then averaging these squared values ​​with the set weights, and finally taking the square root of the average. Historical standard deviations calculated in this way more accurately reflect the fluctuation characteristics of recent data, making subsequent calculations based on historical standard deviations, such as volatility coefficients and extended buffer times, more closely aligned with the latest business trends.

[0114] Step S23: Determine the buffer coefficient according to the mapping rule between the fluctuation coefficient and the preset dynamic buffer coefficient;

[0115] It's important to note that the buffer coefficient is a factor used to adjust the buffer duration within the expiration time. It's a multiplier determined by the degree of data volatility, specifying the proportion of time cached data is retained after the business ends. A larger buffer coefficient means a longer buffer period needs to be retained; conversely, a smaller coefficient means a shorter period.

[0116] Understandably, the calculated volatility coefficient is matched with a preset dynamic buffer coefficient mapping rule to determine the corresponding buffer coefficient. For example, in an e-commerce scenario, the calculated volatility coefficient is 26.6%. Checking the preset mapping rule, we know that when the volatility coefficient is between 10% and 30%, the basic buffer coefficient is 1.0. At the same time, the Z value of the current access volume is detected to be 2.1 (close to abnormal volatility). According to the rule, an additional buffer coefficient of 0.3 is required. Therefore, the final buffer coefficient is determined to be 1.3, which is used for subsequent calculation of the buffer duration.

[0117] In this embodiment, the preset dynamic buffer coefficient mapping rule is as shown in Table 1 below. When the volatility coefficient is less than 10%, the buffer coefficient can be 0.5, indicating high data stability and no need for excessive buffering. When the volatility coefficient is between 10% and 30%, the buffer coefficient is 1.0, meaning that moderate volatility requires basic buffering. When the volatility coefficient is greater than 30%, the buffer coefficient is 2.0, meaning that severe volatility requires double buffering. This rule is based on historical data volatility patterns and is used to dynamically adjust the buffer duration, making the expiration time more closely match the actual volatility of the business. The preset dynamic buffer coefficient mapping rule is as shown in Table 1 below:

[0118] Table 1

[0119]

[0120] Step S24: Determine the expiration time of the initial cached data based on the service end time, the buffer coefficient, and the historical standard deviation.

[0121] As we understand it, expiration time refers to the final point in time when initially cached data remains valid in the cache; after this point, the cached data is considered expired. The expiration time is calculated jointly by the business end time, the buffer coefficient, and the historical standard deviation, using the formula: Expiration Time = Business End Time + Buffer Coefficient × Historical Standard Deviation (in seconds). For example, if the business end time is 12:00, the buffer coefficient is 1.3, and the historical standard deviation is 4210 seconds, then the expiration time = 12:00 + 1.3 × 4210 seconds ≈ 12:01:31, meaning the cached data expires after 12:01:31. By comprehensively calculating the expiration time using the business end time, buffer coefficient, and historical standard deviation, the expiration time ensures sufficient buffer time for subsequent requests after the business ends, while also dynamically adjusting according to data fluctuations. This avoids the unreasonableness of a fixed expiration time and improves the effective utilization rate of cached data.

[0122] Step S30: Select cache data to be detected based on the initial cache data, and make an effective judgment on the cache data to be detected based on the expiration time to obtain a judgment result;

[0123] It should be noted that the cached data to be tested is a subset of the initial cached data, i.e., the cached data that requires validity checks. Selecting the cached data to be tested using a sampling method reduces the workload of the checks.

[0124] Understandably, valid judgment refers to checking whether the cached data to be tested is still within its valid period based on a defined expiration time. That is, it determines whether the current time has exceeded the expiration time of the cached data to be tested. If it has not exceeded the expiration time, the data is valid; if it has, the data is invalid. The conclusion of validity or invalidity is the judgment result.

[0125] Understandably, when selecting cached data to be tested, a sampling algorithm is used. For example, 10% of the data is randomly selected from the initial cached data every 10 minutes. In an e-commerce system, a portion of product and user information might be selected as the cached data to be tested. When determining validity, the current time of the cached data to be tested is compared with its predetermined expiration time. For example, if the expiration time of a product's information is 12:30, and the current time is 12:20, the product information is considered valid; if the current time is 12:40, the product information is considered invalid. These valid or invalid conclusions constitute the judgment result. During the judgment process, data that is about to expire or has already expired is processed first to improve the efficiency of the judgment.

[0126] In one feasible implementation, step S30 may include steps S31 to S34:

[0127] Step S31: Obtain the preset sampling period, preset sampling ratio, and current time, and obtain the target access time based on the initial cache data;

[0128] It should be noted that the preset sampling period is a pre-set time interval for performing cached data sampling checks, i.e., how often sampling is performed. In this embodiment, it can be set to 10 minutes, that is, sampling checks are performed on the initial cached data every 10 minutes. Setting it to 10 minutes can promptly detect expired data without increasing performance overhead due to excessively frequent checks.

[0129] Additionally, the preset sampling ratio is the proportion of the cached data to be checked to the total initial cached data during each sampling check. In this embodiment, it can be set to 10%, meaning that 10% of the data is sampled from all the initial cached data for checking each time. This ratio setting needs to balance the accuracy of the check and performance consumption; a ratio that is too high will increase the checking burden, while a ratio that is too low may miss expired data.

[0130] Additionally, the current time is the specific point in time when the sampling inspection operation was performed.

[0131] Furthermore, the target access time is the time when the initial cached data was last accessed, that is, the specific time when the cached data was last called or used by the business system.

[0132] Step S32: Select the cache data to be detected from the initial cache data according to the preset sampling period and the preset sampling ratio;

[0133] It should be noted that the cached data to be tested is a portion of the cached data selected from the initial cached data according to a preset sampling period and a preset sampling ratio, and is subject to validity judgment.

[0134] Understandably, the cached data to be tested is selected from the initial cached data according to the preset sampling period and preset sampling ratio. That is, according to the set time interval, a sampling algorithm such as random sampling is used to extract a set proportion of data from the initial cached data.

[0135] Step S33: Determine the expiration time interval based on the current time and the target access time;

[0136] It should be noted that the expiration interval is the time difference between the current time and the target access time, that is, the time elapsed from the last time the data was accessed to the current check time.

[0137] Understandably, determining the expiration time interval based on the current time and the target access time involves calculating the difference between the current time and the target access time to obtain the time elapsed since the data was last accessed until the current check. Determining the expiration time interval quantifies the data's idle time, providing a time difference basis for subsequently judging data validity based on the expiration time. This makes the validity judgment more objective and operable, avoiding errors caused by subjective judgment alone.

[0138] Step S34: Effectively judge the cached data to be detected based on the expiration time interval and the expiration time to obtain the judgment result.

[0139] Understandably, by defining a valid time window and an expiration time window, and comparing their sizes, the validity of the cached data to be tested can be determined. Through clearly defined time window comparison rules, the validity of the cached data to be tested can be accurately determined, ensuring that expired data is identified and valid data is retained. This provides an accurate basis for subsequent cache optimization, balancing cache resource utilization efficiency with business access needs.

[0140] In one feasible implementation, step S34 may include steps S341 to S344:

[0141] Step S341: Obtain the valid time window and determine the expiration time window based on the expiration time interval and the expiration time;

[0142] It should be noted that the effective time window is the longest period for cached data to remain valid, that is, the allowed time between the target access time and the expiration time, which is equal to the difference between the expiration time and the target access time.

[0143] Additionally, the actual time elapsed from the target access time to the current time is the expiration time interval.

[0144] Understandably, obtaining a valid time window and determining the expiration time window based on the expiration interval and expiration time involves first calculating the valid time window and then defining the expiration interval as the expiration time window. Clearly defining the valid and expiration time windows provides a comparable time range for data validity assessment, making the judgment criteria clearer and avoiding errors caused by ambiguity in the time concept.

[0145] Step S342: Compare the expired time window with the valid time window to obtain a time comparison result;

[0146] Understandably, the time comparison result is obtained by comparing the expired time window with the valid time window, that is, by comparing the duration of the two.

[0147] Step S343: When the time comparison result shows that the expiration time window is greater than the valid time window, confirm that the judgment result is that the cached data to be detected is invalid.

[0148] It is understandable that when the time comparison result shows that the expiration time window is greater than the valid time window, the judgment result is that the cached data to be detected is invalid. That is, when the actual idle time of the data exceeds the allowed valid time, the data is judged to have expired.

[0149] Step S344: When the time comparison result shows that the expiration time window is less than or equal to the valid time window, the judgment result is confirmed to be that the cached data to be detected is valid.

[0150] Understandably, when the time comparison result shows that the expiration time window is less than or equal to the valid time window, the cached data to be tested is confirmed to be valid. That is, if the actual idle time of the data does not exceed the allowed valid time, the data is still considered valid. This ensures that valid data continues to be retained in the cache, avoids premature deletion of valid data due to misjudgment, guarantees that business access can quickly retrieve data, and improves business response speed.

[0151] Step S40: Based on the judgment result, delete the expired data in the cache data to be detected and update the expiration time to complete the cache data optimization.

[0152] Understandably, expired data that is deemed invalid, such as product information that has exceeded its expiration time, should be deleted from the cache. For data that is deemed valid, if the business information changes, such as low-frequency data becoming high-frequency data, its expiration time should be updated according to the new business information. Through deletion and update operations, the cache can retain only valid data with reasonable expiration times, thus optimizing the cache data.

[0153] This embodiment provides a cache data optimization method based on business information. By dynamically collecting business operation logs and interface call records, and combining anomaly cleaning, time alignment, periodic statistics, and scenario-based analysis, a precise business pattern is generated. Then, a fluctuation coefficient is calculated and mapped to a buffer coefficient to adaptively set the cache expiration time. Subsequently, the cache data is sampled to determine its validity and perform expiration cleanup or time-update. This solves the technical problem that traditional fixed expiration strategies cannot match business fluctuations, resulting in low cache hit rate and resource waste. It achieves the beneficial effects of significantly improving cache hit rate, reducing storage overhead, and ensuring response speed during peak business periods.

[0154] Based on the first embodiment of this application, in the second embodiment of this application, the content that is the same as or similar to that in the first embodiment described above can be referred to the above description, and will not be repeated hereafter. Based on this, please refer to... Figure 2Following step S40, the cache data optimization method based on business information further includes steps S50 to S90:

[0155] Step S50: Detect whether a sudden traffic event has occurred in the cache access request;

[0156] It should be noted that a sudden traffic surge event refers to an event in which the number of cached access requests suddenly and significantly increases within a short period of time, and continues to exceed a preset threshold. In this embodiment, it is usually identified by the Z-Score detection method, that is, when the difference between the current access volume and the historical average value divided by the historical standard deviation (Z value) is greater than the sudden traffic surge threshold, it is determined to be a sudden traffic surge event.

[0157] In one feasible implementation, step S50 may include steps S51 to S53:

[0158] Step S51: Obtain the historical mean, historical standard deviation, and burst traffic threshold, and obtain the current access traffic data based on cached access requests;

[0159] It should be noted that the historical mean refers to the average number of cache access requests within a preset calculation period. The historical standard deviation is an indicator describing the dispersion of cache access data within the preset calculation period, that is, the average deviation of each access data point from the historical mean.

[0160] Additionally, the burst traffic threshold is a pre-set value used to determine whether a burst traffic event has occurred. When the calculated burst traffic value exceeds this threshold, a burst traffic event is considered to have occurred. In this embodiment, the burst traffic threshold can be set to 3.

[0161] Furthermore, current access traffic data refers to the actual number of cached access requests at the current moment.

[0162] Step S52: Determine the burst traffic value based on the current access traffic data, the historical average, and the historical standard deviation;

[0163] The burst traffic value is an indicator used to measure how much the current access traffic deviates from the historical normal level. It is calculated by dividing the difference between the current access traffic data and the historical mean by the historical standard deviation, i.e., (current access traffic data - historical mean) ÷ historical standard deviation.

[0164] Understandably, the burst traffic value is determined based on current access traffic data, historical average, and historical standard deviation. This is calculated using the formula: Burst Traffic Value = (Current Access Traffic Data - Historical Average) ÷ Historical Standard Deviation. For example, in an e-commerce scenario, the current access traffic data is 25,000, the historical average is 15,800, and the historical standard deviation is 4,210. Substituting these data into the formula, we get (25,000 - 15,800) ÷ 4210 = 9,200 ÷ 4210 ≈ 2.185. This 2.185 is the calculated burst traffic value, used to subsequently determine whether a burst traffic event has occurred.

[0165] Step S53: When the burst traffic value is greater than the burst traffic threshold, it is determined that the burst traffic event has been detected in the cache access request.

[0166] Understandably, when the burst traffic value exceeds the burst traffic threshold, a burst traffic event is detected in the cache access request. This is achieved by comparing the calculated burst traffic value with the preset burst traffic threshold; if the burst traffic value is larger, a burst traffic event is determined to have occurred. Using explicit numerical comparisons to determine whether a burst traffic event has occurred ensures an objective and consistent standard, guaranteeing timely and accurate identification of burst traffic events. This provides the necessary foundation for subsequent handling of burst traffic events and prevents performance issues caused by untimely or inaccurate judgments under burst traffic conditions.

[0167] Step S60: When the burst traffic event is detected in the cache access request, obtain the historical standard deviation and the burst event duration of the burst traffic event;

[0168] It should be noted that the duration of a sudden event refers to the time from the start to the end of the sudden traffic event, that is, the time interval from when the number of visits first exceeds the threshold to when it returns to normal levels.

[0169] Understandably, when a sudden traffic event is detected, the historical standard deviation and the duration of the sudden event are obtained. That is, the historical standard deviation of the traffic is extracted from the historical data of the preset calculation period, and the duration of the sudden traffic event from start to end is recorded.

[0170] Step S70: Determine the extension period based on the duration of the sudden event and the historical standard deviation;

[0171] It should be noted that the extended period refers to the additional basic extension time set during a sudden traffic event to prevent cached data from expiring prematurely. It is a time period calculated based on the duration of the sudden event and the historical standard deviation, and this period reflects the basic extension length required to cope with sudden traffic.

[0172] Understandably, the extension period is determined based on the duration of the traffic surge and the historical standard deviation. This involves combining both values, typically using the duration of the surge as a base and adjusting for historical standard deviation to determine a period that covers the duration of the surge. Determining the extension period ensures that cached data remains valid during the surge, preventing cache invalidation due to an initially short expiration time, reducing database pressure, and ensuring stable system operation under high access volumes.

[0173] Step S80: Determine the extended buffer time based on the extended period and the historical standard deviation;

[0174] Understandably, extended buffer time is an additional buffer duration added on top of the extended period, taking into account the historical standard deviation. It's the time allotted to handle potential subsequent accesses after a surge in traffic has ended. The calculation typically involves adding a certain multiple of the historical standard deviation to the extended period.

[0175] Specifically, the extended buffer time is determined based on the extended period and the historical standard deviation, which is calculated by the formula: Extended Buffer Time Target Access Time = Target Access Time Extended Period Target Access Time + (Multiple Target Access Time × Target Access Time Historical Standard Deviation), where the multiple can be set according to preset rules.

[0176] Step S90: Update the cache data configuration of the cache access request according to the extended buffer time.

[0177] It should be noted that cache data configuration refers to the settings of various attributes of cache data, mainly including parameters such as the expiration time and validity period of cache data.

[0178] Understandably, updating the cache data configuration for cached access requests based on the extended buffer time involves modifying parameters such as the cache data's expiration time to equal the original expiration time plus the extended buffer time. By updating the cache data configuration, the lifecycle of the cache data adapts to sudden traffic events, preventing premature cache expiration and resulting surges in database pressure. This ensures system stability and efficiency under sudden traffic spikes and improves the utilization efficiency of cache resources.

[0179] This embodiment provides a cache data optimization method based on business information. By monitoring cache access traffic in real time and combining it with the Z-Score algorithm to identify sudden traffic events, the method calculates the extension period and the extension buffer time based on the duration of the sudden event and the historical standard deviation, and then dynamically adjusts the cache data expiration configuration. This solves the technical problem of premature cache expiration in sudden high-concurrency scenarios, which leads to a surge in database pressure and deterioration of system response. It achieves the beneficial effects of extending the cache life cycle, smoothing backend load, and ensuring system stability and high availability during traffic surges.

[0180] For example, to help understand the implementation process of the cache data optimization method based on business information obtained by combining this embodiment with the above embodiment one, please refer to... Figure 3 , Figure 3 A simplified flowchart illustrating a method for optimizing cached data based on business information is provided, specifically:

[0181] Businesses A, B, C, and D serve as input sources, providing data to the business information collection and analysis module. After analyzing business patterns and other information, this module interacts bidirectionally with the intelligent cache eviction check mechanism and the dynamic time window management module. The intelligent cache eviction check mechanism checks Redis cached data based on business analysis results and rules to determine whether to evict it. The dynamic time window management module dynamically adjusts the cache time window based on business characteristics. The Redis server receives instructions from the above modules, executes caching operations, and interacts with the Redis logical database (Redis-db) to read, write, and synchronize data. Through the collaboration of these modules, the Redis caching strategy is optimized using business data, improving system performance and resource utilization.

[0182] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the cache data optimization method based on business information in this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0183] This application also provides a cache data optimization device based on business information; please refer to [reference needed]. Figure 4 The cached data optimization device based on business information includes:

[0184] Data acquisition module 10 is used to acquire business information and initial cached data;

[0185] Time determination module 20 is used to determine the expiration time of the initial cached data based on the business information;

[0186] The effective judgment module 30 is used to select cache data to be detected based on the initial cache data, and to make an effective judgment on the cache data to be detected based on the expiration time, so as to obtain a judgment result;

[0187] The data optimization module 40 is used to delete expired data in the cached data to be detected and update the expiration time according to the judgment result, thereby completing the cached data optimization.

[0188] The cache data optimization device based on business information provided in this application, employing the cache data optimization method based on business information in the above embodiments, can solve the technical problem that the cache system cannot reasonably match the actual usage cycle of data in different business scenarios, resulting in a mismatch between the timing of cache data eviction and business needs. Compared with the prior art, the beneficial effects of the cache data optimization device based on business information provided in this application are the same as those of the cache data optimization method based on business information provided in the above embodiments, and other technical features in the cache data optimization device based on business information are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0189] In one embodiment, the time determination module 20 is further configured to obtain a preset dynamic buffer coefficient mapping rule, a service end time, and a preset calculation period; and to obtain access volume data and cache hit rate based on the service information and the preset calculation period; to calculate the historical standard deviation and historical mean of the access volume data based on the access volume data; and to calculate the fluctuation coefficient based on the historical standard deviation and the historical mean; to determine the buffer coefficient based on the fluctuation coefficient and the preset dynamic buffer coefficient mapping rule; and to determine the expiration time of the initial cached data based on the service end time, the buffer coefficient, and the determined historical standard deviation.

[0190] In one embodiment, the valid judgment module 30 is further configured to obtain a preset sampling period, a preset sampling ratio, and the current time; obtain a target access time based on the initial cache data; select cache data to be detected from the initial cache data based on the preset sampling period and the preset sampling ratio; determine an expiration time interval based on the current time and the target access time; and perform a valid judgment on the cache data to be detected based on the expiration time interval and the expiration time to obtain a judgment result.

[0191] In one embodiment, the validity determination module 30 is further configured to obtain a valid time window and determine an expiration time window based on the expiration time interval and the expiration time; compare the expiration time window with the valid time window to obtain a time comparison result; when the time comparison result indicates that the expiration time window is greater than the valid time window, confirm that the cached data to be detected is invalid; when the time comparison result indicates that the expiration time window is less than or equal to the valid time window, confirm that the cached data to be detected is valid.

[0192] In one embodiment, the data optimization module 40 is further configured to detect whether a sudden traffic event occurs in the cache access request; when the sudden traffic event is detected in the cache access request, obtain the historical standard deviation and the duration of the sudden traffic event; determine the extension period based on the duration of the sudden event and the historical standard deviation; determine the extension buffer time based on the extension period and the historical standard deviation; and update the cache data configuration of the cache access request based on the extension buffer time.

[0193] In one embodiment, the data optimization module 40 is further configured to obtain historical mean, historical standard deviation and burst traffic threshold, and obtain current access traffic data according to cache access requests; determine burst traffic value according to the current access traffic data, the historical mean and the historical standard deviation; and determine that a burst traffic event has been detected in the cache access request when the burst traffic value is greater than the burst traffic threshold.

[0194] In one embodiment, the data acquisition module 10 is further configured to acquire initial log data, initial interface call records, a preset statistical period, a preset timestamp, and the current business scenario; determine abnormal log data based on the initial log data and an abnormal peak threshold, and delete the abnormal log data from the initial log data to obtain standard log data; align the standard log data and the initial interface call records according to the preset timestamp to obtain target log data and target interface call records; statistically analyze access volume data and data hit rate according to the preset statistical period; determine the business statistical period based on the current business scenario, and identify the business mode based on the access volume data and the business statistical period; and determine business information based on the target log data, the target interface call records, the data hit rate, and the business mode.

[0195] This application provides a cache data optimization device based on business information. The cache data optimization device based on business information includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the cache data optimization method based on business information in the above embodiment 1.

[0196] The following is for reference. Figure 5This document illustrates a structural diagram of a cached data optimization device based on business information suitable for implementing embodiments of this application. The cached data optimization device based on business information in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 5 The cached data optimization device based on business information shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0197] like Figure 5 As shown, the business information-based cache data optimization device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in ROM (Read Only Memory) 1002 or a program loaded from storage device 1003 into RAM (Random Access Memory) 1004. RAM 1004 also stores various programs and data required for the operation of the business information-based cache data optimization device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via bus 1005. Input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the business-information-based cached data optimization device to wirelessly or wiredly communicate with other devices to exchange data. Although a business-information-based cached data optimization device with various systems is shown in the figure, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems can be implemented alternatively.

[0198] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0199] The cache data optimization device based on business information provided in this application, employing the cache data optimization method based on business information in the above embodiments, can solve the technical problem that the cache system cannot reasonably match the actual usage cycle of data in different business scenarios, resulting in a mismatch between the timing of cache data eviction and business needs. Compared with the prior art, the beneficial effects of the cache data optimization device based on business information provided in this application are the same as those of the cache data optimization method based on business information provided in the above embodiments, and other technical features in the cache data optimization device based on business information are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0200] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0201] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0202] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the cached data optimization method based on business information in the above embodiments.

[0203] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, RAM (Random Access Memory), ROM (Read Only Memory), Erasable Programmable Read Only Memory (EPROM), optical fiber, CD-ROM (CD-Read Only Memory), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0204] The aforementioned computer-readable storage medium may be included in a business information-based cache data optimization device; or it may exist independently and not be assembled into a business information-based cache data optimization device.

[0205] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a business information-based cache data optimization device, the business information-based cache data optimization device performs the following actions: acquires business information and initial cache data; determines the expiration time of the initial cache data based on the business information; selects cache data to be detected based on the initial cache data, and performs an effective judgment on the cache data to be detected based on the expiration time to obtain a judgment result; and deletes the expired data in the cache data to be detected and updates the expiration time based on the judgment result, thereby completing the cache data optimization.

[0206] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages—such as Java, Smalltalk, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a LAN (Local Area Network) or a WAN (Wide Area Network)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0207] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0208] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0209] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described cache data optimization method based on business information. This solves the technical problem that the caching system cannot reasonably match the actual usage cycle of data in different business scenarios, leading to a mismatch between the timing of cache data eviction and business needs. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the cache data optimization method based on business information provided in the above embodiments, and will not be repeated here.

[0210] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method for optimizing cached data based on business information.

[0211] The computer program product provided in this application can solve the technical problem that the caching system cannot reasonably match the actual usage cycle of data in different business scenarios, resulting in a mismatch between the timing of cache data eviction and business needs. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the cache data optimization method based on business information provided in the above embodiments, and will not be repeated here.

[0212] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for optimizing cached data based on business information, characterized in that, The method includes: Obtain business information and initial cached data, including peak business hours, off-peak business hours, and data usage frequency; The expiration time of the initial cached data is determined based on the business information; Based on the initial cache data, select the cache data to be detected, and make an effective judgment on the cache data to be detected based on the expiration time to obtain the judgment result; Based on the judgment result, expired data in the cache data to be detected is deleted and the expiration time is updated to complete the cache data optimization. The step of determining the expiration time of the initial cached data based on the business information includes: Obtain the preset dynamic buffer coefficient mapping rules, business end time, and preset calculation cycle, and obtain access volume data and cache hit rate based on the business information and the preset calculation cycle; Calculate the historical standard deviation and historical mean of the access volume data based on the access volume data, and calculate the fluctuation coefficient based on the historical standard deviation and the historical mean; The buffer coefficient is determined according to the mapping rule between the fluctuation coefficient and the preset dynamic buffer coefficient; The expiration time of the initial cached data is determined based on the business end time, the buffer coefficient, and the historical standard deviation. The steps of selecting cache data to be detected based on the initial cache data and effectively judging the cache data to be detected based on the expiration time to obtain the judgment result include: Obtain the preset sampling period, preset sampling ratio, and current time, and obtain the target access time based on the initial cache data; According to the preset sampling period and the preset sampling ratio, cache data to be detected is selected from the initial cache data; The expiration time interval is determined based on the current time and the target access time; The cached data to be detected is effectively judged based on the expiration time interval and the expiration time to obtain the judgment result.

2. The method as described in claim 1, characterized in that, The step of effectively judging the cached data to be detected based on the expiration time interval and the expiration time to obtain the judgment result includes: Obtain a valid time window, and determine the expiration time window based on the expiration time interval and the expiration time; The expired time window is compared with the valid time window to obtain the time comparison result; When the time comparison result shows that the expiration time window is greater than the valid time window, the judgment result is confirmed to be that the cached data to be detected is invalid. When the time comparison result shows that the expiration time window is less than or equal to the valid time window, the judgment result is confirmed to be that the cached data to be detected is valid.

3. The method as described in claim 1, characterized in that, After the step of deleting expired data and updating the expiration time in the cached data to be detected based on the judgment result, and completing the cache data optimization, the method further includes: Detect whether sudden traffic events occur in cache access requests; When the burst traffic event is detected in a cache access request, obtain the historical standard deviation and the duration of the burst traffic event; The extension period is determined based on the duration of the emergency and the historical standard deviation. The extended buffer time is determined based on the extended period and the historical standard deviation; Update the cache data configuration of the cache access request according to the extended buffer time.

4. The method as described in claim 3, characterized in that, The steps for detecting whether a sudden traffic event has occurred in the cache access request include: Obtain historical averages, historical standard deviations, and burst traffic thresholds, and retrieve current access traffic data based on cached access requests; The burst traffic value is determined based on the current access traffic data, the historical mean, and the historical standard deviation. When the burst traffic value is greater than the burst traffic threshold, it is determined that the burst traffic event has occurred in the cache access request.

5. The method as described in claim 1, characterized in that, The steps to obtain business information include: Obtain initial log data, initial API call records, preset statistical periods, preset timestamps, and the current business scenario; Abnormal log data is determined based on the initial log data and the abnormal peak threshold, and the abnormal log data is deleted from the initial log data to obtain standard log data. Align the standard log data and the initial interface call record according to the preset timestamp to obtain the target log data and the target interface call record; The access volume data and data hit rate are calculated according to the preset statistical period; Based on the current business scenario, determine the business statistics period, and identify the business pattern based on the access volume data and the business statistics period; Business information is determined based on the target log data, the target interface call records, the data hit rate, and the business model.

6. A cached data optimization device based on business information, characterized in that, The device includes: The data acquisition module is used to acquire business information and initial cached data. The business information includes peak business hours, off-peak business hours, and data usage frequency. A time determination module is used to determine the expiration time of the initial cached data based on the business information. The effective judgment module is used to select cache data to be detected based on the initial cache data, and to make an effective judgment on the cache data to be detected based on the expiration time, so as to obtain a judgment result; The data optimization module is used to delete expired data and update the expiration time in the cached data to be detected based on the judgment result, thereby completing the cached data optimization. The time determination module is further configured to obtain a preset dynamic buffer coefficient mapping rule, a service end time, and a preset calculation period; and to obtain access volume data and cache hit rate based on the service information and the preset calculation period; calculate the historical standard deviation and historical mean of the access volume data based on the access volume data; calculate the fluctuation coefficient based on the historical standard deviation and the historical mean; determine the buffer coefficient based on the fluctuation coefficient and the preset dynamic buffer coefficient mapping rule; and determine the expiration time of the initial cached data based on the service end time, the buffer coefficient, and the determined historical standard deviation. The effective judgment module is further configured to obtain a preset sampling period, a preset sampling ratio, and the current time, and obtain the target access time based on the initial cache data; select cache data to be detected from the initial cache data based on the preset sampling period and the preset sampling ratio; determine the expiration time interval based on the current time and the target access time; and make an effective judgment on the cache data to be detected based on the expiration time interval and the expiration time to obtain a judgment result.

7. A cached data optimization device based on business information, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the business information-based cached data optimization method as described in any one of claims 1 to 5.

8. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the cache data optimization method based on business information as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for adjusting data caching time, equipment and storage medium

    CN115080618A

  • Data storage management method and device, medium and electronic equipment

    CN118732925A