Data dynamic caching method and device

By dynamically adjusting data to different cache levels and using access frequency and timestamp prediction models, the problem of low query efficiency caused by changes in data popularity is solved, achieving efficient cache management and resource utilization.

CN120973829APending Publication Date: 2025-11-18BEIJING BAIJU YIXING TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202510954011.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

In existing technologies, changes in data popularity cause cold data to remain in the cache layer, resulting in low query efficiency.

Method used

By obtaining the access frequency and timestamps of the data, machine learning models are used to predict the trend of popularity changes, and the data is dynamically adjusted to the first-level cache or the second-level cache to ensure that high-frequency access data is in the first-level cache and low-frequency data is in the second-level cache. Data is filtered by combining the number of times it is used and the historical access frequency to optimize the cache capacity.

Benefits of technology

It significantly improves cache hit rate and query efficiency, reduces access latency, makes reasonable use of cache resources, and adapts to diverse application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120973829A_ABST
    Figure CN120973829A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data caching, and discloses a data dynamic caching method and device. The method comprises the following steps: acquiring an access frequency and a timestamp of first target data; according to the access frequency and the timestamp of the first target data, determining a popularity change trend of the first target data in the time period; adjusting the first target data to a target cache according to the popularity change trend; wherein the target cache is one of the first-level cache and the second-level cache, and the heat degree of the data in the first-level cache is larger than that of the data in the second-level cache.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data caching, in particular to a data dynamic caching method and device. BACKGROUND

[0002] In the related art, data is statically allocated to different levels of caches according to preset rules (such as data size, life cycle, etc.).

[0003] However, the popularity of data changes over time, and the way of statically allocating data to different levels of caches according to preset rules causes cold data to be converted to hot data in the corresponding level of cache, resulting in low query efficiency.

[0004] Therefore, how to improve the query efficiency becomes a technical problem to be solved. SUMMARY

[0005] Therefore, the present application provides a data dynamic caching method and device.

[0006] In a first aspect, the present application provides a data dynamic caching method, which comprises: obtaining an access frequency and a timestamp of first target data; determining a heat change trend of the first target data in a time period according to the access frequency and the timestamp of the first target data; and adjusting the first target data to a target cache according to the heat change trend, wherein the target cache is one of a first cache and a second cache, and the heat of data in the first cache is greater than the heat of data in the second cache.

[0007] The data dynamic caching method provided in this embodiment dynamically calculates the heat trend through the access frequency and the timestamp, timely identifies the rise or fall of the data heat, adjusts the first target data to the target cache according to the heat change trend, wherein the target cache is one of the first cache and the second cache, and the heat of data in the first cache is greater than the heat of data in the second cache, which can effectively improve the query efficiency compared with the way of statically allocating data to different levels of caches according to preset rules (such as data size, life cycle, etc.) in the related art.

[0008] In one possible implementation, adjusting the first target data to the target cache according to the heat change trend comprises: loading the first target data to the second cache when the first target data is stored in the first cache and the heat change trend of the first target data indicates that the heat of the first target data is less than a heat threshold; and loading the first target data to the first cache when the first target data is stored in the second cache and the heat change trend of the first target data indicates that the heat of the first target data is greater than the heat threshold.

[0009] The data dynamic caching method provided by the embodiment can ensure that the cache content is always highly matched with the actual access demand, and significantly improve the cache hit rate.

[0010] In a possible implementation, the trend of the heat of the target data in the time period is determined according to the access frequency and the timestamp of the target data, including: determining the trend of the heat of the first target data in the time period according to the access frequency and the timestamp of the first target data by using a heat prediction model based on machine learning.

[0011] The data dynamic caching method provided by the embodiment can improve the accuracy of determining the trend of the heat of the first target data in the time period by using the heat prediction model based on machine learning to determine the trend of the heat of the first target data in the time period.

[0012] In a possible implementation, the method further includes: when the capacity of the target cache is not less than the capacity threshold, obtaining the association information of each data in the target cache; wherein the association information includes the number of uses; and removing the data with the number of uses less than the number-of-uses threshold from the target cache.

[0013] The data dynamic caching method provided by the embodiment can ensure that the cache always serves the data with high heat by retaining only the data frequently accessed by users when the capacity of the target cache is not less than the capacity threshold, thereby improving the hit rate.

[0014] In a possible implementation, the association information further includes the historical access frequency, and the method further includes: removing the data with the historical access frequency lower than the frequency threshold from the target cache.

[0015] The data dynamic caching method provided by the embodiment can avoid deleting the data temporarily cold but long-term valuable by using the historical access frequency to reflect the long-term access mode of the data. In addition, the number of uses of some data may increase sharply due to burst traffic, but the historical frequency shows that the long-term value of the data is low. By combining the two, the cache can be adjusted less frequently due to short-term fluctuations.

[0016] In a possible implementation, the method further includes: receiving a data query request; searching, according to the data query request, the second target data corresponding to the data query request from the first-level cache; searching, when the second target data corresponding to the data query request is not found from the first-level cache, the second target data corresponding to the data query request from the second-level cache; and loading, when the second target data corresponding to the data query request is found from the second-level cache, the second target data from the second-level cache to the first-level cache.

[0017] The data dynamic caching method provided by the embodiment can maximize the hit rate by preferentially searching the first-level cache for data, loading data from the second-level cache when the first-level cache does not hit the data, and loading the data from the second-level cache to the first-level cache when the second-level cache hits the data.

[0018] In a second aspect, the present application provides a data dynamic caching device, comprising: an acquisition module configured to acquire an access frequency and a time stamp of first target data; a determination module configured to determine a heat change trend of the first target data in a time period according to the access frequency and the time stamp of the first target data; and an adjustment module configured to adjust the first target data to a target cache according to the heat change trend, wherein the target cache is one of a first-level cache and a second-level cache, and the heat of data in the first-level cache is greater than the heat of data in the second-level cache.

[0019] In a third aspect, the present application provides a computer device, comprising: a memory and a processor, which are in communication connection with each other, and the memory stores computer instructions; the processor executes the computer instructions to perform the data dynamic caching method of the first aspect or any of the corresponding embodiments thereof.

[0020] In a fourth aspect, the present application provides a computer readable storage medium, which stores computer instructions, and the computer instructions are used to make a computer execute the data dynamic caching method of the first aspect or any of the corresponding embodiments thereof.

[0021] In a fifth aspect, the present application provides a computer program product, which comprises computer instructions, and the computer instructions are used to make a computer execute the data dynamic caching method of the first aspect or any of the corresponding embodiments thereof. BRIEF DESCRIPTION OF DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the specific embodiments of the present application or the prior art, the drawings needed to be used in the specific embodiments or prior art description will be briefly introduced. Obviously, the drawings described below are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.

[0023] Figure 1 is a flowchart of a data dynamic caching method according to an embodiment of the present application;

[0024] Figure 2 is a schematic diagram of a data dynamic caching method according to an embodiment of the present application

[0025] Figure 3 is another schematic diagram of a data dynamic caching method according to an embodiment of the present application

[0026] Figure 4 is a structural block diagram of a data dynamic caching device according to an embodiment of the present application;

[0027] Figure 5 is a hardware structure schematic diagram of a computer device according to an embodiment of the present application. DETAILED DESCRIPTION

[0028] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort fall within the scope of protection of the present application.

[0029] According to an embodiment of the present application, a data dynamic caching method embodiment is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0030] In the present embodiment, a data dynamic caching method is provided, which can be used in computer devices such as computers, servers, etc. Figure 1 is a flowchart of a data dynamic caching method according to an embodiment of the present application, as shown in Figure 1 , the flow includes the following steps:

[0031] Step S101, obtaining the access frequency and timestamp of the first target data.

[0032] The first target data can indicate data stored in a target cache. The target cache can be one of a first-level cache and a second-level cache.

[0033] The access frequency can be the number of times the data is accessed per unit time, reflecting the short-term popularity of the data. The timestamp can indicate the time point of each access of the recorded data, used to analyze the time distribution and trend of the access.

[0034] The timestamp of each data access can be recorded by a log system, and the number of accesses per unit time can be counted. Monitoring tools such as Prometheus and Grafana can be used to collect data access information in real time and calculate the access frequency. The specific implementation can be determined by those skilled in the art.

[0035] In step S102, the heat change trend of the first target data in the time period is determined according to the access frequency and the timestamp of the first target data.

[0036] The heat change trend can indicate the increasing or decreasing trend of the access frequency of the target data in the time period, reflecting the dynamic change of the heat. After obtaining the access frequency and the timestamp of the first target data, the heat change trend of the first target data in the time period can be further determined.

[0037] As an example, a fixed time window (such as 5 minutes or 1 hour) is used to count the access frequency, and the change of the frequency in the window is observed.

[0038] As an example, a weighted average of the access frequency is performed, with higher weight for recent accesses, reflecting the short-term heat change.

[0039] As an example, a machine learning model (such as ARIMA or LSTM) is used to predict the future access frequency and determine the trend.

[0040] In step S103, the first target data is adjusted to a target cache according to the heat change trend. The target cache can be one of a first-level cache and a second-level cache, and the heat of the data in the first-level cache is greater than that of the data in the second-level cache.

[0041] After determining the heat change trend, the first target data can be adjusted to the target cache. For example, if the heat change trend of the first target data indicates that the first target data changes from hot data to cold data, the first target data can be added to the second-level cache.

[0042] As an example, a heat threshold is set. If the trend is rising and the current frequency exceeds the threshold, the first target data is upgraded to the first-level cache; otherwise, the first target data is downgraded to the second-level cache.

[0043] The data dynamic caching method provided in the embodiment dynamically calculates the heat trend through the access frequency and the timestamp, identifies the rise or fall of the data heat in a timely manner, adjusts the first target data to the target cache according to the heat change trend, and the target cache is one of the first cache and the second cache. The heat of the data in the first cache is greater than the heat of the data in the second cache. Compared with the way of statically allocating data to different levels of caches according to preset rules (such as data size, life cycle, etc.) in the related art, the query efficiency can be effectively improved.

[0044] In one possible implementation, the step S103 includes:

[0045] In step S1031, when the first target data is stored in the first cache and the heat change trend of the first target data indicates that the heat of the first target data is less than the heat threshold, the first target data is loaded into the second cache.

[0046] In step S1032, when the first target data is stored in the second cache and the heat change trend of the first target data indicates that the heat of the first target data is greater than the heat threshold, the first target data is loaded into the first cache.

[0047] The heat threshold can be a preset value. The heat threshold can indicate a critical value of the first target data belonging to hot data, that is, when the heat of the first target data is less than the heat threshold, the first target data belongs to cold data, and when the heat of the first target data is not less than the heat threshold, the first target data belongs to hot data. The first cache can indicate a cache for storing hot data. The second cache can indicate a cache for storing cold data. The first cache can be a local cache, and the second cache can be a Redis cache.

[0048] For example, if a certain data originally stored in the second Redis cache is predicted to become popular data, it is promoted to the first local cache; otherwise, if a certain data in the first local cache is predicted to become cold data, it is degraded to the second Redis cache.

[0049] In one possible implementation, when the heat of the first target data is lower than the heat threshold, the heat of the first target data can be detected again after a preset time, and if the heat of the first target data is still lower than the heat threshold, the first target data is added from the first cache to the second cache.

[0050] The data dynamic caching method provided in the embodiment can monitor the data heat change in real time, so that the system can timely promote high-frequency access data from the second cache to the first cache to reduce access delay, and degrade low-frequency data to the second cache to avoid occupying the first cache space. This dynamic adjustment mechanism ensures that the cache content is always highly matched with the actual access demand, and significantly improves the cache hit rate.

[0051] In a possible implementation, the step S102 comprises: determining, by using a hotness prediction model based on machine learning, a hotness change trend of the first target data in the time period according to the access frequency and the timestamp of the first target data.

[0052] The hotness prediction model can be trained by historical access data to predict the access frequency and the hotness trend of the data in a future time period.

[0053] The hotness prediction model based on machine learning is used to determine the hotness change trend of the first target data in the time period according to the access frequency and the timestamp of the first target data, wherein the access frequency and the timestamp of the first target data are inputs of the hotness prediction model, and the hotness change trend of the first target data in the time period is an output of the hotness prediction model.

[0054] The hotness prediction model based on machine learning can be an LSTM (Long Short-Term Memory Network), an ARIMA (Autoregressive Integrated Moving Average Model), or the like, which is not specifically limited herein.

[0055] In a specific implementation, the access frequency and the timestamp of the first target data are obtained from a log system, a monitoring tool, or a cache system, the access frequency and the timestamp of the current time window are input into the hotness prediction model based on machine learning, and the access frequency in a future time period is predicted.

[0056] The data dynamic caching method provided in this embodiment can improve the accuracy of determining the hotness change trend of the first target data in the time period by using the hotness prediction model based on machine learning to determine the hotness change trend of the first target data in the time period.

[0057] In a possible implementation, the method further comprises:

[0058] In step S201, when the capacity of the target cache is not less than the capacity threshold, the associated information of each data in the target cache is obtained, wherein the associated information comprises the number of uses.

[0059] The capacity threshold can be a pre-set threshold. The capacity of the target cache can indicate the capacity of the first-level cache and the second-level cache. The associated information can indicate metadata related to the cache data, which is used to evaluate the importance of the data and the cleaning priority. The number of uses can indicate the total number of times that the data is accessed in the cache, reflecting the short-term hotness of the data. For example, a certain data is accessed 5 times in the past 1 hour, and the number of uses is 5 times.

[0060] As an example, the cache usage is obtained by using a monitoring interface (such as an INFO command) provided by a cache system (such as Redis, Memcached).

[0061] As an example, a counter is maintained for each data item in the cache system, recording the number of accesses.

[0062] In step S202, data with a usage frequency less than a usage frequency threshold is removed from the target cache.

[0063] The usage frequency threshold can be a pre-set threshold, where a usage frequency less than the usage frequency threshold indicates that the data is infrequently accessed data, and the data needs to be removed from the target cache.

[0064] The data dynamic caching method provided in this embodiment ensures that the cache always serves data with high popularity by retaining only frequently accessed data of users through the usage frequency threshold when the capacity of the target cache is not less than the capacity threshold, thereby improving the hit rate.

[0065] In one possible implementation, the association information further includes: a historical access frequency; and the method further includes:

[0066] In step S203, data with a historical access frequency lower than a frequency threshold is removed from the target cache.

[0067] The historical access frequency can indicate the average number of accesses of the data within a period of time, reflecting the long-term popularity of the data.

[0068] The historical access record of the data can be obtained from a log system or a monitoring tool, including access time and timestamp. The number of accesses of each data within a specified period of time (such as 24 hours) is counted, and the average access frequency is calculated. A counter can also be maintained for each data item in the cache system to record the number of accesses, and the access frequency is calculated regularly, etc., which is not specifically limited here and can be implemented by those skilled in the art.

[0069] The frequency threshold is a pre-set value. When the historical access frequency is lower than the frequency threshold, the data needs to be removed, and data with a historical access frequency lower than the frequency threshold can be removed.

[0070] The data dynamic caching method provided in this embodiment uses the usage frequency, which can be affected by short-term fluctuations. The historical access frequency reflects the long-term access pattern of the data, avoiding the deletion of data that is temporarily cold but has long-term value. In addition, sudden traffic can cause the usage frequency of some data to surge, but the historical frequency shows that its long-term value is low. By combining the two, frequent adjustments of the cache due to short-term fluctuations can be avoided.

[0071] In one possible implementation, the method further includes:

[0072] In step S301, a data query request is received.

[0073] The data query request can be received through a triggering operation of a user striking a keyboard, clicking a mouse or touching a screen. The computer device can receive the data query request in response to the triggering operation.

[0074] In step S302, the second target data corresponding to the data query request is searched from the first cache according to the data query request.

[0075] After determining the data query request, it can be firstly searched from the first cache whether there is the second target data corresponding to the data query request.

[0076] In step S303, when the second target data corresponding to the data query request is not searched from the first cache, the second target data corresponding to the data query request is searched from the second cache.

[0077] If the second target data corresponding to the data query request is not searched from the first cache, the second target data corresponding to the data query request can be searched from the second cache.

[0078] In step S304, when the second target data corresponding to the data query request is searched from the second cache, the second target data is loaded from the second cache to the first cache.

[0079] If the second target data corresponding to the data query request is searched from the second cache, the second target data can be loaded from the second cache to the first cache.

[0080] In combination Figure 2 As shown in the figure, when the system receives a data request, the target data is firstly searched in the first local cache. The local cache can be implemented by using a local cache library such as Guava Cache, Ehcache, etc., and has the characteristics of fast reading and writing. If the target data is hit in the first local cache, the data is directly returned to realize fast response. At the same time, the access record of the data in the local cache is updated for subsequent heat judgment. If the target data is not hit in the first local cache, it is searched in the second Redis cache. The Redis cache as a distributed cache has a large storage capacity and good scalability. The second cache hit judgment: if the target data is hit in the second Redis cache, the data is returned to the application program and loaded into the first local cache for subsequent access. At the same time, the access record of the data in the Redis cache is updated.

[0081] In one possible implementation, the second cache miss processing: if the target data is not hit in the second Redis cache, the data is obtained from a back-end data source (such as a database). After obtaining the data, the data is stored in the first local cache and the second Redis cache, and the corresponding TTL value is set according to the heat of the data.

[0082] The data dynamic caching method provided by the embodiment can maximize the hit rate by preferentially hitting data from the first-level cache and loading data from the second-level cache when a hit is not made, and can further improve the query efficiency by loading the data hit in the second-level cache to the first-level cache to ensure that the data with high frequency of access always resides in the fastest storage layer.

[0083] In one possible implementation, in combination with Figure 3 As shown, the access frequency and timestamp of the real-time recording data and other information are recorded, and then a heat prediction model based on machine learning is used to predict the heat change trend of the data. The intelligent scheduling module determines whether the cache level needs to be adjusted according to the prediction result, and if so, the data is promoted from the second-level Redis cache to the first-level local cache or demoted from the first-level local cache to the second-level Redis cache.

[0084] The data dynamic caching method provided by the embodiment can respond to data requests at a speed close to zero delay by storing hot data in the first-level local cache, greatly improving the instant response capability of the system and significantly reducing the response time of the service, thereby providing a more smooth user experience.

[0085] In addition, the advantages of the local cache and the Redis cache are reasonably utilized, hot data is stored in the local cache, and cold data is stored in the Redis cache, which improves the data access speed and avoids the problem of insufficient memory caused by storing too much data in the local cache, thereby realizing reasonable allocation and efficient utilization of resources.

[0086] In addition, the cache strategy and parameters can be automatically adjusted according to different business scenarios and data characteristics, which has strong adaptability and can meet various application scenarios. By monitoring the heat change of the data in real time and dynamically adjusting the cache level, and selecting a suitable cache replacement algorithm according to the business requirements, the hit rate and resource utilization of the cache are improved, and the performance and stability of the system are further improved.

[0087] In the embodiment, a data dynamic caching device is also provided, which is used to implement the above-described embodiments and preferred embodiments, and details are not repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and contemplated.

[0088] The embodiment provides a data dynamic caching device, which is used to implement the above-described embodiments and preferred embodiments, and details are not repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware or a combination of software and hardware is also possible and contemplated. Figure 4As shown, the device comprises: an acquisition module 401, configured to acquire an access frequency and a timestamp of first target data; a determination module 402, configured to determine a heat change trend of the first target data in a time period according to the access frequency and the timestamp of the first target data; and an adjustment module 403, configured to adjust the first target data to a target cache according to the heat change trend; wherein the target cache is one of a first cache and a second cache, and the heat of data in the first cache is greater than the heat of data in the second cache.

[0089] In one possible implementation, the adjustment module 403 comprises: a first adjustment unit, configured to load the first target data to the second cache when the first target data is stored in the first cache and the heat change trend of the first target data indicates that the heat of the first target data is less than a heat threshold; and a second adjustment unit, configured to load the first target data to the first cache when the first target data is stored in the second cache and the heat change trend of the first target data indicates that the heat of the first target data is greater than the heat threshold.

[0090] In one possible implementation, the determination module 402 is configured to determine the heat change trend of the first target data in the time period according to the access frequency and the timestamp of the first target data by using a heat prediction model based on machine learning.

[0091] In one possible implementation, the device further comprises: an association information acquisition module, configured to acquire association information of each data in the target cache when the capacity of the target cache is not less than a capacity threshold; wherein the association information comprises a usage frequency; and a first cleaning module, configured to clean data with a usage frequency less than a usage frequency threshold from the target cache.

[0092] In one possible implementation, the device further comprises: a second cleaning module, configured to clean data with a historical access frequency less than a frequency threshold from the target cache.

[0093] In one possible implementation, the device further comprises: a data query request receiving module, configured to receive a data query request; a first searching module, configured to search for second target data corresponding to the data query request from the first cache according to the data query request; a second searching module, configured to search for the second target data corresponding to the data query request from the second cache when the second target data corresponding to the data query request is not found from the first cache; and a loading module, configured to load the second target data from the second cache to the first cache when the second target data corresponding to the data query request is found from the second cache.

[0094] Further function descriptions of the above-mentioned various modules and units are the same as those of the above-mentioned corresponding embodiments, which will not be described here again.

[0095] In this embodiment, the data dynamic caching device is presented in the form of a functional unit. Here, a functional unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0096] This invention also provides a computer device having the above-described features. Figure 4 The data dynamic caching device shown.

[0097] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 5 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 5 Take a processor 10 as an example.

[0098] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GPA), or any combination thereof.

[0099] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.

[0100] The memory 20 can include a program storage area and a data storage area. The program storage area can store an operating system, application programs required for at least one function, etc. The data storage area can store data created by the computer device, etc. In addition, the memory 20 can include a high-speed random access memory, and can also include a non-transitory memory such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid state memory device. In some alternative embodiments, the memory 20 can optionally include memory that is remotely located with respect to the processor 10, and which can be connected to the computer device through a network. Examples of such networks include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communications network, and combinations thereof.

[0101] The memory 20 can include a volatile memory, such as a random access memory, and / or can include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid state memory device. The memory 20 can also include an array of multi-state flash memory cells, which can be used to store data and / or instructions in multiple states.

[0102] The computer device also includes a communications interface 30 for communicating with other devices or communication networks.

[0103] The embodiments of the present application also provide a computer readable storage medium, and the method according to the embodiments of the present application can be implemented in hardware, firmware, or recorded in a storage medium, or be implemented as computer code to be originally stored in a remote storage medium or a non-transitory machine readable storage medium downloaded through a network and stored in a local storage medium, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. The storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid state disk, etc. Further, the storage medium can also include a combination of the above-mentioned kinds of storage. It can be understood that the computer, the processor, the microprocessor controller, or the programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiments is implemented.

[0104] Part of the present application can be applied as a computer program product, for example, computer program instructions, when executed by a computer, through the operation of the computer, can invoke or provide the method and / or technical solutions according to the present application. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source files, executable files, installation package files and the like, and accordingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.

[0105] Although the embodiments of the present application are described in conjunction with the drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A method for dynamic data caching, characterized in that, The method further includes: Obtain the access frequency and timestamp of the first target data; Based on the access frequency of the first target data and the timestamp, determine the popularity trend of the first target data within the time period; Based on the trend of popularity change, the first target data is adjusted to the target cache; wherein, the target cache is one of the first-level cache and the second-level cache, and the popularity of the data in the first-level cache is greater than that of the data in the second-level cache.

2. The data dynamic caching method according to claim 1, characterized in that, Based on the aforementioned trend of heat changes, the first target data is adjusted to the target cache, including: When the first target data is stored in the first-level cache and the popularity trend of the first target data indicates that the popularity of the first target data is less than the popularity threshold, the first target data is loaded into the second-level cache. When the first target data is stored in the second-level cache and the popularity trend of the first target data indicates that the popularity of the first target data is greater than the popularity threshold, the first target data is loaded into the first-level cache.

3. The data dynamic caching method according to claim 1, characterized in that, Based on the access frequency of the target data and the timestamp, determine the popularity trend of the target data within a time period, including: Using a machine learning-based popularity prediction model, the popularity trend of the first target data within a time period is determined based on the access frequency of the first target data and the timestamp.

4. The data dynamic caching method according to claim 1, characterized in that, The method further includes: When the capacity of the target cache is not less than the capacity threshold, obtain the association information of each piece of data in the target cache; wherein, the association information includes the number of times it is used; Remove data whose usage count is less than the usage count threshold from the target cache.

5. The data dynamic caching method according to claim 4, characterized in that, The associated information also includes: historical access frequency; and the method further includes: Remove historical access frequency data that is below the frequency threshold from the target cache.

6. The data dynamic caching method according to claim 1, characterized in that, The method further includes: Receive data query requests; Based on the data query request, retrieve the second target data corresponding to the data query request from the first-level cache; If the second target data corresponding to the data query request is not found in the first-level cache, the second target data corresponding to the data query request is searched in the second-level cache. When the second target data corresponding to the data query request is found in the second-level cache, the second target data is loaded from the second-level cache into the first-level cache.

7. A dynamic data caching device, characterized in that, The device includes: The acquisition module is used to obtain the access frequency and timestamp of the first target data; The determination module is used to determine the popularity trend of the first target data within a time period based on the access frequency of the first target data and the timestamp; An adjustment module is used to adjust the first target data to a target cache according to the trend of popularity change; wherein the target cache is one of a first-level cache and a second-level cache, and the popularity of the data in the first-level cache is greater than that of the data in the second-level cache.

8. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the data dynamic caching method according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to execute the data dynamic caching method according to any one of claims 1 to 6.

10. A computer program product, characterized in that, It includes computer instructions for causing a computer to execute the data dynamic caching method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Forecast method of micro-blog public opinion event hotness and development trend based on the number of comments

    CN109508416A

  • Data dynamic storage method and device, equipment and storage medium

    CN118915978A

  • Hotspot data configuration method and hotspot trend prediction model construction method and device

    CN120066413A

  • Cold and hot data object life cycle feature extraction method based on deep learning

    CN120216971A

  • Machine learning to improve caching efficiency in a storage system

    US20220350484A1