Cache management method and device, equipment, medium and computer program product

By setting up access history queues and cache queues in cache management and dynamically adjusting the threshold K and weight coefficient, the problem of lack of flexibility in cache management in the existing technology is solved, the flexibility and efficiency of cache management are achieved, and the cache hit rate and system performance are improved.

CN120803978AActive Publication Date: 2025-10-17CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202510816360.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-10-17
Estimated Expiration
2045-06-18

AI Technical Summary

Technical Problem

The cache management method in the existing technology lacks flexibility and can only be applied to simple access modes, and cannot effectively cope with complex and changing access requirements.

Method used

A cache management method is adopted. By setting the access history queue and cache queue, the threshold K is dynamically adjusted according to the access frequency and time characteristics of the data items. Combined with the weight coefficients of different system categories, the cache allocation and management are optimized to ensure that the data items in the cache queue are synchronized with the current access pattern.

Benefits of technology

It improves the cache hit rate and system performance, can flexibly respond to the complex and changing access requirements of various systems in the platform, and optimize resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803978A_ABST
    Figure CN120803978A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a cache management method and device, equipment, a medium and a computer program product, and the method comprises the steps: loading a data item to an access history queue when the data item is accessed for the first time; and when the number of access times of the data item in the access history queue is greater than or equal to a threshold value K, loading the data item into a cache queue. According to the embodiment of the invention, the access history queue is set, and the data items are loaded to the cache queue only when the access times of the data items in the access history queue reach the threshold value K, so that the data items which are accessed again with high probability are screened out and loaded to the cache queue, and the technical effect of efficiently utilizing the cache is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computers, and in particular to a cache management method, device, equipment, medium and computer program product. BACKGROUND

[0002] Cache is a small-capacity memory between the central processing unit (CPU) and the memory, and has a faster access speed than the memory. It can provide instructions and data to the CPU at a high speed, thereby improving the execution speed of the program. Cache technology is an important technology adopted to solve the contradiction between the operation speed of the CPU and the read-write speed of the memory.

[0003] In order to use the cache more efficiently, the cache needs to be managed. The cache management in the prior art usually adopts the least recently used (LRU) eviction policy, the core idea of which is to remove the data that has not been accessed for the longest time first. When the cache space is insufficient, the LRU algorithm realizes the eviction mechanism through a sorted queue. Specifically, when the data is accessed, the data is moved to the head of the queue (indicating recent use), and when the data needs to be evicted, the data is removed from the tail of the queue (indicating the longest time of non-use). This cache management method lacks flexibility and can only be applied to simple access patterns. SUMMARY

[0004] At least one embodiment of the present application provides a cache management method, device, equipment, medium and computer program product, which are used to solve the problem that the cache management method in the prior art lacks flexibility and can only be applied to simple access patterns.

[0005] In order to solve the above technical problems, the present application is implemented as follows:

[0006] In a first aspect, the embodiments of the present application provide a cache management method, comprising:

[0007] When a data item is accessed for the first time, the data item is loaded into an access history queue;

[0008] When the number of times of accessing the data item in the access history queue is greater than or equal to a threshold K, the data item is loaded into a cache queue.

[0009] Optionally,

[0010] When the cache eviction condition is met, the heat value of each data item in the cache queue is determined, wherein the heat value of each data item is determined according to the system category to which it belongs; the system category includes a full-period access limited system, a partial-period access limited system and an access non-limited system.

[0011] determining a data item to be evicted according to the hotness value of each data item in the cache queue;

[0012] deleting the data item to be evicted from the cache queue.

[0013] Optionally,

[0014] determining the hotness value of each data item in the cache queue, comprising:

[0015] in the case where the system to which the data item belongs is the full-time access limited system, calculating the hotness value of the data item according to the following formula: hotness value = full-time access limited system access frequency * frequency weight + γ * time weight * 1 / (current time - latest access time), wherein γ is a positive number less than 1;

[0016] in the case where the system to which the data item belongs is the partial-time access limited system and the current time is in the non-limited time period, calculating the hotness value of the data item according to the following formula:

[0017] hotness value = partial-time access limited system access frequency * frequency weight + 1 / (current time - latest access time) * time weight;

[0018] in the case where the system to which the data item belongs is the partial-time access limited system and the current time is in the limited time period, calculating the hotness value of the data item according to the following formula:

[0019] hotness value = partial-time access limited system access frequency * frequency weight + δ(t) * time weight * 1 / (current time - latest access time), wherein δ(t) is a time function, 0≤t≤T, T is the length of the limited time period, and δ(0)>γ;

[0020] in the case where the system to which the data item belongs is the non-limited system, calculating the hotness value of the data item according to the following formula:

[0021] hotness value = non-limited system access frequency * frequency weight + 1 / (current time - latest access time) * time weight;

[0022] wherein the sum of the frequency weight and the time weight is 1.

[0023] Optionally,

[0024] obtaining the access parameter of each type of system in the current statistical period, and calculating the average value of the access parameter in the historical statistical period; wherein the access parameter is the access frequency of each type of system or the proportion of the access times of each type of system in all types of systems;

[0025] When an increase in the access parameter of the full-time access restricted system relative to an average value of the access parameter is greater than a first threshold, reducing the value of K;

[0026] In a case where an increase in the access parameter of the unrestricted system relative to an average value of the access parameter is greater than a second threshold, increasing the value of K;

[0027] When an increase in the access parameter of the system with restricted access during the partial period relative to the average value of the access parameter during the restricted access period is greater than a third threshold, reducing the value of K;

[0028] When an increase in the access parameter of the system with restricted access during the partial period relative to the average value of the access parameter during the non-restricted access period is greater than a fourth threshold, the value of K is increased.

[0029] Optionally, the proportion of visits to each category of systems in all categories of systems is calculated as follows:

[0030] Get the number of system visits for each category in the current statistical period;

[0031] Based on the number of visits to each category of systems in the current statistical period, calculate the total number of visits to all categories of systems in the current statistical period;

[0032] Based on the ratio of the number of visits to each category of systems to the total number of visits to all categories of systems during the current statistical period, the proportion of the number of visits to the system in each category among all categories of systems is calculated.

[0033] Optionally, the first threshold is calculated based on a third preset ratio of an average value of the access parameter;

[0034] The second threshold is calculated based on a fourth preset ratio of the average value of the access parameter;

[0035] The third threshold is calculated based on a fifth preset ratio of the average value of the access parameter.

[0036] Optionally, increasing the value of K includes at least one of the following:

[0037] Increasing the value of K according to a preset first fixed step size;

[0038] Adding the current value of K to ΔK1, wherein ΔK1 is the smaller of the product of the current value of K and a first preset ratio and a preset maximum increase;

[0039] Reducing the value of K includes at least one of the following:

[0040] According to a preset second fixed step size, reducing the value of K;

[0041] Subtract the current value of K from ΔK2, where ΔK2 is the smaller of the product of the current value of K and the second preset ratio and the preset maximum reduction amplitude.

[0042] Optionally, the time interval between two adjacent K value adjustments is not less than a preset minimum time interval.

[0043] In a second aspect, an embodiment of the present application provides a cache device, including:

[0044] a first loading unit, configured to load a data item into an access history queue when the data item is accessed for the first time;

[0045] The second loading unit is configured to load the data item into the cache queue when the number of times the data item has been accessed in the access history queue is greater than or equal to a threshold value K.

[0046] In a third aspect, an embodiment of the present application provides an electronic device, which includes: a processor, a memory, and a program or instruction stored in the memory and runnable on the processor. When the processor executes the program or instruction, the electronic device executes the cache management method provided in the embodiment of the present application.

[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program is stored. When the program is executed by a processor, the cache management method provided in the embodiment of the application is implemented.

[0048] In a fifth aspect, an embodiment of the present application provides a computer program product, including computer instructions, which, when executed by a processor, implement the cache management method provided in the embodiment of the application.

[0049] Compared with the existing technology, the cache management method, device, equipment, medium and computer program product provided by the embodiments of the present application reasonably divide and classify various systems of the platform, and set different weight coefficients for different types of systems, so as to more accurately reflect the importance of different types of systems in the cache, optimize the allocation and management of the cache, and control whether the data items are moved to the cache queue by setting the parameter K, quickly respond to subsequent access requests, thereby improving system performance and resource utilization efficiency. At the same time, by dynamically adjusting the K value, it can ensure that the data items in the cache queue are always synchronized with the current access mode, thereby improving the cache hit rate and system performance, and can flexibly respond to the complex and changeable access requirements of various systems in the platform. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present application. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:

[0051] Figure 1 This is a flowchart of a cache management method according to an embodiment of the present application;

[0052] Figure 2 This is a flowchart of another cache management method according to an embodiment of the present application;

[0053] Figure 3 This is a structural block diagram of a cache management device according to an embodiment of the present application;

[0054] Figure 4 A schematic diagram of a cache management electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0055] The terms "first", "second", etc. in this application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same type, and do not limit the number of objects, for example, the first object can be one or more. In addition, "or" in this application represents at least one of the connected objects. For example, "A or B" covers three options, namely, Option 1: including A but not including B; Option 2: including B but not including A; Option 3: including both A and B. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.

[0056] The term "indication" in this application can be either a direct indication (or explicit indication) or an indirect indication (or implicit indication). A direct indication can be understood as the sender explicitly informing the receiver of specific information, the operation to be performed, or the requested result, etc. in the instruction sent; an indirect indication can be understood as the receiver determining the corresponding information based on the instruction sent by the sender, or making a judgment and determining the operation to be performed or the requested result, etc. based on the judgment result.

[0057] like Figure 1 As shown, an embodiment of a cache management method provided by the present application includes the following steps:

[0058] Step 101: When a data item is accessed for the first time, the data item is added to an access history queue.

[0059] The embodiment of the present application sets an access history queue (History Queue). When a data item is accessed for the first time, it is loaded into the access history queue.

[0060] Step 102: When the number of times the data item has been accessed in the access history queue is greater than or equal to a threshold value K, the data item is loaded into the cache queue.

[0061] The system will monitor the number of times each data item in the access history queue is further accessed. When a data item in the access history queue is accessed K times, it means that the probability of the data item being accessed again is relatively high, and it will be moved to the cache queue to quickly respond to subsequent access requests.

[0062] This embodiment sets up an access history queue. Only when the number of accesses to a data item in the access history queue reaches a threshold value K is it loaded into the cache queue, thereby filtering out data items with a high probability of being accessed again and loading them into the cache queue, thereby achieving the technical effect of efficient cache utilization.

[0063] like Figure 2 As shown, another embodiment of the cache management method provided by the present application includes the following steps:

[0064] Step 201: When a data item is accessed for the first time, the data item is added to an access history queue.

[0065] Step 202: When the number of times the data item has been accessed in the access history queue is greater than or equal to a threshold value K, the data item is loaded into the cache queue.

[0066] The initial threshold of K can be set based on experience, such as the rounded value of the average number of accesses to each system on the platform, or the median of the number of accesses. It can also be calculated based on the proportion of accesses to each system. For example, in this embodiment, the platform includes three types of systems: systems with restricted access at all times, systems with restricted access at some times, and systems with unrestricted access. Assuming that the access frequencies of the three types of systems in a certain historical period are a1, a2, and a3, respectively, and the proportion of the number of accesses to each type of system in the total number of accesses to all systems is b1, b2, and b3, respectively, the initial value of K can be the rounded value calculated as follows: K = a1*b1+a2*b2+a3*b3.

[0067] Preferably, the embodiment of the present application dynamically adjusts the K value, mainly including the following steps:

[0068] obtain an access parameter of each type of system in a current statistical period, and calculate an average value of the access parameter in a historical statistical period, wherein the access parameter is an access frequency of each type of system or a proportion of an access frequency of each type of system in all types of systems;

[0069] in a case where an increase of the access parameter of the full-period access limited system with respect to the average value of the access parameter is greater than a first threshold, decreasing the value of the K;

[0070] in a case where an increase of the access parameter of the non-limited system with respect to the average value of the access parameter is greater than a second threshold, increasing the value of the K;

[0071] in a case where an increase of the access parameter of the partial-period access limited system in the access limited period with respect to the average value of the access parameter is greater than a third threshold, decreasing the value of the K;

[0072] in a case where an increase of the access parameter of the partial-period access limited system in the access non-limited period with respect to the average value of the access parameter is greater than a fourth threshold, increasing the value of the K.

[0073] Here, the proportion of the access frequency of each type of system in all types of systems is calculated in the following manner:

[0074] obtaining an access frequency of each type of system in a current statistical period;

[0075] calculating a total of access frequencies of all types of systems in the current statistical period according to the access frequency of each type of system in the current statistical period;

[0076] calculating the proportion of the access frequency of each type of system in all types of systems according to a ratio of the access frequency of each type of system to the total of access frequencies of all types of systems in the current statistical period.

[0077] the first threshold is calculated according to a third preset proportion of the average value of the access parameter;

[0078] the second threshold is calculated according to a fourth preset proportion of the average value of the access parameter;

[0079] the third threshold is calculated according to a fifth preset proportion of the average value of the access parameter.

[0080] The third, fourth, and fifth preset ratios can be set based on the access parameters of each type of system. For example, they can be set to a value between 5% and 15%. The third, fourth, and fifth preset ratios can be the same or different. In addition, the embodiments of the present application can also appropriately adjust the above ratios based on the actual system operation results. The embodiments of the present application do not specifically limit this.

[0081] By monitoring the incremental changes in access parameters relative to the average values ​​of access parameters in historical statistical periods and dynamically adjusting the K value, we can ensure that the data items in the cache queue are always synchronized with the current access pattern, improve the cache hit rate and system performance, and flexibly respond to the complex and changing access requirements of various systems in the platform.

[0082] In order to avoid the negative impact of frequent fluctuations in the K value on system performance, a fixed step size can be set to adjust the K value. Alternatively, the K value can be adjusted according to the product of the current value of K and the preset ratio. When the product of the current value of K and the preset ratio is greater than the preset maximum adjustment range, the preset maximum adjustment range is taken, which includes:

[0083] Increasing the value of K includes at least one of the following:

[0084] Increasing the value of K according to a preset first fixed step size;

[0085] The current value of K is added to ΔK1, where ΔK1 is the smaller of the product of the current value of K and a first preset ratio and a preset maximum increase.

[0086] Reducing the value of K includes at least one of the following:

[0087] According to a preset second fixed step size, reducing the value of K;

[0088] Subtract the current value of K from ΔK2, where ΔK2 is the smaller of the product of the current value of K and the second preset ratio and the preset maximum reduction amplitude.

[0089] Here, the first fixed step size and the second fixed step size can be set according to a certain ratio between 1% and 5% of the number of times the data item is accessed in the access history queue. The first fixed step size and the second fixed step size can be equal or different. In addition, the embodiment of the present application can also appropriately adjust the above ratio according to the actual system operation effect. For example, when the data items in the cache queue are frequently replaced, the first and second fixed step sizes can be increased and adjusted to a higher ratio of the number of times the data item is accessed in the access history queue.

[0090] To avoid the frequent fluctuation of the K value from having a negative impact on the system performance, the embodiments of the present application can also set a minimum interval time for the adjustment of the K value. The time interval between the adjustment of the K value in two adjacent times is not less than the preset minimum time interval. Generally, if the K value is adjusted in the current statistical period, a minimum time interval is usually required before the K value can be adjusted again. The minimum time interval for the adjustment of the K value is usually set to a value between 30 minutes and 1 hour. Of course, if the access volume of the system changes greatly, the minimum time interval can also be adaptively adjusted.

[0091] Step 203: When the cache eviction condition is met, determine the hotness value of each data item in the cache queue, wherein the hotness value of each data item is determined according to the system category it belongs to; the system category includes: full-period access restricted system, partial-period access restricted system and access unrestricted system.

[0092] When the cache space is insufficient, that is, the cache eviction condition is met, the system will evict part of the data in the cache.

[0093] The number and variety of current platform systems are huge and have high differences. The embodiments divide the systems into three categories according to the restrictedness of system access: full-period access restricted system, partial-period access restricted system, and access unrestricted system. According to the category of each system, the hotness value of the data items of the system is calculated, and the data items in the cache queue are sorted and managed based on this.

[0094] The full-period access restricted system usually includes some key core business systems, such as billing systems, user data management systems, etc. Since these systems store sensitive or core business data, strict security control and access restriction are required to ensure the integrity and security of the data. Therefore, these systems have access restrictions in the full period, and only specific users or processes can access them under the premise of meeting the security policy.

[0095] The partial-period access restricted system usually includes some non-core business systems or auxiliary systems, such as log analysis systems, performance monitoring systems, etc. These systems may have high access demand in certain periods (such as working hours, business peak periods, etc.), but have low access volume in other periods. In order to balance system performance and resource utilization, these systems set access restrictions in certain periods, such as working hours, business peak periods, etc.

[0096] The access-unrestricted system is usually some public and general system or service, such as a mail system, a file sharing system, etc. These systems provide basic service functions, and the access demand is relatively stable and does not fluctuate significantly due to changes in time period or business scenario. Therefore, these systems have no access restriction in the whole time period, and users can access the required resources at any time and any place.

[0097] The calculation formula of the data item hotness value of the three types of systems, i.e., the whole-time access-restricted system, the partial-time access-restricted system, and the access-unrestricted system, is as follows:

[0098] 1) In the case where the system to which the data item belongs is the whole-time access-restricted system, the hotness value of the data item is calculated according to the following formula: Hotness value = whole-time access-restricted system access frequency * frequency weight + γ * time weight * 1 / (current time - latest access time), wherein γ is a positive number less than 1.

[0099] 2) In the case where the system to which the data item belongs is the partial-time access-restricted system, and the current time is in the unrestricted time period, the hotness value of the data item is calculated according to the following formula:

[0100] Hotness value = partial-time access-restricted system access frequency * frequency weight + 1 / (current time - latest access time) * time weight;

[0101] In the case where the system to which the data item belongs is the partial-time access-restricted system, and the current time is in the restricted time period, the hotness value of the data item is calculated according to the following formula:

[0102] Hotness value = partial-time access-restricted system access frequency * frequency weight + δ(t) * time weight * 1 / (current time - latest access time), wherein δ(t) is a time function, 0≤t≤T, T is the restricted time length, and δ(0)>γ.

[0103] 3) In the case where the system to which the data item belongs is the access-unrestricted system, the hotness value of the data item is calculated according to the following formula:

[0104] Hotness value = access-unrestricted system access frequency * frequency weight + 1 / (current time - latest access time) * time weight.

[0105] Wherein the sum of the frequency weight and the time weight is 1.

[0106] Step 204: Determine the data item to be evicted according to the hotness value of each data item in the cache queue.

[0107] For the data items in the cache queue, sort them according to their hotness values, and when it is necessary to delete data in the cache queue to free up space, determine the data item with a low hotness value as the data item to be evicted.

[0108] Step 205: deleting the data item to be eliminated from the cache queue. The embodiment can ensure that the data items in the cache queue are always synchronized with the current access mode, improve the cache hit rate and system performance, and flexibly cope with the complex and changeable access requirements of various systems in the platform by monitoring the access changes of the three types of systems in real time and dynamically adjusting the K value. Moreover, the embodiment can ensure that the data items in the cache are more in line with the actual access situation, effectively retain the data items in the cache queue that are highly likely to be accessed again in the future, significantly improve the cache hit rate of the resource evaluation system, and reduce the system performance decline caused by cache miss by setting different weight coefficients according to the access restriction conditions of different types of systems to determine the data item to be eliminated, and setting a lower weight coefficient for the full-time access restricted system and a higher weight coefficient for the partial-time access restricted and access unrestricted system.

[0109] The above introduces various methods of the embodiments of the application. The following will further provide a device for implementing the above method.

[0110] As shown in FIG. 1, which is an embodiment of the cache management device of the application, comprising: Figure 3

[0111] A first loading unit for loading the data item to the access history queue when the data item is accessed for the first time.

[0112] A second loading unit for loading the data item to the cache queue when the access times of the data item in the access history queue are greater than or equal to the threshold K.

[0113] Further, the device further comprises:

[0114] A first determining unit for determining the heat value of each data item in the cache queue when the cache elimination condition is met, wherein the heat value of each data item is determined according to the system category thereof; the system category comprises a full-time access restricted system, a partial-time access restricted system and an access unrestricted system.

[0115] A second determining unit for determining the data item to be eliminated according to the heat value of each data item in the cache queue.

[0116] A deleting unit for deleting the data item to be eliminated from the cache queue.

[0117] Further,

[0118] The first determining unit is further configured to:

[0119] ​In the case that the system to which the data item belongs is the full-time period access limited system, the hotness value of the data item is calculated according to the following formula:

[0120] Hotness value = full-time period access limited system access frequency * frequency weight + γ * time weight * 1 / (current time - latest access time), wherein γ is a positive number less than 1;

[0121] In the case that the system to which the data item belongs is the partial-time period access limited system and the current time is in the non-limited time period, the hotness value of the data item is calculated according to the following formula:

[0122] Hotness value = partial-time period access limited system access frequency * frequency weight + 1 / (current time - latest access time) * time weight;

[0123] In the case that the system to which the data item belongs is the partial-time period access limited system and the current time is in the limited time period, the hotness value of the data item is calculated according to the following formula:

[0124] Hotness value = partial-time period access limited system access frequency * frequency weight + δ(t) * time weight * 1 / (current time - latest access time), wherein δ(t) is a time function, 0≤t≤T, T is the length of the limited time period, and δ(0)>γ;

[0125] In the case that the system to which the data item belongs is the non-limited system, the hotness value of the data item is calculated according to the following formula:

[0126] Hotness value = non-limited system access frequency * frequency weight + 1 / (current time - latest access time) * time weight;

[0127] Wherein the sum of the frequency weight and the time weight is 1.

[0128] Further, the apparatus further comprises:

[0129] A K value adjusting unit configured to take the access parameter of each category of system in the current statistical period, and calculate the average value of the access parameter in the historical statistical period; wherein the access parameter is the access frequency of each category of system or the proportion of the access times of each category of system in all categories of system;

[0130] In the case that the increase of the access parameter of the full-time period access limited system relative to the average value of the access parameter is greater than a first threshold, the value of K is decreased;

[0131] In the case that the increase of the access parameter of the non-limited system relative to the average value of the access parameter is greater than a second threshold, the value of K is increased;

[0132] in a case where the access parameter of the partial time period access-limited system in the access-limited time period increases by an amount greater than a third threshold with respect to an average value of the access parameter, the value of the K is decreased;

[0133] in a case where the access parameter of the partial time period access-limited system in the access-unlimited time period increases by an amount greater than a fourth threshold with respect to an average value of the access parameter, the value of the K is increased.

[0134] Embodiments of the present application also provide an electronic device, as shown in the accompanying drawings, the electronic device comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, when the processor executes the program or instruction, the electronic device executes the cache management method provided by the embodiments of the present application and achieves the same technical effects, to avoid repetition, details are not described herein. Figure 4 The processor executes the program or instruction, so that the electronic device executes the cache management method provided by the embodiments of the present application and achieves the same technical effects, to avoid repetition, details are not described herein.

[0135] Embodiments of the present application also provide a computer readable storage medium, the computer readable storage medium stores a computer program, when the computer program is executed by a processor, each process of the above cache management method embodiment is implemented, and the same technical effects can be achieved, to avoid repetition, details are not described herein. The computer readable storage medium includes a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, etc.

[0136] Embodiments of the present application also provide a computer program product, including computer instructions, when the computer instructions are executed by a processor, each process of the above cache management method embodiment is implemented, and the same technical effects can be achieved, to avoid repetition, details are not described herein.

[0137] It should be noted that in this paper, the term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "comprises a" does not exclude the presence of another identical element in the process, method, article or device including the element.

[0138] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and the necessary general hardware platform, of course, also can be through hardware, but in many cases the former is the better embodiment. Based on such understanding, the technical solutions of the present application essentially or say the part of the prior art contribution can be embodied in the form of software products, the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disc, optical disc), including a number of instructions to make a terminal (may be a mobile phone, computer, server, air conditioner, or network equipment, etc.) executes the method described in various embodiments of the present application.

[0139] The embodiments of the present application are described above in combination with the drawings, but the present application is not limited to the above-mentioned specific embodiments, the above-mentioned specific embodiments are only illustrative, but not limited, those skilled in the art can make many forms without departing from the purpose of the present application and the scope of the claims under the inspiration of the present application, all belong to the protection of the present application.

Claims

1. A cache management method, characterized in that: The method comprises: When a data item is accessed for the first time, the data item is loaded into an access history queue; When the number of times the data item is accessed in the access history queue is greater than or equal to a threshold value K, the data item is loaded into the cache queue.

2. The method according to claim 1, characterized in that The method further comprises: When a cache elimination condition is met, determining the heat value of each data item in the cache queue, wherein the heat value of each data item is determined according to the system category to which it belongs; the system categories include: full-time access restricted system, partial-time access restricted system, and non-restricted access system; Determining the data items to be eliminated according to the heat value of each data item in the cache queue; The data item to be eliminated is deleted from the cache queue.

3. The method according to claim 2, characterized in that Determining the heat value of each data item in the cache queue includes: In the case where the system to which the data item belongs is the all-time access restricted system, the popularity value of the data item is calculated according to the following formula: popularity value = access frequency of the all-time access restricted system * frequency weight + γ * time weight * 1 / (current time - most recent access time), where γ is a positive number less than 1; If the system to which the data item belongs is a system with restricted access during the partial period, and the current time is in the non-restricted period, the popularity value of the data item is calculated according to the following formula: Heat value = access frequency of the restricted system in certain time periods * frequency weight + 1 / (current time - last access time) * time weight; If the system to which the data item belongs is the system with restricted access during the partial period, and the current time is within the restricted period, the popularity value of the data item is calculated according to the following formula: Heat value = access frequency of the restricted system in some time periods * frequency weight + δ(t) * time weight * 1 / (current time - last access time), where δ(t) is a time function, 0≤t≤T, T is the restricted duration, and δ(0)>γ; When the system to which the data item belongs is the unrestricted system, the heat value of the data item is calculated according to the following formula: Heat value = unrestricted system access frequency * frequency weight + 1 / (current time - last access time) * time weight; The sum of the frequency weight and the time weight is 1.

4. The method according to claim 2, characterized in that The method comprises: Obtain access parameters for each category of systems in the current statistical period, and calculate the average value of the access parameters for the historical statistical period; wherein the access parameters are the access frequency of each category of systems or the proportion of the number of accesses of each category of systems in all categories of systems; When an increase in the access parameter of the full-time access restricted system relative to an average value of the access parameter is greater than a first threshold, reducing the value of K; In a case where an increase in the access parameter of the unrestricted system relative to an average value of the access parameter is greater than a second threshold, increasing the value of K; When an increase in the access parameter of the system with restricted access during the partial period relative to the average value of the access parameter during the restricted access period is greater than a third threshold, reducing the value of K; When an increase in the access parameter of the system with restricted access during the partial period relative to the average value of the access parameter during the non-restricted access period is greater than a fourth threshold, the value of K is increased.

5. The method according to claim 4, characterized in that The proportion of visits to each category of systems in all categories of systems is calculated as follows: Get the number of system visits for each category in the current statistical period; Based on the number of visits to each category of systems in the current statistical period, calculate the total number of visits to all categories of systems in the current statistical period; The ratio of the number of visits to each category of systems to the total number of visits to all categories of systems during the current statistical period is used to calculate the proportion of the number of visits to each category of systems in all categories of systems.

6. The method according to claim 4, characterized in that The first threshold is calculated based on a third preset ratio of the average value of the access parameter; The second threshold is calculated based on a fourth preset ratio of the average value of the access parameter; The third threshold is calculated based on a fifth preset ratio of the average value of the access parameter.

7. The method according to claim 4, characterized in that Increasing the value of K includes at least one of the following: Increasing the value of K according to a preset first fixed step size; Adding the current value of K to ΔK1, wherein ΔK1 is the smaller of the product of the current value of K and a first preset ratio and a preset maximum increase; Reducing the value of K includes at least one of the following: According to a preset second fixed step size, reducing the value of K; Subtract the current value of K from ΔK2, where ΔK2 is the smaller of the product of the current value of K and the second preset ratio and the preset maximum reduction amplitude.

8. The method according to claim 4, characterized in that The time interval between two adjacent K value adjustments shall not be less than the preset minimum time interval.

9. A cache management device, characterized in that: The device comprises: a first loading unit, configured to load a data item into an access history queue when the data item is accessed for the first time; The second loading unit is configured to load the data item into the cache queue when the number of times the data item has been accessed in the access history queue is greater than or equal to a threshold value K.

10. An electronic device, characterized in that: include: a processor, a memory, and programs or instructions stored in the memory and executable on the processor; When the processor executes the program or instruction, the steps of the method according to any one of claims 1 to 5 are implemented.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which implements the steps of the method according to any one of claims 1 to 5 when executed by a processor.

12. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Three-way equilibrium cache replacement method and device

    CN107577618A

  • Cache management method and device, computer equipment and storage medium

    CN111176560A

  • Data caching method and device, computer equipment and readable storage medium

    CN111367833A

  • Distributed cache optimization method and device, storage medium and product

    CN119357078A

  • Flash cache throttling to control erasures

    US10877879B1