Cache data construction method and device, equipment, storage medium and program product

By querying the target key of the data read request in the cache and deciding whether to build a cache item based on the popularity information in the preset bitmap, the problems of high cache cost and low hit rate are solved, and more efficient data access is achieved.

CN119248179APending Publication Date: 2025-01-03DAWNING INFORMATION IND (BEIJING) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411142475.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

In the prior art, the full construction method of cached data leads to high cache costs and low data read hit rate, and the cache space cannot be effectively utilized, resulting in limited performance improvement.

Method used

By receiving data read requests, check whether the target key exists in the cache. If it does not exist, obtain the popularity information of the target key from the preset bitmap, and decide whether to build a cache item based on the popularity information to avoid unnecessary cache space occupation. And build cache items when the popularity information characterizes the target key frequently accessed.

Benefits of technology

Reduces cache costs, increases hit rate when data is read, ensures cache items are built only when necessary, and improves data access speed and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248179A_ABST
    Figure CN119248179A_ABST
Patent Text Reader

Abstract

The invention relates to a cache data construction method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the steps that a data reading request is received, and whether a target Key included in the data reading request exists or not is inquired in a cache; under the condition that the target Key does not exist in the cache, target popularity information corresponding to the target Key is obtained from a preset bitmap, and the preset bitmap comprises multiple pieces of popularity information corresponding to multiple Keys; and according to the target popularity information, determining whether to construct a cache item corresponding to the target Key in the cache. By adopting the method, the cache cost can be reduced, and the hit rate during data reading can be improved.
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 storage, and in particular to a method, apparatus, computer device, computer-readable storage medium and computer program product for constructing cache data. Background Art

[0002] Usually, for economic reasons, all the data required for the business can be stored on low-speed storage media. In order to improve the read performance, high-speed storage media can be used to make up for the insufficient read performance of the low-speed storage media.

[0003] Full build is a method of building as access, in which all data accessed by the business will be built into the cache indiscriminately regardless of read or write. However, this method has the problems of high cache cost and low data hit rate when reading data. Summary of the invention

[0004] Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium and computer program product for constructing cache data that can reduce cache costs and improve the hit rate when reading data in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for constructing cache data. The method comprises:

[0006] Receive a data read request, and query the cache whether there is a target key included in the data read request;

[0007] In the case that the target Key does not exist in the cache, the target heat information corresponding to the target Key is obtained from a preset bitmap, wherein the preset bitmap includes multiple heat information corresponding to multiple Keys;

[0008] According to the target heat information, determine whether to build a cache item corresponding to the target Key in the cache.

[0009] In one of the embodiments, the target heat information includes a target heat value and a target heat attenuation value, and determining whether to construct a cache item corresponding to the target Key in the cache according to the target heat information includes:

[0010] If the target heat value satisfies a preset condition, constructing the cache item in the cache;

[0011] If the target heat value does not meet the preset condition, it is prohibited to construct the cache item in the cache, and the target heat value and the target heat attenuation value are adjusted respectively.

[0012] In one embodiment, the preset condition is that the target heat value is a first value, and the target heat value and the target heat attenuation value are adjusted respectively, including:

[0013] Add 1 to the target heat value to obtain an accumulated heat value, wherein the accumulated heat value is less than or equal to the first value;

[0014] The target heat decay value is increased to a target value, wherein the target value is a maximum value of the target heat decay values.

[0015] In one embodiment, if the target heat value meets a preset condition, the method further includes:

[0016] The target heat value is set from the first value to a second value, wherein the second value is smaller than the first value.

[0017] In one of the embodiments, the value range of the first value is related to the number of bits corresponding to the target heat value in the preset bitmap;

[0018] The value range of the target heat attenuation value is related to the number of bits corresponding to the target heat attenuation value in the preset bitmap.

[0019] In one embodiment, the step of constructing the cache item in the cache includes:

[0020] Find the target value corresponding to the target Key from the hard disk;

[0021] The cache item is constructed in the cache according to the target Key and the target Value.

[0022] In one embodiment, the method further comprises:

[0023] According to a preset time period, the heat attenuation value in the preset bitmap that is greater than the second value is reduced by 1;

[0024] Delete in the preset bitmap, and reduce by 1 the heat value corresponding to the heat attenuation value equal to the second value.

[0025] In one embodiment, obtaining the target heat information corresponding to the target Key from a preset bitmap includes:

[0026] Perform a hash operation on the target Key to obtain a hash value corresponding to the target Key;

[0027] The target position pointed to by the hash value is determined in the preset bitmap, and the target heat information is read from the target position.

[0028] In one embodiment, the data read request includes a cache construction instruction, and before obtaining the target heat information corresponding to the target Key from the preset bitmap, the method further includes:

[0029] Determining whether the cache building instruction indicates building a cache item;

[0030] The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes:

[0031] If the cache building instruction instructs to build a cache item, the target heat information is obtained from the preset bitmap.

[0032] In a second aspect, the present application also provides a device for constructing cache data. The device comprises:

[0033] A query module, used to receive a data read request and query whether a target key included in the data read request exists in the cache;

[0034] An acquisition module, used for acquiring target heat information corresponding to the target Key from a preset bitmap when the target Key does not exist in the cache, wherein the preset bitmap includes multiple heat information corresponding to multiple Keys;

[0035] A construction module is used to determine whether to construct a cache item corresponding to the Key in the cache according to the target heat information.

[0036] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the method described in the first aspect are implemented.

[0037] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0038] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0039] The cache data construction method, device, computer equipment, computer-readable storage medium and computer program product described above receive a data read request and query whether the target key included in the data read request exists in the cache. Then, if the target key does not exist in the cache, the target heat information corresponding to the target key is obtained from a preset bitmap, wherein the preset bitmap includes multiple heat information corresponding to multiple keys. Then, according to the target heat information, it is determined whether to construct a cache item corresponding to the target key in the cache. In the cache data construction method provided by the present application, since it is determined whether to construct a cache item corresponding to the target key in the cache according to the target heat information, when the target heat information indicates that the target key is frequently accessed, the corresponding cache item can be constructed in the cache, and when the heat information indicates that the target key is not frequently accessed, the corresponding cache item is not constructed in the cache. Compared with the full construction of access and construction, it can avoid the problem of excessive occupation of cache space, resulting in high cache cost, thereby reducing the cache cost. Moreover, since the cache item is constructed when the target key is frequently accessed, the probability of the target key existing in the cache when the server receives the data read request next time is greatly increased, thereby improving the hit rate when reading data. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] FIG1 is an application environment diagram of a method for constructing cache data in one embodiment;

[0042] FIG2 is a schematic diagram of a flow chart of a method for constructing cache data in one embodiment;

[0043] FIG3 is a schematic diagram of a flow chart of step 203 in another embodiment;

[0044] FIG4 is a schematic diagram of a flow chart of step 302 in another embodiment;

[0045] 5 is a schematic diagram of determining whether to construct a cache item according to a target heat value and a target heat decay value in another embodiment;

[0046] FIG6 is a schematic diagram of a flow chart of step 301 in another embodiment;

[0047] FIG7 is a schematic flow chart of a method for constructing cache data in another embodiment;

[0048] FIG8 is a schematic diagram of heat attenuation in another embodiment;

[0049] FIG9 is a schematic diagram of a flow chart of step 202 in another embodiment;

[0050] FIG10 is a schematic diagram of obtaining an erroneous target position in another embodiment;

[0051] FIG11 is a schematic flow chart of a method for constructing cache data in another embodiment;

[0052] FIG12 is a structural block diagram of a device for constructing cache data in one embodiment;

[0053] FIG. 13 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0055] In traditional technology, in order to improve the reading performance of data, the hotness of data can be represented in the form of a linked list, so that hot data can be built into the cache. However, this method requires a portion of memory space to store the linked list, and as the hotness of the data changes, the linked list items need to be modified. When modifying, some memory needs to be applied or released, which increases memory overhead. In addition, when the cache item is relatively small, the memory occupied by the linked list used to represent the hotness of the data is much larger than the memory occupied by the cache item. Therefore, this method has the problem of high memory overhead and high cache cost.

[0056] In view of this, the cache data construction method proposed in the present application receives a data read request and queries in the cache whether there is a target key included in the data read request. Then, if the target key does not exist in the cache, the target heat information corresponding to the target key is obtained from a preset bitmap, wherein the preset bitmap includes multiple heat information corresponding to multiple keys. Then, according to the target heat information, it is determined whether to build a cache item corresponding to the target key in the cache. In the cache data construction method provided in the present application, since it is determined whether to build a cache item corresponding to the target key in the cache according to the target heat information, when the target heat information indicates that the target key is frequently accessed, the corresponding cache item can be built in the cache, and when the heat information indicates that the target key is not frequently accessed, the corresponding cache item is not built in the cache. Compared with the full construction of access and construction, it can avoid the problem of excessive occupation of cache space, resulting in high cache cost, thereby reducing the cache cost. Moreover, since the cache item is constructed when the target key is frequently accessed, the probability of the target key existing in the cache when the server receives the data read request next time is greatly increased, thereby improving the hit rate when reading data.

[0057] The method for constructing cache data provided in the embodiment of the present application can be applied in the implementation environment shown in Figure 1, which includes a server 102 and a terminal 104, wherein the server 102 communicates with the terminal 104 via a network. The data storage system can store the data that the server 102 needs to process. The data storage system can be integrated on the server 102, or it can be placed on the cloud or other network servers. The server can receive a data read request and query whether there is a target key included in the data read request in the cache. Then, the server can obtain the target heat information corresponding to the target key from the bitmap when the target key does not exist in the cache. The preset bitmap includes multiple heat information corresponding to multiple keys, and then the server can determine whether to construct a cache item corresponding to the target key in the cache according to the target heat information. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 102 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0058] In an exemplary embodiment, as shown in FIG. 2 , a method for constructing cache data is provided, which is described by taking the method applied to the server in FIG. 1 as an example, and includes the following steps 201 to 203:

[0059] Step 201: Receive a data read request, and query in the cache whether there is a target Key included in the data read request.

[0060] Among them, the data read request refers to the operation of obtaining data from the server. Optionally, the data read request can be sent by the terminal to the server, or the data read request can also be a data read operation triggered by the user on the display screen. In an embodiment of the present application, taking the data structure of data storage as a key-value pair (Key-Value) as an example, the process of constructing a cache item corresponding to the target Key in the cache is described, wherein the Key is used to index the value and is a unique identifier, and the Value is the data that actually needs to be stored. In the Key-Value storage, each Key is unique and is associated with a Value. Therefore, the data read request received by the server will carry the Key corresponding to the data to be read, and the Key in the data read request will be determined as the target Key.

[0061] Among them, the cache is a hardware or software component embedded in the application or device memory, which can automatically and temporarily store the data used by the user to reduce the data retrieval time and workload the next time the application or device is accessed. There are two main application scenarios for cache: the first is to relieve CPU pressure, for example, storing operation results, calculating in advance the content that originally needed to be calculated in real time, and reusing public data, which can save CPU computing power and improve response performance. The second is to relieve I / O pressure, for example, changing the original read and write access to slower media such as networks and disks to access faster media such as memory to improve response performance. Moreover, the size and speed of the cache are directly related to the transmission speed of the hard disk. The cache can greatly improve the overall performance of the hard disk.

[0062] It should be noted that the embodiment of the present application is a method for constructing cache data in order to improve the access speed of data. Therefore, when a data read request is received, it is possible to query whether the data to be read exists in the cache, so that when the data does not exist in the cache, a corresponding cache item can be constructed in the cache, so that the data can be quickly read from the cache when the data is accessed next time, thereby improving the access speed of the data.

[0063] In this embodiment, the server may receive a data read request sent by a terminal through a network, or receive a data read request by responding to a data read operation triggered by a user, and then obtain the target Key to be queried from the data read request, and then query whether there is a Key consistent with the target Key in the cache according to the target Key, thereby determining whether there is the target Key in the cache according to the query result. Optionally, if there is a Key consistent with the target Key in the cache, it can be determined that the target Key exists in the cache; if there is no Key consistent with the target Key in the cache, it can be determined that the target Key does not exist in the cache.

[0064] Step 202, when the target Key does not exist in the cache, the target heat information corresponding to the target Key is obtained from a preset bitmap, and the preset bitmap includes multiple heat information corresponding to multiple Keys.

[0065] It is understandable that if the target key exists in the cache, the server can directly obtain the target value corresponding to the target key from the cache; if the target key does not exist in the cache, the server can build a cache item corresponding to the target key in the cache to increase the speed of obtaining the target value the next time it is accessed. However, due to limited cache space, it is impossible to build cache items corresponding to all accessed data in the cache. Therefore, the number of times the target key is accessed can be obtained, and then the target key can be determined whether it is cold data or hot data based on the number of times it is accessed, so as to build a cache item corresponding to the target key belonging to hot data in the cache.

[0066] Among them, the preset bitmap refers to a data structure of a bit array, and a bit refers to a binary data bit stored in a computer, that is, a bit. The bit array is a data structure composed of multiple bits. In the bitmap, the binary value corresponding to each slot can be used to represent different states. For example, if the bitmap is represented by a binary bit, the value corresponding to each slot can be 0 or 1. In this embodiment, a preset bitmap can be used to represent the heat information corresponding to the Key. Each preset bitmap includes multiple slots, and multiple slots represent multiple heat information corresponding to multiple Keys. Among them, the heat information corresponding to the target Key is the target heat information.

[0067] It is understandable that, since the memory space occupied by the bitmap is very small, using the bitmap to represent multiple heat information corresponding to multiple keys can greatly reduce the memory occupied by the statistical structure of the heat information of the key.

[0068] In this embodiment, when the target Key does not exist in the cache, the server can determine the slot corresponding to the target Key in the preset bitmap, and then determine the heat information corresponding to the slot as the target heat information.

[0069] Step 203: Determine whether to construct a cache item corresponding to the target Key in the cache according to the target heat information.

[0070] Among them, a cache item refers to a data unit stored in the cache. The data unit can be any form of data, including but not limited to files, database records, web page content, etc. Through cache items, frequently accessed data can be stored in high-speed access media, thereby improving the speed and efficiency of data access. Cache items usually include the data itself and some metadata, such as the data's identifier, size, timestamp, etc. This information helps manage the validity of the cache and the update of the data. In this embodiment, the cache item corresponding to the target Key may include the target Key and the target Value corresponding to the target Key.

[0071] In this embodiment, the server can determine whether the target key belongs to cold data or hot data according to the target heat information, and thus determine whether to build a cache item corresponding to the target key in the cache according to the judgment result. Optionally, if the target key is cold data, the cache item is not built; if the target key is hot data, the cache item is built.

[0072] In the above embodiment, the server receives a data read request and queries in the cache whether there is a target key included in the data read request. Then, if the target key does not exist in the cache, the server obtains the target heat information corresponding to the target key from a preset bitmap, wherein the preset bitmap includes multiple heat information corresponding to multiple keys. Then, the server determines whether to build a cache item corresponding to the target key in the cache based on the target heat information. In the cache data construction method provided in the present application, the server determines whether to build a cache item corresponding to the target key in the cache based on the target heat information. When the target heat information indicates that the target key is frequently accessed, the corresponding cache item can be built in the cache, and when the heat information indicates that the target key is not frequently accessed, the corresponding cache item is not built in the cache. Compared with the full construction of access and construction, it can avoid the problem of excessive occupation of cache space, resulting in high cache cost, thereby reducing the cache cost. Moreover, since the cache item is constructed when the target key is frequently accessed, the probability of the target key existing in the cache when the server receives the data read request next time is greatly increased, thereby improving the hit rate when reading data.

[0073] In one embodiment, based on the embodiment shown in FIG2 , the target heat information includes a target heat value and a target heat attenuation value. Referring to FIG3 , this embodiment relates to a process of how the server determines whether to construct a cache item corresponding to the target Key in the cache according to the target heat information. In this embodiment, step 203 includes steps 301 and 302 shown in FIG3 .

[0074] Step 301: If the target heat value meets the preset conditions, a cache item is constructed in the cache.

[0075] It should be noted that in the preset bitmap, the heat value can be used to represent the access of data in the frequency dimension. For example, if the data is accessed once, the heat value can be increased by 1. The heat decay value can also be used to represent the access of data in the time dimension. For example, if the data is not accessed within a time period, its heat decay value is reduced by 1. Among them, the target heat value refers to the heat value corresponding to the target Key in the preset bitmap, and the target heat decay value refers to the heat decay value corresponding to the target Key in the preset bitmap.

[0076] Among them, the preset condition refers to the minimum value of the target heat value. When the target heat value can meet the preset condition, it means that the target heat value can represent the target Key as hot data. When the target heat value cannot meet the preset condition, it means that the target heat value represents that the target Key is not hot data. In this embodiment, the server can use the preset condition as the basis for judging whether the target Key is hot data. Exemplarily, if a single binary number is used in the preset bitmap to represent the heat value, the preset condition can be that the target heat value is equal to 1; or, if a two-bit binary number is used in the preset bitmap to represent the heat value, the preset condition can also be that the target heat value is equal to 3. This embodiment does not limit this.

[0077] In this embodiment, the server can pre-set preset conditions based on the binary corresponding to the heat value in the preset bitmap, and then compare the target heat value with the preset conditions. Then, when the comparison result indicates that the target heat value meets the preset conditions, a cache item is constructed in the cache.

[0078] Step 302: If the target heat value does not meet the preset condition, it is prohibited to construct a cache item in the cache, and the target heat value and the target heat decay value are adjusted respectively.

[0079] It is understandable that if the target heat value does not meet the preset conditions, it means that the target key is accessed less frequently and is not hot data. Therefore, in order to reduce cache costs, the cache item corresponding to the target key may not be built in the cache. However, in the process of data reading, the target key may not be hot data in the current time, but after a period of time, the target key becomes hot data. Therefore, if a data read request is received, the target heat value corresponding to the target key in the data read request can be accumulated. Furthermore, in order to avoid representing the target key as cold data if the target key is not accessed again in a short period of time, the target heat attenuation value corresponding to the target key can also be increased.

[0080] In this embodiment, the server can compare the target heat value with the preset conditions, and then, if the target heat value does not meet the preset conditions, prohibit the construction of the corresponding cache item in the cache, and perform accumulation operations on the target heat value corresponding to the target Key, and increase the heat attenuation value corresponding to the target Key.

[0081] In this embodiment, the server builds a cache item in the cache when the target heat value meets the preset conditions, and prohibits building a cache item in the cache when the target heat value does not meet the preset conditions, and adjusts the target heat value and the target heat attenuation value respectively. Since the preset condition is the basis for the server to determine whether the target Key is hot data, it determines whether to build a cache item in the cache according to whether the target heat value meets the preset conditions. This can avoid building a cache item corresponding to a target Key that is not hot data in the cache, so that the cache items in the cache are all cache items corresponding to hot data, thereby reducing the cache cost and improving the hit rate of data access.

[0082] In one embodiment, the preset condition is that the target heat value is the first value. Based on the embodiment shown in FIG3 , referring to FIG4 , this embodiment relates to a process of how the server adjusts the target heat value and the target heat attenuation value respectively. In this embodiment, step 302 may include steps 401 and 402 shown in FIG4 .

[0083] Step 401, adding 1 to the target heat value to obtain an accumulated heat value, and the accumulated heat value is less than or equal to the first value.

[0084] The first value refers to the maximum value of the heat value in the preset bitmap. It is understandable that since the hotness of the data will change in different time periods, in order to prevent the hot data in the historical time period from becoming cold data in the current time period, the first value can be set so that when the accumulated heat value is less than or equal to the first value, the operation of accumulating 1 can be continuously performed; and when the accumulated heat value is greater than the first value, the first value can be set to 0 and the operation of accumulating 1 can be restarted from 0.

[0085] As a possible implementation, the value range of the first value may be related to the number of bits corresponding to the target heat value in the preset bitmap. Exemplarily, if one binary bit is used in the preset bitmap to represent the heat value, the value range of the first value includes 0 and 1; if two binary bits are used in the preset bitmap to represent the heat value, the value range of the first value includes 0, 1, 2, 3; if three binary bits are used in the preset bitmap to represent the heat value, the value range of the first value includes 0, 1, 2, 3, 4, 5, 6, 7. In this embodiment, the server can determine the value range of the first value based on the number of bits corresponding to the preset bitmap, so that different numbers of bits can be used to represent the first value, thereby improving the flexibility of using the preset bitmap to represent the target heat value of the target Key.

[0086] In this embodiment, when the target heat value does not meet the preset condition, the server may add 1 to the target heat value to obtain the accumulated heat value.

[0087] Step 402, increasing the target heat decay value to a target value, where the target value is the maximum value of the target heat decay value.

[0088] Among them, the target value refers to the maximum value of the heat decay value in the preset bitmap. It can be understood that the heat decay value represents the hot and cold changes of data in the time dimension. Therefore, in order to prevent the data from being repeatedly accessed in a short period of time, its heat decay value is reduced to the minimum value, thereby judging the data as cold data. When the target heat value does not meet the preset conditions, the heat decay value can be increased to the target value to extend the time for which the data is judged as cold data.

[0089] As a possible implementation, the value range of the target heat attenuation value is related to the number of bits corresponding to the target heat attenuation value in the preset bitmap. For example, if one binary bit is used in the preset bitmap to represent the heat attenuation value, the target value is 1, if two binary bits are used in the preset bitmap to represent the heat attenuation value, the value range of the target value is 3, and if three binary bits are used in the preset bitmap to represent the heat attenuation value, the value range of the target value is 7. In this embodiment, the server can determine the value range of the target heat attenuation value based on the number of bits corresponding to the preset bitmap, so that different numbers of bits can be used to represent the target heat attenuation value, thereby improving the flexibility of using the preset bitmap to represent the target heat attenuation value of the target Key.

[0090] In this embodiment, when the target heat value does not meet the preset conditions, the server can increase the target heat decay value to the target value, thereby using the target value as the heat decay value corresponding to the target Key in the preset bitmap.

[0091] In this embodiment, the server can obtain the accumulated heat value by adding 1 to the target heat value, and the accumulated heat value is less than or equal to the first value. Then, the target heat attenuation value is increased to the target value, and the target value is the maximum value of the target heat attenuation value. Therefore, when the target heat value does not meet the preset conditions, the target heat value and the target heat attenuation value can be adjusted respectively, and then the target heat information of the target Key in the preset bitmap can be updated according to the adjusted target heat value and target heat attenuation value.

[0092] In one embodiment, based on the embodiment shown in FIG. 3 , when the target heat value meets a preset condition, the method further includes: setting the target heat value from a first value to a second value, the second value being smaller than the first value.

[0093] Among them, the second value refers to the minimum value of the heat value in the preset bitmap, that is, the second value can be 0. It can be understood that when the target heat value meets the preset conditions, the server can build a cache item corresponding to the target Key in the cache. When the target Key is accessed next time, the target heat value obtained from the preset bitmap still meets the preset conditions, then the server will build the cache item corresponding to the target Key in the cache again. Then, there may be multiple duplicate cache items in the server, causing cache item redundancy and occupying too much cache space. Therefore, when the target heat value meets the preset conditions, the target heat value can be set to 0.

[0094] In this embodiment, when the target heat value meets a preset condition, the server may set the target heat value from the first value to the second value, thereby making the target heat value corresponding to the target Key in the preset bitmap become 0.

[0095] Exemplarily, as shown in FIG5 , the above process is described by taking the preset bitmap in which one binary bit represents the heat value and two binary bits represent the heat attenuation value as an example. Among them, the target heat value includes: 0, 1, and the target heat attenuation value includes: 0, 1, 2, 3. For Key1, if the corresponding target heat value is 0, it is determined not to build a cache item, and 0 is set to 1, and the corresponding target heat attenuation value is increased to 3. For Key2, if the corresponding target heat value is 1, it is determined to build a cache item, and 0 is set to 1; for Key3, if the corresponding target heat value is 1, it is determined to build a cache item, and 0 is set to 1.

[0096] In this embodiment, the server sets the target heat value from a first value to a second value, where the second value is smaller than the first value, to avoid repeatedly creating a cache item corresponding to the target Key in the cache when the target Key is accessed next time, thereby avoiding redundancy of cache items.

[0097] In one embodiment, based on the embodiment shown in Figure 3, referring to Figure 6, this embodiment relates to a process of how a server constructs a cache item in a cache. In this embodiment, step 301 includes steps 501 and 502 shown in Figure 6.

[0098] Step 501, search and obtain the target Value corresponding to the target Key from the hard disk.

[0099] The hard disk is a storage space for storing the full amount of data. If the data is written to the server, storage space is allocated for the data in the hard disk to store the data. Therefore, if the target key cannot be found in the cache, the target key can be found in the hard disk, and further, the target value corresponding to the target key can be obtained from the hard disk.

[0100] In this embodiment, the server can search for a key identical to the target key from the hard disk according to the target key, and then determine the value corresponding to the key as the target value, and then obtain the target value from the hard disk.

[0101] Step 502: construct a cache item in the cache according to the target Key and the target Value.

[0102] In this embodiment, the server may allocate a storage unit in the cache item, and then store the acquired target Value and target Key in the allocated storage unit in the form of Key-Value, thereby constructing the cache item in the cache.

[0103] In this embodiment, the server obtains the target Value corresponding to the target Key from the hard disk, and then builds a cache item in the cache based on the target Key and target Value. The frequently accessed target Key and target Value can be stored in the cache, thereby improving the access speed and efficiency of the next access to the target Key.

[0104] In one embodiment, based on the above embodiment, referring to FIG7 , this embodiment relates to a process of how the server updates the heat decay value and heat value in the preset bitmap. As shown in FIG7 , the server can implement the process by executing steps 601 and 602 .

[0105] Step 601: according to a preset time period, reduce by 1 the heat decay value in the preset bitmap that is greater than the second value.

[0106] The preset time period refers to a period of heat information statistics, for example, a time period can be one week, or a time period can also be one month, and this embodiment does not limit this. It can be understood that in order to avoid data not being accessed for a long time, the heat decay value can be reduced by 1 to indicate the number of times the data has not been accessed in the time dimension.

[0107] In this embodiment, the server can traverse all the heat attenuation values ​​in the preset bitmap at the end of a time period, and then filter out the heat attenuation values ​​greater than the second value, and then reduce the heat attenuation values ​​greater than the second value by 1.

[0108] Step 602: In the preset bitmap, the heat value corresponding to the heat attenuation value equal to the second value is reduced by 1.

[0109] It can be understood that when the heat decay value is equal to the second value, it means that the Key corresponding to the heat decay value has not been accessed for a long period of time, then it can be considered that the heat corresponding to the Key has decreased, and the server can reduce the heat value corresponding to the Key by 1.

[0110] In this embodiment, the server may traverse all heat attenuation values ​​in a preset bitmap, and then filter out the heat attenuation values ​​equal to the second value, and then reduce the heat value corresponding to the heat attenuation value equal to the second value by 1.

[0111] Exemplarily, as shown in FIG8 , taking the example of using one binary bit to represent the heat value and two binary bits to represent the heat attenuation value in the preset bitmap, the above-mentioned process of updating the heat attenuation value and the heat value in the preset bitmap is described. Among them, the target heat value includes: 0, 1, and the target heat attenuation value includes: 0, 1, 2, 3. When the heat attenuation value is 3, 3 is subtracted by 1 to become 2; when the heat attenuation value is 2, 2 is subtracted by 1 to become 1; when the heat attenuation value is 1, 1 is subtracted by 1 to become 0, and the corresponding heat value is subtracted by 1.

[0112] In this embodiment, the server can adjust the heat value and heat attenuation value in the preset bitmap according to a preset time period by subtracting 1 from the heat attenuation value in the preset bitmap that is greater than the second value, and subtracting 1 from the heat value corresponding to the heat attenuation value equal to the second value in the preset bitmap, thereby being able to timely update the heat value and heat attenuation value.

[0113] In one embodiment, based on the embodiment shown in FIG2 , referring to FIG9 , this embodiment relates to a process of how a server obtains target heat information corresponding to a target Key from a preset bitmap. In this embodiment, step 202 includes steps 701 and 702 shown in FIG9 :

[0114] Step 701, perform a hash operation on the target Key to obtain a hash value corresponding to the target Key.

[0115] The hash operation refers to mapping the key corresponding to the data to the element storage position in the bitmap using a hash function. In this embodiment, the server can substitute the target key into the hash function corresponding to the hash operation, and determine the calculation result of the hash function as the hash value corresponding to the target key.

[0116] Step 702, determine the target position pointed to by the hash value in the preset bitmap, and read the target heat information from the target position.

[0117] The target position refers to a storage position in a preset bitmap for storing target heat information corresponding to a target Key. In this embodiment, the server can determine the corresponding position in the preset bitmap according to the hash value, and then determine the position as the target position, and then determine the information stored in the target position as the target heat information, and obtain the target heat information.

[0118] For example, if the hash value corresponding to the target Key is 3, then the target position can be determined to be the slot at position [3] in the preset bitmap.

[0119] As a possible implementation, because of the conflict in the hash algorithm, there are two keys pointing to the same position in the preset bitmap, which may cause the two keys, the key with fewer access times to be mistakenly built into the cache. Exemplarily, as shown in Figure 10, the process is illustrated. For example, Key1 is accessed less frequently, while Key2 is accessed more frequently, but because Key1 and Key2 point to the same target position, the heat value obtained is 1, so the cache item corresponding to Key1 and the cache item corresponding to Key2 will be constructed in the cache respectively. It should be noted that since Key1 is rarely accessed again in the future, the corresponding cache item will be deleted from the cache according to the elimination mechanism.

[0120] In this embodiment, the server can obtain the hash value corresponding to the target Key by performing a hash operation on the target Key, and then can determine the target position pointed to by the hash value in the preset bitmap, and read the target heat information from the target position. Since the process of obtaining the hash value corresponding to the target Key is relatively simple, the target position can be quickly determined, and then the target heat information can be quickly read.

[0121] In one embodiment, the data read request includes a cache build instruction. Based on the embodiment shown in FIG2 , this embodiment relates to a process of how the server obtains the target heat information corresponding to the target Key from a preset bitmap according to the cache build instruction. The method also includes: determining whether the cache build instruction indicates to build a cache item.

[0122] Among them, the cache building indication instruction is the indication information carried in the data read request. Optionally, the cache building indication instruction can indicate that a cache item corresponding to the target key in the data read request is built in the cache, or the cache building indication instruction can also indicate that a cache item corresponding to the target key in the data read request is not built in the cache.

[0123] In this embodiment, when receiving a data read request, the server may obtain a cache building instruction from the data read request, and then parse the cache building instruction, and determine whether to instruct to build a cache item according to the parsing result.

[0124] It can be understood that if the cache build instruction indicates that a cache item should not be built, then after receiving a data read request, the server can first search for the target Key from the cache. If found, the target Value is obtained from the corresponding cache item. If not found, the target Value is searched and obtained from the hard disk, and then the obtained target Value is returned.

[0125] Based on the server determining whether the cache construction instruction indicates to construct a cache item, the above step 203 may include: if the cache construction instruction indicates to construct a cache item, obtaining target heat information from a preset bitmap. Further, the server may determine whether to construct a cache item corresponding to the target Key in the cache according to the target heat information.

[0126] In this embodiment, the server can determine whether the cache build indication instruction in the data read request indicates to build a cache item, so that when the cache build indication instruction indicates to build a cache item, the server can obtain the target heat information from the preset bitmap, thereby avoiding the problem of increasing memory overhead when the cache build indication instruction in the data read request indicates not to build a cache item.

[0127] In one embodiment, a method for constructing cache data is provided for use in a computer device. As shown in FIG11 , the method comprises the following steps:

[0128] Step 801: receiving a data read request.

[0129] Step 802: Check whether the target Key included in the data read request exists in the cache.

[0130] Step 803, if the target Key exists in the cache, obtain the target Value from the cache.

[0131] Step 804: If the target Key does not exist in the cache, determine whether the cache building instruction indicates to build a cache item.

[0132] Step 805: If the cache building instruction indicates not to build a cache item, the target Vlaue is obtained from the hard disk.

[0133] Step 806: If the cache building instruction instructs to build a cache item, a hash operation is performed on the target Key to obtain a hash value corresponding to the target Key.

[0134] Step 807: determine the target location pointed to by the hash value in the preset bitmap.

[0135] Step 808, read the target heat value and the target heat attenuation value from the target position.

[0136] Step 809, determining whether the target heat value meets a preset condition.

[0137] Step 8010, if the target heat value does not meet the preset conditions, it is prohibited to build a cache item in the cache, and the target heat value is accumulated by 1, and the target heat decay value is increased to the target value.

[0138] Step 8011, if the target heat value meets the preset conditions, a cache item is constructed in the cache, and the target heat value is set from the first value to the second value.

[0139] Step 8012, search the hard disk to obtain the target Value corresponding to the target Key.

[0140] Step 8013, build a cache item in the cache according to the target Key and target Value.

[0141] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0142] Based on the same inventive concept, the embodiment of the present application also provides a cache data construction device for implementing the cache data construction method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in the one or more cache data construction device embodiments provided below can refer to the limitations of the cache data construction method above, and will not be repeated here.

[0143] In an exemplary embodiment, as shown in FIG12 , a cache data construction device is provided, including:

[0144] A query module 901 is used to receive a data read request and query whether a target key included in the data read request exists in the cache;

[0145] The acquisition module 902 is used to acquire target heat information corresponding to the target Key from a preset bitmap when the target Key does not exist in the cache, wherein the preset bitmap includes multiple heat information corresponding to multiple Keys;

[0146] The construction module 903 is used to determine whether to construct a cache item corresponding to the Key in the cache according to the target heat information.

[0147] In one embodiment, the target heat information includes a target heat value and a target heat attenuation value, and the construction module 903 includes:

[0148] A construction unit, configured to construct the cache item in the cache if the target heat value satisfies a preset condition;

[0149] An adjustment unit is used to prohibit the construction of the cache item in the cache if the target heat value does not meet the preset condition, and to adjust the target heat value and the target heat attenuation value respectively.

[0150] In one of the embodiments, the preset condition is that the target heat value is a first value, and the adjustment unit is specifically used to accumulate 1 to the target heat value to obtain an accumulated heat value, and the accumulated heat value is less than or equal to the first value;

[0151] The target heat decay value is increased to a target value, wherein the target value is a maximum value of the target heat decay values.

[0152] In one embodiment, if the target heat value meets a preset condition, the device further includes:

[0153] A setting module is used to set the target heat value from the first value to a second value, and the second value is smaller than the first value.

[0154] Optionally, the value range of the first value is related to the number of bits corresponding to the target heat value in the preset bitmap;

[0155] The value range of the target heat attenuation value is related to the number of bits corresponding to the target heat attenuation value in the preset bitmap.

[0156] In one of the embodiments, the construction unit is specifically used to search and obtain a target Value corresponding to the target Key from a hard disk;

[0157] The cache item is constructed in the cache according to the target Key and the target Value.

[0158] In one embodiment, the device further comprises:

[0159] A first processing device, used for reducing by 1 the heat decay value greater than the second value in the preset bitmap according to a preset time period;

[0160] The second processing device reduces by 1 the heat value corresponding to the heat attenuation value equal to the second value in the preset bitmap.

[0161] In one embodiment, the acquisition module 902 includes:

[0162] Perform a hash operation on the target Key to obtain a hash value corresponding to the target Key;

[0163] The target position pointed to by the hash value is determined in the preset bitmap, and the target heat information is read from the target position.

[0164] In one embodiment, the data read request includes a cache building instruction, and the device further includes:

[0165] A determination module, used to determine whether the cache building instruction indicates building a cache item;

[0166] The acquisition module 902 includes:

[0167] An acquisition unit is used to acquire the target heat information from the preset bitmap if the cache construction instruction indicates to build a cache item.

[0168] Each module in the above-mentioned cache data construction device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the server in the form of hardware, or can be stored in the memory in the server in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0169] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG13. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store heat value and heat attenuation value data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for constructing cache data is implemented.

[0170] Those skilled in the art will understand that the structure shown in FIG. 13 is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0171] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0172] Receive a data read request, and query the cache whether there is a target key included in the data read request;

[0173] In the case that the target Key does not exist in the cache, the target heat information corresponding to the target Key is obtained from a preset bitmap, wherein the preset bitmap includes multiple heat information corresponding to multiple Keys;

[0174] According to the target heat information, determine whether to build a cache item corresponding to the target Key in the cache.

[0175] In one embodiment, the processor implements the following steps when executing the computer program:

[0176] If the target heat value satisfies a preset condition, constructing the cache item in the cache;

[0177] If the target heat value does not meet the preset condition, it is prohibited to construct the cache item in the cache, and the target heat value and the target heat attenuation value are adjusted respectively.

[0178] In one embodiment, the processor implements the following steps when executing the computer program:

[0179] Add 1 to the target heat value to obtain an accumulated heat value, wherein the accumulated heat value is less than or equal to the first value;

[0180] The target heat decay value is increased to a target value, wherein the target value is a maximum value of the target heat decay values.

[0181] In one embodiment, the processor implements the following steps when executing the computer program:

[0182] The target heat value is set from the first value to a second value, wherein the second value is smaller than the first value.

[0183] Optionally, the value range of the first value is related to the number of bits corresponding to the target heat value in the preset bitmap;

[0184] The value range of the target heat attenuation value is related to the number of bits corresponding to the target heat attenuation value in the preset bitmap.

[0185] In one embodiment, the processor implements the following steps when executing the computer program:

[0186] Find the target value corresponding to the target Key from the hard disk;

[0187] The cache item is constructed in the cache according to the target Key and the target Value.

[0188] In one embodiment, the processor implements the following steps when executing the computer program:

[0189] According to a preset time period, the heat attenuation value in the preset bitmap that is greater than the second value is reduced by 1;

[0190] In the preset bitmap, the heat value corresponding to the heat attenuation value equal to the second value is reduced by 1.

[0191] In one embodiment, the processor implements the following steps when executing the computer program:

[0192] The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes:

[0193] Perform a hash operation on the target Key to obtain a hash value corresponding to the target Key;

[0194] The target position pointed to by the hash value is determined in the preset bitmap, and the target heat information is read from the target position.

[0195] In one embodiment, the processor further implements the following steps when executing the computer program:

[0196] The data read request includes a cache construction instruction. Before obtaining the target heat information corresponding to the target Key from the preset bitmap, the method further includes:

[0197] Determining whether the cache building instruction indicates building a cache item;

[0198] The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes:

[0199] If the cache building instruction instructs to build a cache item, the target heat information is obtained from the preset bitmap.

[0200] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0201] Receive a data read request, and query the cache whether there is a target key included in the data read request;

[0202] In the case that the target Key does not exist in the cache, the target heat information corresponding to the target Key is obtained from a preset bitmap, wherein the preset bitmap includes multiple heat information corresponding to multiple Keys;

[0203] According to the target heat information, determine whether to build a cache item corresponding to the target Key in the cache.

[0204] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0205] If the target heat value satisfies a preset condition, constructing the cache item in the cache;

[0206] If the target heat value does not meet the preset condition, it is prohibited to construct the cache item in the cache, and the target heat value and the target heat attenuation value are adjusted respectively.

[0207] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0208] Add 1 to the target heat value to obtain an accumulated heat value, wherein the accumulated heat value is less than or equal to the first value;

[0209] The target heat decay value is increased to a target value, wherein the target value is a maximum value of the target heat decay values.

[0210] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0211] The target heat value is set from the first value to a second value, wherein the second value is smaller than the first value.

[0212] Optionally, the value range of the first value is related to the number of bits corresponding to the target heat value in the preset bitmap;

[0213] The value range of the target heat attenuation value is related to the number of bits corresponding to the target heat attenuation value in the preset bitmap.

[0214] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0215] Find the target value corresponding to the target Key from the hard disk;

[0216] The cache item is constructed in the cache according to the target Key and the target Value.

[0217] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0218] According to a preset time period, the heat attenuation value in the preset bitmap that is greater than the second value is reduced by 1;

[0219] In the preset bitmap, the heat value corresponding to the heat attenuation value equal to the second value is reduced by 1.

[0220] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0221] The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes:

[0222] Perform a hash operation on the target Key to obtain a hash value corresponding to the target Key;

[0223] The target position pointed to by the hash value is determined in the preset bitmap, and the target heat information is read from the target position.

[0224] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0225] The data read request includes a cache construction instruction. Before obtaining the target heat information corresponding to the target Key from the preset bitmap, the method further includes:

[0226] Determining whether the cache building instruction indicates building a cache item;

[0227] The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes:

[0228] If the cache building instruction instructs to build a cache item, the target heat information is obtained from the preset bitmap.

[0229] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0230] Receive a data read request, and query the cache whether there is a target key included in the data read request;

[0231] In the case that the target Key does not exist in the cache, the target heat information corresponding to the target Key is obtained from a preset bitmap, wherein the preset bitmap includes multiple heat information corresponding to multiple Keys;

[0232] According to the target heat information, determine whether to build a cache item corresponding to the target Key in the cache.

[0233] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0234] If the target heat value satisfies a preset condition, constructing the cache item in the cache;

[0235] If the target heat value does not meet the preset condition, it is prohibited to construct the cache item in the cache, and the target heat value and the target heat attenuation value are adjusted respectively.

[0236] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0237] Add 1 to the target heat value to obtain an accumulated heat value, wherein the accumulated heat value is less than or equal to the first value;

[0238] The target heat decay value is increased to a target value, wherein the target value is a maximum value of the target heat decay values.

[0239] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0240] The target heat value is set from the first value to a second value, wherein the second value is smaller than the first value.

[0241] Optionally, the value range of the first value is related to the number of bits corresponding to the target heat value in the preset bitmap;

[0242] The value range of the target heat attenuation value is related to the number of bits corresponding to the target heat attenuation value in the preset bitmap.

[0243] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0244] Find the target value corresponding to the target Key from the hard disk;

[0245] The cache item is constructed in the cache according to the target Key and the target Value.

[0246] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0247] According to a preset time period, the heat attenuation value in the preset bitmap that is greater than the second value is reduced by 1;

[0248] In the preset bitmap, the heat value corresponding to the heat attenuation value equal to the second value is reduced by 1.

[0249] In one embodiment, when the computer program is executed by a processor, the following steps are specifically implemented:

[0250] The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes:

[0251] Perform a hash operation on the target Key to obtain a hash value corresponding to the target Key;

[0252] The target position pointed to by the hash value is determined in the preset bitmap, and the target heat information is read from the target position.

[0253] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0254] The data read request includes a cache construction instruction. Before obtaining the target heat information corresponding to the target Key from the preset bitmap, the method further includes:

[0255] Determining whether the cache building instruction indicates building a cache item;

[0256] The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes:

[0257] If the cache building instruction instructs to build a cache item, the target heat information is obtained from the preset bitmap.

[0258] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0259] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0260] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0261] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for constructing cache data, characterized in that: The method comprises: Receive a data read request, and query the cache whether there is a target key included in the data read request; In the case that the target Key does not exist in the cache, the target heat information corresponding to the target Key is obtained from a preset bitmap, wherein the preset bitmap includes multiple heat information corresponding to multiple Keys; According to the target heat information, determine whether to build a cache item corresponding to the target Key in the cache.

2. The method according to claim 1, characterized in that The target heat information includes a target heat value and a target heat attenuation value, and determining whether to construct a cache item corresponding to the target Key in the cache according to the target heat information includes: If the target heat value satisfies a preset condition, constructing the cache item in the cache; If the target heat value does not meet the preset condition, it is prohibited to construct the cache item in the cache, and the target heat value and the target heat attenuation value are adjusted respectively.

3. The method according to claim 2, characterized in that The preset condition is that the target heat value is a first value, and the target heat value and the target heat attenuation value are adjusted respectively, including: Add 1 to the target heat value to obtain an accumulated heat value, wherein the accumulated heat value is less than or equal to the first value; The target heat decay value is increased to a target value, wherein the target value is a maximum value of the target heat decay values.

4. The method according to claim 3, characterized in that: If the target heat value meets a preset condition, the method further includes: The target heat value is set from the first value to a second value, wherein the second value is smaller than the first value.

5. The method according to claim 4, characterized in that The value range of the first value is related to the number of bits corresponding to the target heat value in the preset bitmap; The value range of the target heat attenuation value is related to the number of bits corresponding to the target heat attenuation value in the preset bitmap.

6. The method according to claim 2, characterized in that The step of constructing the cache item in the cache includes: Find the target value corresponding to the target Key from the hard disk; The cache item is constructed in the cache according to the target Key and the target Value.

7. The method according to claim 4, characterized in that The method further comprises: According to a preset time period, the heat attenuation value in the preset bitmap that is greater than the second value is reduced by 1; In the preset bitmap, the heat value corresponding to the heat attenuation value equal to the second value is reduced by 1.

8. The method according to claim 1, characterized in that The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes: Perform a hash operation on the target Key to obtain a hash value corresponding to the target Key; The target position pointed to by the hash value is determined in the preset bitmap, and the target heat information is read from the target position.

9. The method according to claim 1, characterized in that: The data read request includes a cache construction instruction. Before obtaining the target heat information corresponding to the target Key from the preset bitmap, the method further includes: Determining whether the cache building instruction indicates building a cache item; The step of obtaining target heat information corresponding to the target Key from a preset bitmap includes: If the cache building instruction instructs to build a cache item, the target heat information is obtained from the preset bitmap.

10. A device for constructing cache data, characterized in that: The device comprises: A query module, used to receive a data read request and query whether a target key included in the data read request exists in the cache; An acquisition module, used for acquiring target heat information corresponding to the target Key from a preset bitmap when the target Key does not exist in the cache, wherein the preset bitmap includes multiple heat information corresponding to multiple Keys; A construction module is used to determine whether to construct a cache item corresponding to the Key in the cache according to the target heat information.

11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 9 are implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.