Data caching method and related device

By predicting the load value of the data cache system and determining the cache duration based on the predicted value, the problem of cache avalanche in the prior art is solved, and the stability and high availability of the system are improved.

CN119691010APending Publication Date: 2025-03-25MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411578531.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

During the peak business period or system emergency, it is difficult to effectively manage data cache, which can easily lead to cache avalanches and affect system stability and high availability.

Method used

By obtaining the load parameters of the data cache system, predicting the load value at a future moment, and determining the cache duration of the data based on the predicted load value, thereby avoiding cache avalanches under high load states.

Benefits of technology

Improve the accuracy and rationality of the cache duration, avoid the occurrence of cache avalanches, and ensure the stability and high availability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119691010A_ABST
    Figure CN119691010A_ABST
Patent Text Reader

Abstract

The invention provides a data caching method and a related device. The method comprises the following steps: acquiring a load parameter of the data caching system at a first moment; determining a predicted load value of the data caching system at a second moment based on the load parameter; the second moment is later than the first moment; on the basis of the predicted load value, predicting the caching duration of the first data; in the first time period, the first data are cached, the starting moment of the first time period is the second moment, and the duration of the first time period is the caching duration. By means of the data caching method and device, the first data can be effectively cached according to the determined caching duration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data caching method and related devices. Background Art

[0002] Data is the foundation of the observable platform. Data is collected through different plug-ins and tools, and then the data required by the platform is obtained through data cleaning, conversion, and real-time calculation. In order to better understand and use this data, data visualization has become an indispensable tool. In the actual application process, different businesses in different departments are configured with their own visualization pages. A platform carries dozens, hundreds, or thousands of visualization pages, and each page is subdivided into different modules. During business peaks or system emergencies, these pages are used very frequently. Some pages involve large-scale data queries across days, weeks, and months, and some pages require quasi-real-time data effects. A large number of queries have brought great challenges to the bandwidth, number of connections, and performance bottlenecks of the data storage layer.

[0003] In related technologies, most observability platforms use redis, zk, Memcached, Tair, etc. as components for caching data. They use distributed caching tools to store data and set a uniform expiration time for the data in the cache space. When a query hits the cache, the data is obtained from the cache. If the data does not exist in the cache space, the data is obtained from the database. In this way, cached data can reduce requests to the database and achieve high availability of the visual dashboard. Summary of the invention

[0004] The embodiments of the present application provide a data caching method and related devices, which can effectively cache first data according to a determined cache duration.

[0005] The technical solution of the embodiment of the present application is implemented as follows:

[0006] An embodiment of the present application provides a data caching method, which includes: obtaining a load parameter of a data caching system at a first moment; based on the load parameter, determining a predicted load value of the data caching system at a second moment; the second moment is later than the first moment; based on the predicted load value, predicting a cache duration of first data; within a first time period, caching the first data, the start time of the first time period is the second moment, and the duration of the first time period is the cache duration.

[0007] An embodiment of the present application provides a data caching device, including: an acquisition module, used to acquire a load parameter of a data caching system at a first moment; a load value determination module, used to determine a predicted load value of the data caching system at a second moment based on the load parameter; the second moment is later than the first moment; a cache duration determination module, used to predict a cache duration of first data based on the predicted load value; a cache module, used to cache the first data within a first time period, the start time of the first time period being the second moment, and the duration of the first time period being the cache duration.

[0008] An embodiment of the present application provides an electronic device, comprising: a memory for storing computer executable instructions; and a processor for implementing the data caching method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.

[0009] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for implementing the data caching method provided in the embodiment of the present application when executed by a processor.

[0010] An embodiment of the present application provides a computer program product, which includes executable instructions, and the executable instructions are stored in a computer-readable storage medium; wherein, when a processor of an electronic device reads the executable instructions from the computer-readable storage medium and executes the executable instructions, the data caching method provided in the embodiment of the present application is implemented.

[0011] The embodiments of the present application have the following beneficial effects:

[0012] First, based on the load parameters of the data cache system at the first moment, the predicted load value of the data cache system at the second moment is determined, that is, by analyzing the load parameters at the historical moment (that is, the first moment), the predicted load value at the second moment is accurately predicted; then, the cache duration of the first data is determined based on the predicted load value. In this way, since the cache duration of the first data is determined based on the accurate predicted load value at the second moment, that is, the cache duration is the cache duration corresponding to the accurate predicted load value at the second moment, the method of determining the cache duration can improve the accuracy and rationality of the determined cache duration, and when the first data is cached according to the cache duration, the occurrence of cache avalanche can be avoided, ensuring the stability and high availability of the system, thereby achieving effective caching of the first data. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 It is a structural diagram of a data cache system provided in an embodiment of the present application;

[0014] Figure 2This is an optional flowchart of the data caching method provided in the embodiment of the present application;

[0015] Figure 3 is another optional flow chart of the data caching method provided in the embodiment of the present application;

[0016] Figure 4 It is a flowchart of an improved method for the visual data caching mechanism of the observable platform provided in an embodiment of the present application;

[0017] Figure 5 is a schematic diagram of the system architecture of the data cache system provided in an embodiment of the present application;

[0018] Figure 6 is a distribution diagram of the predicted load value provided in the embodiment of the present application;

[0019] Figure 7 It is a schematic diagram of the effect of setting the cache duration of the data interface provided in an embodiment of the present application;

[0020] Figure 8 is a schematic diagram of the structure of a data cache device provided in an embodiment of the present application;

[0021] Fig. 9 It is a schematic diagram of the composition structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0023] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0024] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0025] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.

[0026] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0027] 1) Auto-Regressive Moving Average Model (ARMA): It is a basic model in time series analysis and is a common model used to estimate stable irregular fluctuations or seasonal changes in time series. It is a combination of the Auto-Regressive Model (AR) and the Moving Average Model (MA), and has the characteristics of wide application range and small prediction error. The ARMA model can be used to predict financial time series data such as transaction data and exchange rates, predict product sales trends, and analyze weather data.

[0028] 2) Observability platform: Based on all types of monitoring data such as indicators, links, logs, and events, combined with powerful visualization and alarm capabilities, it provides users with an integrated monitoring solution. It meets users' demands for unified monitoring of the entire link and end-to-end, improves the efficiency of operation and maintenance troubleshooting, and safeguards the health and stability of the business.

[0029] 3) Data visualization: refers to the process of presenting data to users in an easy-to-understand and intuitive way through graphical means. Data visualization displays relatively obscure data in a visual and interactive way, thereby vividly and intuitively expressing the information and rules contained in the data. There are many application scenarios for data visualization. Among them, the data visualization large screen is the most widely used scenario in the current field, with the characteristics of cool effects, atmospheric appearance, and comprehensive information display. The mainstream data visualization software includes Echarts, Tableau and the new generation of data visualization software SovitChart.

[0030] In the related technology, when caching data, the expiration time of the data in the cache space will be uniformly set at the second, minute, and hour level. Different expiration times are also set according to the frequency of data changes: for data that does not change much such as by day, week, month, etc., a longer cache time is set; if the data in the past few seconds or minutes is queried, the data change may be more frequent, so the cache time is set to be smaller. Different expiration times are also set according to the importance of the data: according to the importance of the data or the user's high requirements for the real-time nature of the data, a shorter expiration time is set, and a longer expiration time is set for unimportant data.

[0031] However, during business peaks or system emergencies, there are high requirements for real-time data, and it is necessary to pay real-time attention to changes in the core indicators of the system, which cannot be met by relevant technologies. In addition, setting the expiration time uniformly is prone to cache avalanche, that is, a large amount of cached data expires or becomes invalid in the same time period, resulting in a large number of requests being unable to obtain data from the cache space, causing a large number of requests to reach the database, which may cause the database server to overload or even crash, thereby causing the entire data cache system to crash. In addition, it is difficult to set the expiration time uniformly, and a short expiration time is prone to avalanche. If the expiration time is too long, it will make the data in the cache space more difficult to manage, and the definition of the cache time is also more time-consuming.

[0032] Based on at least one problem existing in the related art, the embodiment of the present application introduces a load prediction model in the platform visualization module. By comprehensively considering unstable factors such as system core indicators and system emergencies, the time distribution of the data cache system in high load and low load states is evaluated. According to the predicted load value obtained by the load prediction model, the load state of the data cache system is determined, and according to different load states and time distributions, different cache durations are set for each data interface in the data cache system, effectively avoiding cache avalanche, thereby achieving effective caching of data.

[0033] See also Figure 1 , Figure 1 It is a structural diagram of the data caching system 100 architecture provided in an embodiment of the present application. To support a data caching application, the terminal 400 is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0034] The terminal 400 is used to send a data cache request to the server 200, and the server 200 is used to respond to the data cache request for the first data, obtain the load parameter of the data cache system at the first moment; then, based on the load parameter, determine the predicted load value of the data cache system at the second moment; then, based on the predicted load value, predict the cache duration of the first data; finally, cache the first data within the first time period, the start time of the first time period is the second moment, and the duration of the first time period is the cache duration. After the cache is completed, the server 200 can also send the first data to the terminal 400 to output the first data at the terminal 400.

[0035] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a car terminal, etc., but is not limited thereto. The terminal 400 and the server 200 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0036] The data caching method provided in each embodiment of the present application can be executed by an electronic device, wherein the electronic device can be a server or a terminal, that is, the data caching method provided in each embodiment of the present application can be executed by a server, can be executed by a terminal, or can be executed through interaction between a server and a terminal.

[0037] See also Figure 2 , Figure 2 is an optional flow chart of the data caching method provided in the embodiment of the present application, which will be combined with Figure 2 The steps shown are described in detail, and the execution subject of the data caching method is taken as an example to be described as a server. The method includes the following steps S101 to S104:

[0038] Step S101, obtaining a load parameter of a data cache system at a first moment.

[0039] In the embodiments of the present application, the data cache system refers to any system that can be used to process user requests and needs to cache data. For example, the data cache system can be a server system (such as a Web server, a database server, etc.), a network system, an application system, and an operating system. The load parameter refers to a parameter that can be used to characterize the load state of the data cache system. For example, the load parameter can be the number of requests processed per second (Query Per Second, QPS), CPU usage, disk usage, and memory usage.

[0040] Here, in response to the request sent by the user, the cache will first be checked to see if there is the requested data. If there is data in the cache space (cache hit), the data in the cache space is directly returned, saving the processing time of the back-end server. If there is no data in the cache space (cache miss), the request will be forwarded to the back-end server. The back-end server processes the request and returns the data, and at the same time caches the data (i.e., the first data) in the cache space so that subsequent requests can be directly obtained from the cache space. However, when caching the data in the cache space, it is necessary to set a reasonable cache duration for the first data to avoid the occurrence of cache avalanche. Therefore, it is necessary to first obtain the load parameters of the data cache system at the first moment, so that the load state of the data cache system can be accurately determined through the load parameters later, and then a reasonable cache duration is set for the first data based on the load state.

[0041] Step S102: determining a predicted load value of the data cache system at a second moment based on the load parameter.

[0042] In the embodiment of the present application, the second moment is later than the first moment, and the predicted load value refers to the load value of the data cache system obtained by prediction, and the predicted load value can be in the numerical range of 0 to 100. Based on the load parameters of the data cache system at the first moment, the predicted load value of the data cache system at the second moment is determined, that is, the predicted load value of the data cache system at the current moment is predicted by the load parameters of the historical moments. For example, based on the load parameters collected in the previous five minutes or ten minutes, the predicted load value of the data cache system at the current moment is predicted.

[0043] In some embodiments, the prediction method of the predicted load value may be: analyzing the collected load parameters through statistical methods (such as time series analysis, historical data analysis, etc.) to determine the predicted load value of the data cache system. The prediction method of the predicted load value may also be to select a suitable load prediction model, and use the load parameters of historical moments to train the selected load prediction model, and adjust the parameters of the model to achieve the best prediction effect, thereby obtaining a trained load prediction model. For example, the load prediction model may be an autoregressive moving average model, an autoregressive integral moving average model, or other models in the time series model that can process time series data. Afterwards, use the second load prediction model, input the load parameters before the second moment (i.e., at the first moment), and predict the predicted load value of the data cache system at the second moment.

[0044] Here, through the process of determining the predicted load value, the cache duration of the first data can be accurately determined based on the predicted load value, thereby achieving effective cache of the first data.

[0045] Step S103: determining a cache duration of the first data based on the predicted load value.

[0046] In the embodiment of the present application, the cache duration of the first data refers to the data validity period of caching the first data in the cache space of the data cache system. During the cache duration, the first data is in a valid state; outside the cache duration, the first data is in an invalid state.

[0047] After determining the predicted load value, the load state of the data cache system can be determined by comparing the predicted load value with the preset load threshold; when the predicted load value is greater than or equal to the preset load threshold, the data cache system is in a high load state; when the predicted load value is less than the preset load threshold, the data cache system is in a low load state. Different cache durations need to be set for different load states of the data cache system to avoid cache avalanches and ensure the stability and high availability of the system. For the process of determining the cache duration of the first data, please refer to steps S206 and S207 below.

[0048] Step S104: caching the first data within the first time period.

[0049] In the embodiment of the present application, the starting time of the first time period is the second time period, and the duration of the first time period is the cache duration. That is, after determining the cache duration of the first data, the cache duration is set for the first data, and the second time period is used as the cache start time. Through the data interface for caching the first data in the data cache system, the first data is cached within the first time period, and the first data is cached in the cache space according to the cache duration, so as to quickly respond to user requests and reduce the access pressure on the back-end database. In addition, for the data interface whose cached data has attributes that change over time, the first data can also be processed using asynchronous incremental loading, that is, each update will not immediately replace the entire cache, but only update the data that has changed since the last update before the current moment, which greatly reduces the frequent access to the database and reduces the overall load of the system.

[0050] The data caching method provided in the embodiment of the present application first determines the predicted load value of the data caching system at the second moment based on the load parameters of the data caching system at the first moment, that is, by analyzing the load parameters at the historical moment (that is, the first moment), accurately predicting the predicted load value at the second moment; then, determining the cache duration of the first data based on the predicted load value. In this way, since the cache duration of the first data is determined based on the accurate predicted load value at the second moment, that is, the cache duration is the cache duration corresponding to the accurate predicted load value at the second moment, the method of determining the cache duration can improve the accuracy and rationality of the determined cache duration, and when caching the first data according to the cache duration, it can avoid the occurrence of cache avalanche, ensure the stability and high availability of the system, and thus achieve effective caching of the first data.

[0051] The following will explain the data caching method in the embodiment of the present application in conjunction with the interaction process between the server and the terminal in the data caching system. It should be noted that the data caching method here is a data caching method implemented by the interaction between the server and the terminal, which is substantially the same as the data caching method executed by the server in the above embodiment. The only difference is that the embodiment of the present application also describes the actions performed by the terminal during the execution of the data caching method, and some steps can be executed by both the terminal and the server. Therefore, for the steps in this embodiment that are the same as those in the above embodiment but have different execution subjects, this embodiment is only an exemplary description. In the process of implementation, it can be executed by any execution subject, and the embodiment of the present application does not limit this.

[0052] See also Figure 3 , Figure 3 is another optional flow chart of the data caching method provided in the embodiment of the present application, such as Figure 3 As shown, the method includes the following steps S201 to S210:

[0053] Step S201: The terminal receives a data cache operation input by a user.

[0054] In the embodiment of the present application, the data caching operation may be any operation input by the user through the client of the data caching system, for example, the user browses product details on an e-commerce website, checks order status, or checks dynamic information on social media, etc. The user may input the data caching operation on the client of the data caching system, and in the data caching system, a data caching function may be provided, and the user may input the data caching operation on the data caching function page.

[0055] In some embodiments, when inputting a data cache operation, the load parameters of the data cache system at the first moment may be input simultaneously, and the load parameters of the data cache system at the first moment and the preset time period of the data cache system under the first load state may also be input simultaneously.

[0056] Step S202: The terminal generates a data cache request in response to the data cache operation.

[0057] In an embodiment of the present application, the data input by the user may be encapsulated into a data cache request. For example, the load parameter of the data cache system at the first moment input by the user may be encapsulated into the data cache request, and the load parameter of the data cache system at the first moment input by the user and the preset time period of the data cache system under the first load state may also be encapsulated into the data cache request together.

[0058] Step S203: The terminal sends a data cache request to the server.

[0059] Step S204: the server obtains the load parameter of the data cache system at the first moment in response to the data cache request.

[0060] In the embodiment of the present application, when the data cache request encapsulates the load parameters of the data cache system at the first moment, the data cache request is parsed to directly parse and obtain the load parameters of the data cache system at the first moment. For the specific meaning and specific implementation method involved in the step of obtaining the load parameters of the data cache system at the first moment, please refer to the description of step S101 above, which will not be repeated here.

[0061] Step S205: The server maps the load parameters through the second load prediction model to obtain a predicted load value.

[0062] In the embodiment of the present application, the second load prediction model refers to the one obtained by training the first load prediction model with sample data, and the first load prediction model refers to the initial load prediction model without model training. The second load prediction model has a system load prediction function, and can accurately predict the predicted load value of the data cache system at the second moment based on the load parameters of the data cache system at the first moment. The second moment is later than the first moment, that is, the second load prediction model can be used to predict time series data, and by analyzing the relationship between the load parameters of historical time points, the predicted load value at future time points can be predicted. The first load prediction model and the second load prediction model can be an autoregressive moving average model, a long short-term memory network model, a Transformer model, etc. There is no specific limitation on the model structure of the first load prediction model and the second load prediction model.

[0063] The predicted load value refers to the numerical value corresponding to the system load of the data cache system predicted by the second load prediction model, and the predicted load value can be used to determine the load state of the data cache system at the second moment. After the model training is completed, the load parameters collected in real time at the first moment are input into the second load prediction model, and the second load prediction model outputs the predicted load value based on the input load parameters and the mapping relationship learned during training.

[0064] Here, the second load prediction model can be used to accurately predict the predicted load value, so that the load state of the data cache system at the second moment can be accurately determined based on the predicted load value, thereby accurately determining the cache duration of the first data.

[0065] Step S206: When the predicted load value is in the first load interval, the server predicts the cache duration of the first data based on a preset time period, a preset constant and a preset weight of the data cache system under the first load state.

[0066] In the embodiment of the present application, the load interval in which the predicted load value is located includes a first load interval and a second load interval, and the first load interval and the second load interval are divided into load intervals based on a preset load threshold, and the load value of the first load interval is greater than or equal to the preset load threshold, and the second load interval is less than the preset load threshold, that is, the load value of the first load interval is greater than the load value of the second load interval. For example, assuming that the preset load threshold is equal to 60 and the predicted load value is 75, the predicted load value is in the first load interval; and when the predicted load value is 40, the predicted load value is in the second load interval.

[0067] Corresponding to the first load interval and the second load interval, the load state of the data cache system includes a first load state and a second load state, the first load state is the load state corresponding to the first load interval, and the second load state is the load state corresponding to the second load interval. The load state of the system refers to the workload or busyness of processing tasks during the operation of the data cache system. The load state usually reflects the usage of load parameters (such as CPU, memory, disk IO, network bandwidth, etc.), and is an important indicator for measuring the system performance and health status of the data cache system. When the data cache system is in the first load state, the data cache system needs to use a large amount of CPU, memory, disk IO or network resources to process a large number of tasks or requests. Due to the large amount of resources occupied, the response time and processing speed of the data cache system may be slowed down, and being in the first load state for a long time may increase the risk of system overheating, hardware failure or system crash. Therefore, when the data cache system is in the first load state, it is necessary to reasonably set the cache time when the data cache system caches the first data in the first load state to prevent a large number of tasks or requests from directly reaching the database, so as to ensure the stability and system performance of the data cache system.

[0068] In some embodiments, the preset time period refers to the time interval occupied by the data cache system in the first load state, for example, the preset time period may be from 9:00 to 11:30. Before determining the cache duration of the first data based on the preset time period, preset constant, and preset weight of the data cache system in the first load state, the preset time period of the data cache system in the first load state may be determined in the following manner: when training the first load prediction model, determining the preset time period of the data cache system in the first load state.

[0069] That is to say, before determining the predicted load value of the data cache system at the second moment based on the load parameter, the preset time period can be determined based on the model training result during the model training process of the load prediction model, which can be specifically implemented by the following steps: first, obtain the first sample sequence; then, determine the third load interval based on the first sample sequence; finally, determine the preset time period based on the timestamp corresponding to the sample predicted load value in the third load interval. Among them, the first sample sequence is a model output sequence generated during the model training process of the first load prediction model, and the first sample sequence includes N sample predicted load values, where N is an integer greater than 1. The sample predicted load value in the first sample sequence is a predicted load value obtained after mapping the sample data by the first load prediction model. In addition, each sample predicted load value in the first sample sequence corresponds to a timestamp, which refers to the specific moment corresponding to each sample predicted load value. The third load interval is a load interval composed of continuous sample predicted load values ​​greater than the preset load threshold, that is, a load interval composed of M continuous predicted load values ​​greater than the preset load threshold in the first sample sequence is determined as the third load interval, and the third load interval corresponds to the first load state. M is an integer greater than 1, and M is less than N. Finally, the timestamp corresponding to the last sample predicted load value in the third load interval is subtracted from the timestamp corresponding to the first sample predicted load value to obtain a preset time period of the data cache system in the first load state.

[0070] Here, by determining a preset time period of the data cache system under the first load state, the cache duration of the first data under the first load state can be accurately determined based on the preset time period, thereby achieving effective caching of the first data.

[0071] In some embodiments, the second load prediction model can be trained through the following steps: obtaining sample data; the sample data includes sample load parameters of the data cache system in a third time period and a sample true load value of the data cache system in a fourth time period; the fourth time period is later than the third time period; inputting the sample load parameters into the first load prediction model; mapping the sample load parameters through the first load prediction model to obtain the sample predicted load value of the data cache system in the fourth time period; performing loss calculation based on the sample predicted load value and the sample true load value to obtain a loss result; updating the model parameters in the first load prediction model based on the loss result to obtain a trained second load prediction model.

[0072] That is to say, the sample load parameter at the first moment in the third time period is input into the first load prediction model to obtain the sample predicted load value at the first moment in the fourth time period. The sample predicted load value is compared with the sample true load value, and the loss function is calculated to obtain the loss result. Based on the loss result, the weight and bias of the first load prediction model are updated using the gradient descent algorithm. Next, the sample load parameter at the second moment in the third time period is input into the first load prediction model to obtain the sample predicted load value at the second moment in the fourth time period. The sample predicted load value is compared with the sample true load value, and the loss function is calculated to obtain the loss result. Based on the loss result, the weight and bias of the first load prediction model are updated using the gradient descent algorithm. By analogy, the above operations are repeated until the predetermined number of training times is reached or the loss function converges, the model training of the first load prediction model is stopped, and the sample predicted load values ​​are arranged in chronological order to obtain the first sample sequence.

[0073] In some embodiments, the determination of the preset constant can be achieved by the following steps: determining the type of the first data interface in the data cache system; when the type of the first data interface is the first type, determining the preset constant to be a first value; when the type of the first data interface is the second type, determining the preset constant to be a second value.

[0074] The first data interface is a data interface for caching the first data into the cache space. The first data is cached into the cache space through the first data interface so that the first data can be quickly read from the cache space through the first data interface later. According to the different types of the first data interface in the data cache system, the preset constants are also different. Among them, the types of the first data interface include the first type and the second type. The first type is used to characterize that the data cached by the first data interface has the property of changing with time, and the second type is used to characterize that the data cached by the first data interface has the property of not changing with time. In the case where the type of the first data interface is the first type, it means that the data cached by the first data interface at the current moment depends on the time factor, that is, the data needs to be updated after a certain period of time. At this time, the preset constant needs to be set to the first value corresponding to the first type. For example, the data can be a stock price, and the stock price will change in real time with market fluctuations, and the data needs to be updated after a certain period of time. In the case where the type of the first data interface is the second type, it means that the data cached by the first data interface at the current moment has the property of not changing with time, that is, the data does not need to be updated. At this time, the preset constant needs to be set to the second value corresponding to the second type. For example, the data may be static configuration information such as application setting parameters and product information, which usually does not change after deployment and does not require data update. In addition, the first value is smaller than the second value, that is, the preset constant when the type of the first data interface is the first type is smaller than the preset constant when the type of the first data interface is the first type. For example, the preset constant when the type of the first data interface is the first type may be a value of 5, and the preset constant when the type of the first data interface is the second type may be a value of 50.

[0075] Here, the preset constant is dynamically adjusted according to whether the data cached by the first data interface has a property that changes with time, so that when the cache period of the first data is subsequently determined based on the preset constant, the factor of whether the data cached by the first data interface has a property that changes with time is taken into account, thereby improving the rationality of the cache period setting of the first data, thereby effectively avoiding the problem of cache avalanche.

[0076] In an embodiment of the present application, determining the cache duration of the first data based on a preset time period, preset constants and preset weights of the data cache system under a first load state can be achieved in the following manner: first, determining an adjustment parameter for adjusting the cache duration based on the preset constants, preset weights and the interface access volume of the first data interface within a second time period; then, determining the first duration of the data cache system under the first load state based on the preset time period; finally, predicting the cache duration of the first data based on the first duration, the preset constants, the preset weights, the interface access volume and the adjustment parameters.

[0077] The preset weight refers to the pre-set weight coefficient of each data interface in the data cache system. The weight coefficient is a constant between 0 and 1, which can be used to measure the importance of the data interface. Usually, for data interfaces that only query historical data, the preset weight is between 0 and 0.5; for data interfaces related to current time changes (that is, the data cached by the data interface has the property of changing over time), the preset weight is between 0.5 and 1, that is, the preset weight can be adjusted according to actual conditions. The larger the value corresponding to the preset weight, the shorter the cache duration will be.

[0078] The interface access volume of the data interface in the second time period refers to the total number of times that external systems or users request data through the data interface within a certain time range. The interface access volume can be used to measure the important parameters of the frequency of use of the data interface and the popularity of the data service. The second time period can be divided into minutes, hours, and days. For example, the interface access volume can be the interface access volume of one day. The interface access volume of the data interface can be counted through methods such as log analysis and data indexing, which are not specifically limited here. The greater the interface access volume of the data interface in the second time period, the shorter the cache time will be.

[0079] The adjustment parameter refers to an adjustable factor in the cache duration calculation process. The adjustment parameter is used to adjust the cache duration by adjusting the adjustment parameter when the cache duration increment composed of the preset constant, the preset weight and the interface access volume of the data interface in the second period is less than the preset increment threshold (for example, 1 second), so that the cache duration is reasonably allocated. When the cache duration increment is greater than the preset increment threshold, there is no need to adjust the adjustment parameter, and the adjustment parameter is equal to the cache duration increment.

[0080] The adjustment process of the adjustment parameter can be that when the cache duration increment is less than the preset increment threshold, the adjustment parameter is set as an update parameter based on the value of the cache duration increment, so that the adjustment parameter is equal to the product of the cache duration increment and the nth power of the update parameter, where n is an integer greater than or equal to 1. That is, firstly, the cache duration increment is multiplied by the first power of the update parameter to obtain the first multiplication result, and it is determined whether the first multiplication result is greater than the preset increment threshold. If the first multiplication result is greater than the preset increment threshold, the adjustment parameter is equal to the first multiplication result; if the first multiplication result is less than the preset increment threshold, the first multiplication result is multiplied by the second power of the update parameter to obtain the second multiplication result, and it is determined whether the second multiplication result is greater than the preset increment threshold, and so on, until the nth multiplication result is greater than the preset increment threshold, then the nth multiplication result is determined as the adjustment parameter. Here, the rationality of the cache duration setting is improved through the adjustment process of the adjustment parameter.

[0081] After determining the preset time period of the data cache system under the first load state, determine the first duration of the data cache system under the first load state according to the preset time period. For example, assuming that the preset time period is from 9:00 to 10:30, the first duration is one and a half hours. Finally, after determining the first duration, the preset constant, the preset weight, the interface access volume and the adjustment parameter, based on the first duration, add the cache duration increment consisting of the preset constant, the preset weight and the interface access volume of the data interface in the second time period, and the adjustment parameter obtained by adjusting the cache duration increment, and finally obtain the cache duration of the first data.

[0082] The cache duration here is the cache duration of the data cache system under the first load state. The first duration of the data cache system under the first load state is used as the cache duration benchmark. Different cache durations are set in combination with the preset weight and interface access volume of each first data interface, and whether the data cached by the data interface has properties that change over time. This greatly improves the rationality of the cache duration setting, thereby effectively avoiding the occurrence of cache avalanche, so that the data cache system can subsequently achieve effective caching of the first data under the first load state.

[0083] Step S207: When the predicted load value is in the second load interval, the server predicts the cache duration of the first data based on a preset constant and a preset weight.

[0084] In the embodiment of the present application, the load value of the first load interval is greater than the load value of the second load interval. When the predicted load value is in the second load interval, it means that the data cache system is in the second load state, and the second load state is the load state corresponding to the second load interval. When the data cache system is in the second load state, the utilization rate of system resources such as CPU, memory, disk IO and network bandwidth is low, indicating that the system is not executing a large number of tasks or requests, system resources are not over-occupied, and the response time and processing speed of the system are generally fast.

[0085] In some embodiments, based on the preset constant and the preset weight, determining the cache duration of the first data can be achieved in the following manner: determining the adjustment parameter for adjusting the cache duration based on the preset constant, the preset weight and the interface access volume of the data interface in the second time period; determining the cache duration of the first data based on the preset constant, the preset weight, the interface access volume and the adjustment parameter. That is, when the predicted load value is in the second load interval, the determination process and the adjustment process of the adjustment parameter are consistent with the above step S206, and for the determination of the cache duration of the first data, since the second load interval is usually much larger than the first load interval, the duration of the corresponding data cache system under the second load state is much larger than the first duration of the data cache system under the first load state. Therefore, when setting the cache duration of the first data, if the duration of the data cache system under the second load state is used as the cache duration benchmark, the cache duration of the first data will be too long. If the data in the cache space is not updated for a long time, it may become outdated. This means that when users request the data, they may get inaccurate or outdated information, resulting in inconsistent data. Cache data for a long time will occupy more storage resources, which may lead to insufficient cache space and affect cache performance. And if there is too much data in the cache space, it may cause the cache hit rate to decrease, increase the cache miss situation, thereby increasing the access pressure on the backend database and affecting the overall performance of the system. Therefore, when the predicted load value is in the second load interval, the duration of the data cache system in the second load state is ignored, and the cache duration benchmark is determined according to whether the data cached by the first data interface has a property that changes over time, and the cache duration increment composed of the preset constant, the preset weight and the interface access volume of the first data interface in the second time period is increased, and the adjustment parameter obtained based on the cache duration increment adjustment is finally obtained to obtain the cache duration of the first data.

[0086] The cache duration here is the cache duration of the data cache system under the second load state. Different cache durations are set according to the preset weight and interface access volume of each first data interface of the data cache system under the second load state, and whether the data cached by the first data interface has the property of changing over time. This greatly improves the rationality of the cache duration setting, thereby effectively avoiding the occurrence of cache avalanche, so as to subsequently realize the effective caching of the first data by the data cache system under the second load state.

[0087] Step S208: the server caches the first data within the first time period.

[0088] In the embodiment of the present application, for the specific meaning and implementation of the step of caching the first data within the first time period, please refer to the description of step S104 above, and the description will not be repeated here.

[0089] Step S209: the server sends first data to the terminal.

[0090] Step S210: the terminal outputs first data.

[0091] In the embodiment of the present application, based on the load parameters of the data cache system at the first moment, the predicted load value of the data cache system at the second moment is accurately determined by the second load prediction model. Moreover, when the predicted load value is in the first load interval, the first duration of the data cache system under the first load state is used as the cache duration benchmark, and different cache durations are set in combination with the preset weight and interface access volume of each first data interface, and whether the data cached by the first data interface has the property of changing over time; and when the predicted load value is in the second load interval, the duration of the data cache system under the second load state is ignored, and the preset weight and interface access volume of each first data interface of the data cache system under the second load state, and whether the data cached by the first data interface has the property of changing over time are used to set different cache durations. In this way, when determining the load state of the data cache system, by comprehensively considering a variety of load influencing factors, the rationality of the cache duration setting is greatly improved, thereby effectively avoiding the occurrence of cache avalanche, so as to realize the effective caching of the first data by the data cache system in the future.

[0092] The data caching method provided in the embodiment of the present application can be applied to a variety of scenarios, for example, electronic e-commerce scenarios, financial transaction scenarios, social media platform scenarios, game development scenarios, etc. For example, when the data caching method is applied to the order processing process in the e-commerce scenario, during large-scale promotional activities during various festivals, there will usually be a shopping peak. At this time, the data caching system is in a business peak period (i.e., the first load state mentioned above). For other periods, the data caching system is usually in a business off-peak period. Before performing system load prediction, it is first necessary to train the first load prediction model by collecting a large number of load parameters so that the trained second load prediction model can accurately predict the predicted load value. And, based on the model training results, determine the peak duration of the order processing system during the business peak period. When a purchase request sent by a user is received, the request data is first obtained from the cache space. If the request data exists, the cache data is returned. If there is no request data in the cache space, it is loaded from the database. At the same time, based on the predicted load value at the current moment, determine whether the order processing system at the current moment is in a business peak period, and take into account factors such as whether the data cached by the data interface used to cache the request data has attributes that change over time, interface access volume, interface weight coefficient, etc., and calculate different cache durations respectively. According to the cache duration, the request data is cached from the database to the cache space of the order processing system.

[0093] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0094] The present application embodiment provides an improved method for the visual data cache mechanism of an observable platform, which introduces a time series analysis model into the platform visualization module. The method flow chart is as follows: Figure 4 As shown, S501, comprehensively considers the core indicators of the system (i.e. the above-mentioned load parameters), whether the system is emergency and other unstable factors, and evaluates the time distribution of the daily business peak period and business off-peak period of the data cache system through the time series analysis model (i.e. the above-mentioned first load prediction model). During the time change process, execute step S502 to determine whether it is in the business peak period (i.e. the above-mentioned first load state). S503, when it is in the business peak period, the peak period duration (i.e. the above-mentioned first duration) is used as the cache duration benchmark, and the cache duration is set in combination with the interface weight coefficient (i.e. the above-mentioned preset weight) of each data interface (i.e. the above-mentioned first data interface), the number of interface calls per day (i.e. the above-mentioned interface access volume), and whether the data interface is affected by time changes. S504, for data interfaces affected by time changes, the incremental changes are written into the distributed cache by asynchronously updating the cache data; S505, for data interfaces not affected by time changes, the cache data is always hit. S506, after the cache fails, the data cache system enters the business off-peak period (i.e. the above-mentioned second load state). S507, when the business is in a low peak period, the cache duration is set according to the interface weight coefficient of each data interface, the number of times the interface is called per day, and whether the data interface is affected by time changes.

[0095] First, the time series analysis model introduced is the autoregressive model (AR) in ARMA, see the following formula (1) for details:

[0096] x t = θ0+ θ1q t-1 + θ2c t-1 + θ3d t-1 + ∈ t-1 (1)

[0097] Among them, x t is the predicted load value at the observation point t (i.e., the second moment mentioned above), which can be between 0 and 100; θ0, θ1, θ2, and θ3 are the weight coefficients of the AR model, q t-1 is the value of the number of queries processed per second (QPS) by the system at the previous observation point t-1 (i.e., the first moment mentioned above) before the observation point t; c t-1 is the value of the system CPU usage at the previous observation point t-1; d t-1is the value of the system disk usage at the previous observation point t-1 at observation point t; ∈ t-1 is the error factor at observation point t-1, which needs to be considered when a high load is generated in the system emergency at observation point t-1.

[0098] Secondly, if Figure 5 As shown, the data cache system includes an access layer 601, a visualization layer 602, a model calculation layer 603 and a collection storage layer 604. The access layer 601 includes a reverse proxy module 6011 and a general gateway module 6012 including an authentication plug-in 1, a gateway plug-in 2, a gateway plug-in 3 and a gateway plug-in 4; the visualization layer 602 includes a data interface management module 6021, a cache management module 6022 and an access processing module 6023; the model calculation layer 603 includes a model configuration module 6031, a model training module 6032 and a model decision module 6033; the collection storage layer 604 includes a collection module 6041 and a storage module 6042. In the process of determining the cache duration, based on the collection storage layer 604, the system core indicators (i.e., model indicators) are provided to the model configuration module 6031 in the model calculation layer 603, the model training module 6032 in the model calculation layer 603 is used to perform model training, and the system load prediction value (i.e., the inference result) is calculated in the model decision module 6033. The model training results are stored in the data set to obtain a data set based on the system core indicators, time, and predicted load values. Based on the current predicted load value and the preset high load threshold (i.e., the preset load threshold), it can be inferred whether the business peak period has arrived, and the time interval and peak duration of the business peak period can be determined. The predicted load value at the current moment can be determined through the trained AR model. For example, Figure 6 As shown, the predicted load value during the business peak period is higher than 60, while the predicted load value during the remaining time is around 20. It can be seen from the circled portion of box 601 that the data cache system is in the business peak period from 9:30 to 11:30, and the peak period lasts for two hours.

[0099] Then, according to the request of each data interface, the cache duration of the current data interface can be calculated, and the calculation method is as follows:

[0100]

[0101] Among them, c i is the cache duration of data interface i, in seconds; t i is the peak duration of data interface i inferred from the AR model; m i The cache constant (i.e., the preset constant) for each data interface is confirmed when the interface is connected to the system. It can be determined based on whether the data interface is affected by time changes. For example, if it is affected, it is set to 5 minutes, and if it is not affected, it is set to 1 hour; δ iis the weight coefficient of data interface i (i.e. the above-mentioned preset weight coefficient); q i is the number of requests to access the data interface i every day (i.e. the number of accesses to the above interface); τ i is the adjustment factor (i.e. the above adjustment parameter), which is used to adjust the cache time to prevent If the time is less than a second, press (If and only if τ i ≥1, n stops increasing). During the low-peak period of system usage, t i Equal to m i For example, when the system is in the peak period of business, the peak period lasts for 1.5 hours, then t i It is equal to 1.5*3600 seconds, and the data interface is affected by time changes, and the weight coefficient δ i is 0.5, the number of requests per day is q i If it is 1000 times, the cache duration is c i is equal to

[0102] Finally, different caching strategies can be implemented according to different cache durations during business peak and business off-peak periods.

[0103] When the observability platform receives a data request, it first obtains data from the cache space. If the data exists, the cached data is returned. If there is no data in the cache space, it is loaded from the database. At the same time, the current first data is cached according to the cache duration calculated by formula (2). In particular, when the system is at a business peak, for data interfaces affected by current time changes, asynchronous incremental loading is used to cache data.

[0104] The effect of setting the cache duration of the data interface is as follows: Figure 7 As shown, the dashed line 701 is the cache duration distribution curve. The smooth curve indicates that the cache duration distribution is relatively uniform. The shaded portion 702 is the data interface covered under the same cache duration. Among them, the cache duration of the data interface affected by time changes is distributed between 5 minutes and 10 minutes, and the cache duration of the data interface not affected by time changes is distributed between 1 hour and 2 hours.

[0105] It can be seen that the method provided by the embodiment of the present application can predict the time interval and peak duration of the system during the peak period, can optimize the cache policy configuration of the data interface, and can prevent the occurrence of cache avalanche. In addition, the higher the weight coefficient of the data interface, or the more times the interface is called every day, the shorter the cache duration, and the cache data in the cache space will be refreshed first.

[0106] The following further describes an exemplary structure of the data cache device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, for example Figure 8 As shown, the software modules in the data caching device 455 may include: an acquisition module 4551, used to acquire the load parameters of the data caching system at a first moment; a load value determination module 4552, used to determine the predicted load value of the data caching system at a second moment based on the load parameters; the second moment is later than the first moment; a cache duration determination module 4553, used to predict the cache duration of the first data based on the predicted load value; a cache module 4554, used to cache the first data within a first time period, the starting time of the first time period is the second moment, and the duration of the first time period is the cache duration.

[0107] In some embodiments, the cache duration determination module 4553 is also used to: when the predicted load value is in a first load interval, predict the cache duration of the first data based on a preset time period, a preset constant and a preset weight of the data cache system under a first load state; the first load state is a load state corresponding to the first load interval; when the predicted load value is in a second load interval, predict the cache duration of the first data based on the preset constant and the preset weight; the load value of the first load interval is greater than the load value of the second load interval.

[0108] In some embodiments, the data cache device 455 also includes a preset constant determination module, and the preset constant determination module is used to: determine the type of the first data interface in the data cache system; the first data interface is a data interface used to cache the first data to a cache space; when the type of the first data interface is the first type, determine the preset constant to be a first value; when the type of the first data interface is the second type, determine the preset constant to be a second value; wherein the first value is less than the second value; the first type is used to characterize that the data cached by the first data interface has a property that changes with time, and the second type is used to characterize that the data cached by the first data interface has a property that does not change with time.

[0109] In some embodiments, the cache duration determination module 4553 is also used to: determine an adjustment parameter for adjusting the cache duration based on the preset constant, the preset weight and the interface access volume of the first data interface in a second time period; determine a first duration of the data cache system under a first load state based on the preset time period; and predict the cache duration of the first data based on the first duration, the preset constant, the preset weight, the interface access volume and the adjustment parameter.

[0110] In some embodiments, the cache time determination module 4553 is also used to: determine an adjustment parameter for adjusting the cache time based on the preset constant, the preset weight and the interface access volume of the first data interface in the second time period; and predict the cache time of the first data based on the preset constant, the preset weight, the interface access volume and the adjustment parameter.

[0111] In some embodiments, the load value determination module 4552 is further used to: map the load parameters through a second load prediction model to obtain the predicted load value.

[0112] In some embodiments, the data cache device 455 also includes a preset time period determination module, and the preset time period determination module is used to: obtain a first sample sequence; the first sample sequence includes N sample predicted load values, and the sample predicted load value is a predicted load value obtained by mapping the sample data with a first load prediction model, and each sample predicted load value in the first sample sequence corresponds to a timestamp; wherein, a second load prediction model is obtained by training the first load prediction model using the sample data; N is an integer greater than 1; based on the first sample sequence, a third load interval is determined; the third load interval is a load interval composed of M consecutive sample predicted load values ​​greater than a preset load threshold; M is an integer greater than 1, and M is less than N; based on the timestamp corresponding to the sample predicted load value in the third load interval, the preset time period is determined.

[0113] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment, so it is not repeated. For technical details not disclosed in the embodiment of the device, please refer to the description of the method embodiment of the present application for understanding.

[0114] Correspondingly, an embodiment of the present application provides an electronic device, Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the electronic device 1200 includes at least: a processor 1201 , a communication interface 1202 , and a storage medium 1203 configured to store executable instructions, wherein: the processor 1201 generally controls the overall operation of the electronic device 1200 .

[0115] The communication interface 1202 enables the electronic device to communicate with other terminals or servers through a network.

[0116] The storage medium 1203 is configured to store instructions and applications executable by the processor 1201, and can also cache data to be processed or processed by the processor 1201 and each module in the electronic device 1200, which can be implemented through flash memory (FLASH) or random access memory (Random Access Memory, RAM).

[0117] The present application embodiment provides a computer-readable storage medium in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the data caching method provided by the present application embodiment, for example, Figure 2 The data caching method shown.

[0118] The embodiment of the present application provides a computer program product, which includes computer executable instructions, and the computer executable instructions are stored in a computer readable storage medium. The processor of the electronic device reads the computer executable instructions from the computer readable storage medium, and the processor executes the computer executable instructions, so that the electronic device executes the data caching method described in the embodiment of the present application.

[0119] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0120] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0121] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0122] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0123] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A data caching method, characterized in that: The method comprises: Obtaining the load parameters of the data cache system at the first moment; Based on the load parameter, determining a predicted load value of the data cache system at a second moment; the second moment is later than the first moment; Based on the predicted load value, predicting a cache duration of the first data; The first data is cached in a first time period, the start time of the first time period is the second time period, and the duration of the first time period is the cache duration.

2. The method according to claim 1, characterized in that The predicting, based on the predicted load value, the cache duration of the first data includes: When the predicted load value is in a first load interval, based on a preset time period, a preset constant and a preset weight of the data cache system in a first load state, predicting a cache duration of the first data; the first load state is a load state corresponding to the first load interval; When the predicted load value is in a second load interval, the cache duration of the first data is predicted based on the preset constant and the preset weight; the load value of the first load interval is greater than the load value of the second load interval.

3. The method according to claim 2, characterized in that The method further comprises: Determine the type of a first data interface in the data cache system; the first data interface is a data interface for caching the first data into a cache space; When the type of the first data interface is a first type, determining the preset constant to be a first value; When the type of the first data interface is the second type, determining the preset constant to be a second value; Among them, the first value is smaller than the second value; the first type is used to characterize that the data cached by the first data interface has a property that changes with time, and the second type is used to characterize that the data cached by the first data interface has a property that does not change with time.

4. The method according to claim 3, characterized in that: The predicting the cache duration of the first data based on a preset time period, a preset constant, and a preset weight of the data cache system under a first load state includes: Determining an adjustment parameter for adjusting the cache duration based on the preset constant, the preset weight, and the interface access volume of the first data interface in the second time period; Based on the preset time period, determining a first duration of the data cache system under the first load state; Based on the first duration, the preset constant, the preset weight, the interface access volume and the adjustment parameter, a cache duration of the first data is predicted.

5. The method according to claim 3, characterized in that: The predicting the cache duration of the first data based on the preset constant and the preset weight includes: Determining an adjustment parameter for adjusting the cache duration based on the preset constant, the preset weight, and the interface access volume of the first data interface in the second time period; Based on the preset constant, the preset weight, the interface access volume and the adjustment parameter, a cache duration of the first data is predicted.

6. The method according to claim 2, characterized in that Before determining the predicted load value of the data cache system at the second moment based on the load parameter, the method further includes: Obtain a first sample sequence; the first sample sequence includes N sample predicted load values, the sample predicted load values ​​are predicted load values ​​obtained by mapping sample data through a first load prediction model, and each sample predicted load value in the first sample sequence corresponds to a timestamp; wherein a second load prediction model is obtained by training the first load prediction model using the sample data; N is an integer greater than 1; Based on the first sample sequence, a third load interval is determined; the third load interval is a load interval consisting of M consecutive sample predicted load values ​​greater than a preset load threshold; M is an integer greater than 1, and M is less than N; Determining the preset time period based on the timestamp corresponding to the sample predicted load value in the third load interval; The determining, based on the load parameter, a predicted load value of the data cache system at a second moment includes: The load parameter is mapped through the second load prediction model to obtain the predicted load value.

7. A data cache device, characterized in that: The device comprises: An acquisition module, used to acquire a load parameter of the data cache system at a first moment; A load value determination module, configured to determine a predicted load value of the data cache system at a second moment based on the load parameter; the second moment is later than the first moment; A cache duration determination module, configured to predict a cache duration of the first data based on the predicted load value; The cache module is used to cache the first data within a first time period, the start time of the first time period is the second time period, and the duration of the first time period is the cache duration.

8. An electronic device, characterized in that: include: A memory for storing computer executable instructions; A processor, configured to implement the data caching method according to any one of claims 1 to 6 when executing the computer executable instructions stored in the memory.

9. A computer-readable storage medium, characterized in that: Computer executable instructions are stored, and when the computer executable instructions are executed by a processor, the data caching method according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The computer program product includes computer executable instructions stored in a computer readable storage medium; Wherein, when the processor of the electronic device reads the computer executable instructions from the computer readable storage medium and executes the computer executable instructions, the data caching method according to any one of claims 1 to 6 is implemented.