Data access method, device, equipment and storage medium
By partitioning the disk and cache and selecting storage locations based on data volume, the trade-off between performance and cost in caching systems is resolved, achieving efficient data access and retrieval while reducing hardware costs.
Patent Information
- Application Number
- CN202111434099.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-29
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2041-11-29
AI Technical Summary
Existing caching systems such as Redis and LevelDB struggle to balance performance and cost. Redis consumes a lot of memory and has low single-threaded processing efficiency, while LevelDB has poor read performance and cannot meet high concurrency requirements.
The disk and cache are divided into a preset number of partitions. Data is stored in the cache temporary area or disk data area using hash value partitioning sequences. The storage location is selected according to the data size, and management information is generated to ensure data recovery and query efficiency.
While ensuring database performance, it reduced hardware costs, improved data access and query efficiency, and reduced frequent disk operations.
Smart Images

Figure CN114090637B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a data access method, device, equipment and storage medium. Background Art
[0002] In order to improve performance and concurrency, most backend services will cache commonly used and infrequently changed data. Retrieving data from the cache is much faster than retrieving data from a relational database. Common cache tools on the market include redis, leveldb, etc. The redis database is a pure memory database that stores all data in memory. However, computer memory is expensive, and the memory space is relatively small compared to the disk. In addition, the redis database uses a single thread to process requests, and the CPU utilization rate on the computer is not high. The Leveldb database is a layered design adopted by Google, which puts the latest data in the front layer. Reading data requires querying each layer, and the performance is poor. It is suitable for scenarios with more writes and fewer reads. They all have different shortcomings and cannot strike a good balance between performance and cost. Summary of the invention
[0003] The main purpose of this application is to provide a data access method, device, equipment and storage medium, aiming to ensure database performance while reducing hardware costs.
[0004] In a first aspect, the present application provides a data access method, comprising:
[0005] When receiving a partition instruction, the disk and cache are divided into a preset number of partitions, wherein each cache partition includes a cache temporary area and a cache resident area, and each disk partition includes a management area, a data area, and a recycling area;
[0006] When receiving a data storage instruction, obtaining a storage keyword and a storage key value corresponding to the storage keyword according to the data storage instruction;
[0007] Determine the hash value corresponding to the storage keyword as a target hash value, and modulo the preset value according to the target hash value to obtain a target partition sequence;
[0008] Acquire a target disk partition and a target cache partition according to the target partition sequence, determine a target management area, a target data area and a target reclaim area according to the target disk partition, and determine a target cache temporary area and a target cache resident area according to the target cache partition;
[0009] Determining whether the amount of stored data corresponding to the storage key value is greater than a first value;
[0010] If the amount of stored data is less than or equal to the first value, storing the storage keyword and the storage key value in the target cache temporary area;
[0011] If the amount of stored data is greater than the first value, the storage keyword and the storage key value are stored in the target data area, and management information is generated based on the storage keyword and the storage key value, and the management information is stored in the target cache resident area and the target management area.
[0012] In a second aspect, the present application further provides a data access device, the data access device comprising:
[0013] A partitioning module, for dividing the disk and cache into a preset number of partitions upon receiving a partitioning instruction, wherein each cache partition includes a cache temporary area and a cache resident area, and each disk partition includes a management area, a data area, and a recycling area;
[0014] A storage instruction receiving module, configured to, upon receiving a data storage instruction, obtain a storage keyword and a storage key value corresponding to the storage keyword according to the data storage instruction;
[0015] A partition sequence acquisition module, used to determine the hash value corresponding to the storage keyword as a target hash value, and modulo the preset value according to the target hash value to obtain a target partition sequence;
[0016] A partition acquisition module, used to acquire a target disk partition and a target cache partition according to the target partition sequence, and determine a target management area, a target data area and a target reclaim area according to the target disk partition, and determine a target cache temporary area and a target cache resident area according to the target cache partition;
[0017] A judgment module, used to judge whether the amount of stored data corresponding to the storage key value is greater than a first value;
[0018] A first storage module, configured to store the storage keyword and the storage key value in the target cache temporary area if the storage data amount is less than or equal to the first value;
[0019] A second storage module is used to store the storage keyword and the storage key value in the target data area if the amount of stored data is greater than the first value, generate management information based on the storage keyword and the storage key value, and store the management information in the target cache resident area and the target management area.
[0020] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the data access method as described above are implemented.
[0021] In a fourth aspect, the present application further provides a storage medium, wherein the computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the data access method as described above are implemented.
[0022] The present application provides a data access method, device, equipment and storage medium. In the present application, when a partition instruction is received, the disk and cache are divided into a preset number of partitions; when a data storage instruction is received, the target disk partition and the target cache partition are obtained according to the hash value corresponding to the storage keyword; if the amount of storage data corresponding to the storage key value is less than or equal to the first value, the storage keyword and the storage key value are stored in the target cache temporary area corresponding to the target cache partition; otherwise, the storage keyword and the storage key value are stored in the target data area corresponding to the target disk partition, and the corresponding management information is generated and stored. Through the technical solution provided by the present application, the hardware cost is reduced while ensuring the database performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 A schematic diagram of a data access method provided in an embodiment of the present application;
[0025] Figure 2 A schematic block diagram of a data access device provided in an embodiment of the present application;
[0026] Figure 3 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application.
[0027] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0028] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0029] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor do they have to be executed in the order described. For example, some operations / steps can also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions. In addition, although the functional modules are divided in the device schematic, in some cases, the module division can be different from that in the device schematic.
[0030] The embodiments of the present application provide a data access method, device, equipment and storage medium. The data access method can be applied to a terminal device or a server, and the terminal device can be an electronic device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant and a wearable device; the server can be a single server or a server cluster composed of multiple servers. The following explanation is given by taking the application of the data access method to a server as an example.
[0031] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0032] Please refer to Figure 1 , Figure 1 A schematic diagram of the steps of a data access method provided in an embodiment of the present application.
[0033] like Figure 1 As shown, the data access method includes steps S10 to S16.
[0034] Step S10: upon receiving a partition instruction, the disk and cache are divided into a preset number of partitions, wherein each cache partition includes a cache temporary area and a cache resident area, and each disk partition includes a management area, a data area, and a recycling area.
[0035] It is understood that if the subject executing this application is a server, when a partition instruction is received, it will trigger the server to divide the disk space into a preset number of partitions, and the cache space will also be divided into a preset number of partitions. Each disk partition has a cache partition working with it. In some embodiments, the cache referred to in this application is the cache in the memory bar.
[0036] Each cache partition is divided into two sub-areas, namely, the cache temporary area and the cache resident area. The cache temporary area is a cache partition used to store temporary data, while the cache resident area is a cache partition used to store resident data. Specifically, the cache resident area is used to store management information.
[0037] Each disk partition is divided into three sub-areas, namely the management area, the data area, and the recycling area. The data stored in the management area is the same as the data stored in the cache resident area. The difference is that the data in the management area is stored on the disk, while the data in the cache resident area is stored in the cache. When the amount of data corresponding to the stored data meets certain conditions, such as when the storage space is greater than 1MB, the stored data will be stored in the storage file of the data area. The recycling area is used to record the storage space occupied by the old data of the recyclable storage space in each storage file of the data area.
[0038] In some implementations, the preset value is an exponential power of 2, and can be 4, 8, 16, 32, etc., for example, without limitation. It can be understood that setting the preset value to an exponential power of 2 can improve data access efficiency and facilitate subsequent partition expansion operations.
[0039] Step S11: upon receiving a data storage instruction, obtaining a storage keyword and a storage key value corresponding to the storage keyword according to the data storage instruction.
[0040] It can be understood that the data storage instruction is a data writing instruction, and the data storage instruction includes a storage keyword and a storage key value, wherein the storage keyword is the key, and the storage key value is the value corresponding to the key.
[0041] For example, assume that the data storage instruction includes the following data information: {"name":"ABC"}. Then in the data storage instruction, "name" is the key and "ABC" is the value.
[0042] Step S12: determine the hash value corresponding to the storage keyword as a target hash value, and modulo the preset value according to the target hash value to obtain a target partition sequence.
[0043] It can be understood that the target partition sequence is a value obtained by modulo the preset value of the target hash value, which is used to match the storage partition. Matching the storage partition according to the target hash value can make the storage data more evenly distributed to each storage partition.
[0044] Exemplarily, assuming that the preset value is 32 and the hash value corresponding to the storage keyword is 51, then 51 modulo 32 is used to obtain a target partition sequence of 19.
[0045] Step S13, acquiring a target disk partition and a target cache partition according to the target partition sequence, and determining a target management area, a target data area and a target reclaim area according to the target disk partition, and determining a target cache temporary area and a target cache resident area according to the target cache partition.
[0046] It can be understood that after step S10, the disk is divided into a preset number of disk partitions, and the cache is divided into a preset number of cache partitions. Obtaining disk partitions according to the target partition sequence is to obtain target disk partitions, and correspondingly, obtaining cache partitions according to the target partition sequence is to obtain target cache partitions.
[0047] The management area in the target disk partition is the target management area, the data area in the target disk partition is the target data area, and the recycle area in the target disk partition is the target recycle area. Similarly, the cache temporary area in the target cache partition is the target cache temporary area, and the cache resident area in the target cache partition is the target cache resident area.
[0048] Exemplarily, assuming that the preset value is 32 and the target partition sequence is 19, the 19th disk partition is obtained from the 32 disk partitions as the target storage partition, and the 19th cache partition is obtained from the 32 cache partitions as the target cache partition.
[0049] Step S14: Determine whether the amount of stored data corresponding to the storage key value is greater than a first value.
[0050] It can be understood that the storage data volume refers to the storage space required for storing the key value when storing the key value.
[0051] In some implementations, the first value is set to 1MB, and may also be set to 2MB, 3MB, etc., or may be set as required, and is not limited here.
[0052] Step S15: If the amount of stored data is less than or equal to the first value, the storage keyword and the storage key value are stored in the target cache temporary area.
[0053] It can be understood that the access efficiency of data in the cache is higher than that in the disk. Accordingly, the hardware that provides cache space is the memory bar, and the hardware that provides disk space is the disk. Under the same storage space, the hardware cost of the memory bar is higher than the hardware cost of the disk.
[0054] It is understandable that in a certain storage space, more data with a small amount of data can be stored compared to data with a large amount of data. If the amount of data corresponding to the storage key value is not greater than the first value, it can be considered that the storage key value is data with a small amount of data. At this time, the storage keyword and the storage key value are stored in the target cache temporary area.
[0055] Through the implementation method provided by the present application, the target cache temporary area can store more small data, thereby avoiding frequent writing of data to the disk and improving data storage efficiency.
[0056] Step S16: If the amount of stored data is greater than the first value, the storage keyword and the storage key value are stored in the target data area, and management information is generated based on the storage keyword and the storage key value, and the management information is stored in the target cache resident area and the target management area.
[0057] It can be understood that if the amount of data corresponding to the storage key value is greater than the first value, the storage key value can be considered to be data with a large amount of data. At this time, the storage keyword and the storage key value need to be stored in the target data area. In addition, the corresponding generated management information includes information such as the storage location of the target data area corresponding to the storage keyword and the storage key value.
[0058] The management information is stored in the target cache resident area and the target management area at the same time. When the device has power failure, downtime, etc., resulting in the loss of data in the target cache resident area, the target cache resident area can also restore data through the target management area. In addition, when data needs to be queried, the management information can be obtained from the target cache resident area, and the corresponding data can be obtained from the disk through the management information. The technical solution provided by this embodiment can improve the efficiency of data query.
[0059] In some implementations, storing the management information in the target cache resident area and the target management area includes:
[0060] Determining the storage capacity of the target cache resident area as a target resident capacity;
[0061] Taking the modulus of the target resident capacity according to the target hash value to obtain a target storage address;
[0062] The management information is stored in the target cache resident area and the target management area at storage locations corresponding to the target storage address respectively.
[0063] It can be understood that the storage capacity of the target cache resident area, that is, the storage space size of the target cache resident area, is the sum of the used storage space and the unused storage space of the target cache resident area.
[0064] The target storage address is obtained by taking the modulus of the target resident capacity according to the hash value corresponding to the storage keyword. The management information is stored in the storage location of the target cache resident area and the target management area corresponding to the target storage address respectively. When data needs to be queried, the query address can also be matched according to the hash value corresponding to the query keyword, and the data can be queried from the location corresponding to the target cache resident area according to the query address. Through the technical solution corresponding to this embodiment, when querying data, there is no need to traverse the target cache resident area from the beginning to query, which can improve data query efficiency.
[0065] In some embodiments, if data is already stored in the target cache resident area and the target management area corresponding to the target storage address, it is determined whether the next storage address of the target storage address stores data, and the cycle is repeated until an address without stored data is matched, and management information is stored at the address.
[0066] In some embodiments, the method further comprises:
[0067] Determine the remaining storage capacity of the target cache temporary area as the remaining temporary capacity;
[0068] When the remaining temporary capacity is less than a second value, selecting a temporary keyword and a temporary key value corresponding to the temporary keyword from temporary data in the target cache temporary area;
[0069] Concatenate the temporary keyword and the temporary key value to obtain a first record result, and determine the storage data volume corresponding to the first record result as a first data volume;
[0070] According to the storage status information of the target data area, configuring the temporary keyword and the storage file of the temporary key value, and determining that the storage path corresponding to the storage file is a matching storage path;
[0071] Obtaining a temporary check value corresponding to the temporary key value according to a preset algorithm, wherein the temporary check value is used to check the temporary key value;
[0072] The temporary keyword, the matching storage path, the temporary check value and the first data volume are concatenated to obtain a second record result, and the storage data volume corresponding to the second record result is determined as a second data volume;
[0073] When the first data amount is less than or equal to the second data amount, determining that the first record result is the management information of the temporary keyword and the temporary key value;
[0074] The first recording result is stored in the target cache resident area and the target management area.
[0075] It is understood that the remaining storage space of the target cache temporary area is the remaining temporary capacity. When the remaining temporary capacity of the target cache temporary area is less than the second value, the data stored in the target cache temporary area needs to be stored in the target cache resident area and the target disk partition, and the data in the target cache temporary area needs to be cleared.
[0076] In some implementations, the second value may be set to 1MB or 0.5MB, or may be set to other values according to the capacity of the target cache temporary area, which is not limited here.
[0077] Specifically, it is necessary to select keywords and key values one by one from the temporary data in the target cache temporary area for processing. The currently selected keyword to be processed is the temporary keyword, and the key value corresponding to the temporary keyword is the temporary key value.
[0078] The temporary keyword and the temporary key value are concatenated to obtain a concatenated result, which is the first record result. The storage space required to store the first record result is the first data volume.
[0079] It can be understood that the target data area stores keywords and key values by constructing storage files, and the size of the storage space allocated to each storage file in the target data area is the same. Only when the storage space of the last storage file in the target data area cannot continue to store new data because a large amount of data has been stored, a new storage file will be created to store keywords and key values. For example, assuming that the target data area has two storage files A and B, and the storage space allocated to each storage file in the target data area is 10MB, then file B is created after file A is full of data.
[0080] In addition, the target data area is provided with a corresponding record file, which records the storage status information of the target data area, such as how much storage space is left in the last storage file. Through the storage status information, it can be determined whether the last storage file in the target data area is sufficient to accommodate the target keyword and the target key value. If it cannot accommodate, a new storage file is created and used as the last storage file in the target data area. The file path corresponding to the storage file storing the target keyword and the target key value is the matching storage path.
[0081] In some implementations, the preset algorithm may be an md5 encryption algorithm or other algorithms, and a check value corresponding to the temporary key value, i.e., a temporary check value, may be obtained by using the preset algorithm. The temporary check value may be used to check whether the temporary key value corresponding to the temporary keyword has been changed.
[0082] The second record result records the temporary keyword, the matching storage path, the temporary check value and the first data volume, and the storage space required to store the second record result, that is, the second data volume. It can be understood that if the data volume of the target key value is small enough, the first data volume will be smaller than the second data volume. At this time, the first record result is determined to be the temporary keyword and the management information of the temporary key value, and the first record result, that is, the management information of the temporary keyword and the temporary key value, is stored in the target cache resident area and the target management area.
[0083] Through the technical solution provided by this embodiment, if the data volume of the target key value is small enough, when querying data and matching and obtaining management information, the corresponding key value can be directly obtained from the management information.
[0084] In some embodiments, the method further comprises:
[0085] When the first data volume is greater than the second data volume, determining that the second record result is the temporary keyword and the management information of the temporary key value;
[0086] According to the matching storage path, storing the first record result in the target data area;
[0087] The second recording result is stored in the target cache resident area and the target management area.
[0088] It can be understood that if the data volume of the target key value is too large, the first data volume will be larger than the second data volume. At this time, the second record result is determined to be the temporary key and the management information of the temporary key value, and the second record result, that is, the management information of the temporary key and the temporary key value, is stored in the target cache resident area and the target management area. At the same time, according to the matching storage path, the first record result is stored in the position corresponding to the target data area;
[0089] Through the technical solution provided by this embodiment, when querying data, after obtaining the corresponding second record result according to the query keyword, the corresponding storage file can be obtained according to the matching storage path in the second record result to obtain the first record result corresponding to the query keyword from the storage file, and obtain the key value of the corresponding query keyword from the first record result.
[0090] It can be understood that no matter it is the first recording result or the second recording result, the corresponding data volume will be very small, so the target cache resident area can store a large amount of management information.
[0091] In some embodiments, the method further comprises:
[0092] When receiving a data query instruction, obtaining a query keyword from the data query instruction;
[0093] Determine the hash value corresponding to the query keyword as the query hash value, and modulo the preset value according to the query hash value to obtain a query partition sequence;
[0094] Acquire the query disk partition and the query cache partition according to the query partition sequence;
[0095] Determine a query management area, a query data area, and a query recycle area according to the query disk partition, and determine a query cache temporary area and a query cache resident area according to the query cache partition;
[0096] Determining whether the query cache temporary area stores a query key value corresponding to the query keyword;
[0097] If the query cache temporary area stores the query key value, returning the query key value;
[0098] If the query key value is not stored in the query cache temporary area, query management information matching the query keyword is obtained from the query cache permanent area, and the query key value is obtained according to the query management information.
[0099] It can be understood that a query keyword is set in the data query instruction. After obtaining the query keyword, the corresponding disk partition and cache partition can be matched according to the hash value of the query keyword, that is, querying the disk partition and querying the cache partition. Among them, querying the management area in the disk partition is querying the management area, querying the data area in the disk partition is querying the data area, and querying the recycling area in the disk partition is querying the recycling area. Similarly, querying the cache temporary area in the cache partition is querying the cache temporary area, and querying the cache resident area in the cache partition is querying the cache resident area.
[0100] In addition, because when storing keywords and key values, if the amount of data corresponding to the key value is less than or equal to the first value, the keywords and key values will be stored in the temporary cache area first. That is, when receiving a data query instruction, the query keyword and the query key value may still be stored in the query cache temporary area. Then first query the data in the query cache temporary area. If no data is found, then query the cache resident area to obtain management information matching the query keyword, that is, query management information. By querying the management information, the query key value corresponding to the query keyword can be obtained.
[0101] It can be understood that the speed of reading data from the cache is higher than that of reading data from the disk. In this embodiment, whether directly obtaining the query key value from the query cache temporary area or obtaining the query management information from the query cache resident area, it belongs to reading data from the cache. The technical solution provided by this embodiment can improve the efficiency of data query.
[0102] In some embodiments, the method further comprises:
[0103] When receiving a data update instruction, obtaining an update keyword and an update key value corresponding to the update keyword from the data update instruction;
[0104] Determine the hash value corresponding to the update keyword as the update hash value, and modulo the preset value according to the update hash value to obtain an update partition sequence;
[0105] Acquire update disk partitions and update cache partitions according to the update partition sequence;
[0106] Determine an update management area, an update data area, and an update recycling area according to the update disk partition, and determine an update cache temporary area and an update cache resident area according to the update cache partition;
[0107] According to the update key value, updating the data information corresponding to the update key in the update cache temporary area;
[0108] When the update cache temporary area does not store data information corresponding to the update keyword, acquiring first management information matching the update keyword from the update cache permanent area;
[0109] updating the update reclaim area according to the first management information, and removing the first management information from the update management area and the update cache resident area;
[0110] Determining whether the amount of stored data corresponding to the update key value is greater than the first value;
[0111] If the amount of stored data corresponding to the update key value is less than or equal to the first value, storing the update keyword and the update key value in the update cache temporary area;
[0112] If the amount of stored data corresponding to the update key value is greater than the first value, the update keyword and the update key value are stored in the update data area, and second management information is generated based on the update keyword and the update key value, and the second management information is stored in the update cache resident area and the update management area.
[0113] It can be understood that the data update instruction is provided with an update keyword and an update key value. After obtaining the update keyword, the corresponding disk partition and cache partition can be matched according to the hash value of the update keyword, that is, the disk partition and the cache partition are updated. Among them, the management area in the updated disk partition is the updated management area, the data area in the updated disk partition is the updated data area, and the recycling area in the updated disk partition is the updated recycling area. Similarly, the cache temporary area in the updated cache partition is the updated cache temporary area, and the cache resident area in the updated cache partition is the updated cache resident area.
[0114] It can be understood that if data information corresponding to the update key is stored in the update cache temporary area, the data update can be completed by setting the key value of the data information as the update key value.
[0115] In addition, if the data information corresponding to the update keyword is not stored in the update cache temporary area, the management information corresponding to the update keyword previously stored is obtained from the update cache permanent area, that is, the first management information. If the first management information is provided with a matching storage path, and a first data volume corresponding to the original keyword and the key value, the matching storage path and the first data volume are recorded in the update recovery area. After being recorded in the update recovery area, the first management information has no value. At this time, the first management information needs to be removed from the update management area and the update cache permanent area to release the storage space of the update management area and the update cache permanent area. After removing the first management information, the process of executing the update data is the same as the process of storing the data. For details, please refer to steps S14 to S16.
[0116] It can be understood that when a data update instruction is received, the old data of the storage files in the updated data area will not be directly removed. Instead, the reclaimable space of each storage file is recorded in the update recovery area. When the storage files meet certain conditions, the old data will be removed uniformly. The technical solution provided by this embodiment can reduce the frequency of disk operations and improve data update efficiency.
[0117] In some embodiments, the method further comprises:
[0118] When receiving a data deletion instruction, obtaining a deletion keyword from the data deletion instruction;
[0119] Determine the hash value corresponding to the deletion keyword as the deletion hash value, and modulo the preset value according to the deletion hash value to obtain a deletion partition sequence;
[0120] Acquire and delete disk partition and delete cache partition according to the partition deletion sequence;
[0121] Deleting a management area, a data area, and a recycling area according to deleting the disk partition, and deleting a cache temporary area and a cache resident area according to deleting the cache partition;
[0122] Removing data information corresponding to the deletion keyword from the deletion cache temporary area;
[0123] When the deletion cache temporary area does not store data information corresponding to the deletion keyword, acquiring deletion management information matching the deletion keyword from the deletion cache permanent area;
[0124] updating the deletion recovery area according to the deletion management information, and removing the deletion management information from the deletion management area and the deletion cache resident area;
[0125] It can be understood that the processing process for the data deletion instruction is basically the same as the processing process for the first half of the data update instruction, and will not be described in detail here.
[0126] In some embodiments, the method further comprises:
[0127] Periodically checking the recycling areas corresponding to the disk partitions, and selecting the recycling areas whose recycling record information meets preset conditions from the recycling areas as the execution recycling areas;
[0128] Determine that the disk partition to which the execution recovery area belongs is a recovery disk partition, and determine that the cache partition corresponding to the recovery disk partition is a recovery cache partition;
[0129] Setting the reclaimed disk partition and the reclaimed cache partition to a locked state;
[0130] Acquire the data area corresponding to the recovered disk partition as the recovered data area;
[0131] According to the recycling record information of the execution recycling area, merging the stored data in the recycling data area;
[0132] When the merging process is completed, the reclaimed disk partition and the reclaimed cache partition are set to an unlocked state.
[0133] It is understandable that when receiving the data update instruction and the data deletion instruction, the old data stored in the storage file in the data area will not be directly deleted. Instead, the storage path corresponding to the storage file storing the old data and the data volume of the old data will be recorded in the recycling record information of the recycling area.
[0134] When periodically checking the recycling area corresponding to each disk partition, if it is found that the recycling record information of the recycling area meets the preset conditions, the recycling area is confirmed as the execution recycling area. Correspondingly, the disk partition containing the execution recycling area is the recycling disk partition. In addition, the cache partition corresponding to the recycling disk partition is the recycling cache partition, the data area of the recycling disk partition is the recycling data area, and the management area of the recycling disk partition is the recycling management area.
[0135] Before merging the storage data in the recovered data area according to the recovery record information of the execution recovery area, it is necessary to set the recovered disk partition and the recovered cache partition to a locked state. At this time, the recovered disk partition and the recovered cache partition cannot read or write data. When the merging process is completed, the recovery disk partition and the recovered cache partition are unlocked. In this way, it is possible to avoid reading and writing data during the recovery process, which may disrupt the data recovery process or even cause data errors.
[0136] When performing the merging process, the storage files that perform the recycling operation are screened according to the recycling record information in the recycling area, and the verification values corresponding to the key values of the storage files are verified with the corresponding management information in the recycling cache partition. When the verification fails, it means that the key value is old data, and the old data is deleted.
[0137] In the process of deleting old data in the storage file, the storage space at the corresponding position of the storage file is released. At this time, the storage files that perform the recycling operation are merged, and the storage space is reallocated to the storage data in the storage file. Through the merging process, multiple storage files can be merged into a few storage files.
[0138] Meanwhile, during the merging process, the storage location corresponding to the storage data in the storage file changes, and the management information of the recycling cache partition and the recycling management area needs to be updated.
[0139] In some implementations, the preset condition may be: if there are more than 5 storage files in the data area and the reclaimable space corresponding to the files exceeds 20%, in this case, at least 5 storage files may be merged into 4 storage files. It is understood that in this implementation, the data area will be triggered to perform data merging processing only when the recycling record information in the recycling area meets the preset condition. Through the technical solution provided by this implementation, while ensuring a good recycling effect, it is possible to avoid frequent execution of the data recycling process and reduce the resource occupation of the data access system.
[0140] In the present application, when a partition instruction is received, the disk and cache are divided into a preset number of partitions; when a data storage instruction is received, the target disk partition and the target cache partition are obtained according to the hash value corresponding to the storage keyword; if the amount of storage data corresponding to the storage key value is less than or equal to the first value, the storage keyword and the storage key value are stored in the target cache temporary area corresponding to the target cache partition; otherwise, the storage keyword and the storage key value are stored in the target data area corresponding to the target disk partition, and the corresponding management information is generated and stored. Through the technical solution provided by the present application, the hardware cost is reduced while ensuring the database performance.
[0141] Please refer to Figure 2 , Figure 2 A schematic block diagram of a data access device provided in an embodiment of the present application.
[0142] like Figure 2 As shown, the data access device 201 includes:
[0143] The partition module 2011 is used to divide the disk and cache into a preset number of partitions upon receiving a partition instruction, wherein each cache partition includes a cache temporary area and a cache resident area, and each disk partition includes a management area, a data area, and a recycling area;
[0144] A storage instruction receiving module 2012 is used to obtain a storage keyword and a storage key value corresponding to the storage keyword according to the data storage instruction when receiving the data storage instruction;
[0145] A partition sequence acquisition module 213 is used to determine the hash value corresponding to the storage keyword as a target hash value, and modulo the preset value according to the target hash value to obtain a target partition sequence;
[0146] A partition acquisition module 2014 is used to acquire a target disk partition and a target cache partition according to the target partition sequence, and determine a target management area, a target data area and a target reclaim area according to the target disk partition, and determine a target cache temporary area and a target cache resident area according to the target cache partition;
[0147] A determination module 215 is used to determine whether the amount of stored data corresponding to the storage key value is greater than a first value;
[0148] A first storage module 2016, configured to store the storage keyword and the storage key value in the target cache temporary area if the storage data amount is less than or equal to the first value;
[0149] The second storage module 2017 is used to store the storage keyword and the storage key value in the target data area if the storage data volume is greater than the first value, generate management information based on the storage keyword and the storage key value, and store the management information in the target cache resident area and the target management area.
[0150] In some implementations, when the second storage module 2017 stores the management information in the target cache resident area and the target management area, the second storage module 2017 includes:
[0151] Determining the storage capacity of the target cache resident area as a target resident capacity;
[0152] Taking the modulus of the target resident capacity according to the target hash value to obtain a target storage address;
[0153] The management information is stored in the target cache resident area and the target management area at storage locations corresponding to the target storage address respectively.
[0154] In some implementations, the data access device 201 further includes a first temporary data module 2018, which is used to determine the remaining storage capacity of the target cache temporary area as the remaining temporary capacity;
[0155] When the remaining temporary capacity is less than a second value, selecting a temporary keyword and a temporary key value corresponding to the temporary keyword from temporary data in the target cache temporary area;
[0156] Concatenate the temporary keyword and the temporary key value to obtain a first record result, and determine the storage data volume corresponding to the first record result as a first data volume;
[0157] According to the storage status information of the target data area, configuring the temporary keyword and the storage file of the temporary key value, and determining that the storage path corresponding to the storage file is a matching storage path;
[0158] Obtaining a temporary check value corresponding to the temporary key value according to a preset algorithm, wherein the temporary check value is used to check the temporary key value;
[0159] The temporary keyword, the matching storage path, the temporary check value and the first data volume are concatenated to obtain a second record result, and the storage data volume corresponding to the second record result is determined as a second data volume;
[0160] When the first data amount is less than or equal to the second data amount, determining that the first record result is the management information of the temporary keyword and the temporary key value;
[0161] The first recording result is stored in the target cache resident area and the target management area.
[0162] In some embodiments, the data access device 201 further includes a second temporary data module 2019, which is used to determine that the second record result is the temporary keyword and the management information of the temporary key value when the first data amount is greater than the second data amount;
[0163] According to the matching storage path, storing the first record result in the target data area;
[0164] The second recording result is stored in the target cache resident area and the target management area.
[0165] In some implementations, the data access device 201 further includes a query module 2020, which is used to obtain a query keyword from the data query instruction when receiving the data query instruction;
[0166] Determine the hash value corresponding to the query keyword as the query hash value, and modulo the preset value according to the query hash value to obtain a query partition sequence;
[0167] Acquire the query disk partition and the query cache partition according to the query partition sequence;
[0168] Determine a query management area, a query data area, and a query recycle area according to the query disk partition, and determine a query cache temporary area and a query cache resident area according to the query cache partition;
[0169] Determining whether the query cache temporary area stores a query key value corresponding to the query keyword;
[0170] If the query cache temporary area stores the query key value, returning the query key value;
[0171] If the query key value is not stored in the query cache temporary area, query management information matching the query keyword is obtained from the query cache permanent area, and the query key value is obtained according to the query management information.
[0172] In some implementations, the data access device 201 further includes an updating module 2021, which is used to obtain an update keyword and an update key value corresponding to the update keyword from the data update instruction when receiving the data update instruction;
[0173] Determine the hash value corresponding to the update keyword as the update hash value, and modulo the preset value according to the update hash value to obtain an update partition sequence;
[0174] Acquire update disk partitions and update cache partitions according to the update partition sequence;
[0175] Determine an update management area, an update data area, and an update recycling area according to the update disk partition, and determine an update cache temporary area and an update cache resident area according to the update cache partition;
[0176] According to the update key value, updating the data information corresponding to the update key in the update cache temporary area;
[0177] When the update cache temporary area does not store data information corresponding to the update keyword, acquiring first management information matching the update keyword from the update cache permanent area;
[0178] updating the update reclaim area according to the first management information, and removing the first management information from the update management area and the update cache resident area;
[0179] Determining whether the amount of stored data corresponding to the update key value is greater than the first value;
[0180] If the amount of stored data corresponding to the update key value is less than or equal to the first value, storing the update keyword and the update key value in the update cache temporary area;
[0181] If the amount of stored data corresponding to the update key value is greater than the first value, the update keyword and the update key value are stored in the update data area, and second management information is generated based on the update keyword and the update key value, and the second management information is stored in the update cache resident area and the update management area.
[0182] In some embodiments, the data access device 201 further includes a data recovery module 2022, which is used to periodically check the recovery areas corresponding to the disk partitions, and select the recovery areas whose recovery record information meets the preset conditions from the recovery areas as the execution recovery areas;
[0183] Determine that the disk partition to which the execution recovery area belongs is a recovery disk partition, and determine that the cache partition corresponding to the recovery disk partition is a recovery cache partition;
[0184] Setting the reclaimed disk partition and the reclaimed cache partition to a locked state;
[0185] Acquire the data area corresponding to the recovered disk partition as the recovered data area;
[0186] According to the recycling record information of the execution recycling area, merging the stored data in the recycling data area;
[0187] When the merging process is completed, the reclaimed disk partition and the reclaimed cache partition are set to an unlocked state.
[0188] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned data access method embodiments and will not be repeated here.
[0189] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 3 Runs on the computer device shown.
[0190] See also Figure 3 , Figure 3 The present invention provides a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device includes but is not limited to a terminal device.
[0191] like Figure 3 As shown, the computer device 301 includes a processor 3011, a memory and a network interface connected via a system bus, wherein the memory may include a storage medium 3012 and an internal memory 3015, and the storage medium 3012 may be non-volatile or volatile.
[0192] The storage medium 3012 can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor 3011 can execute any data access method.
[0193] Processor 3011 is used to provide computing and control capabilities and support the operation of the entire computer device.
[0194] The internal memory 3015 provides an environment for the operation of the computer program in the storage medium 3012. When the computer program is executed by the processor 3011, the processor 3011 can execute any data access method.
[0195] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will appreciate that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0196] It should be understood that the processor 3011 may be a central processing unit (CPU), and the processor 3011 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0197] In some implementations, the processor 3011 is used to run a computer program stored in the memory to implement the following steps:
[0198] When receiving a partition instruction, the disk and cache are divided into a preset number of partitions, wherein each cache partition includes a cache temporary area and a cache resident area, and each disk partition includes a management area, a data area, and a recycling area;
[0199] When receiving a data storage instruction, obtaining a storage keyword and a storage key value corresponding to the storage keyword according to the data storage instruction;
[0200] Determine the hash value corresponding to the storage keyword as a target hash value, and modulo the preset value according to the target hash value to obtain a target partition sequence;
[0201] Acquire a target disk partition and a target cache partition according to the target partition sequence, determine a target management area, a target data area and a target reclaim area according to the target disk partition, and determine a target cache temporary area and a target cache resident area according to the target cache partition;
[0202] Determining whether the amount of stored data corresponding to the storage key value is greater than a first value;
[0203] If the amount of stored data is less than or equal to the first value, storing the storage keyword and the storage key value in the target cache temporary area;
[0204] If the amount of stored data is greater than the first value, the storage keyword and the storage key value are stored in the target data area, and management information is generated based on the storage keyword and the storage key value, and the management information is stored in the target cache resident area and the target management area.
[0205] In some implementations, when the processor 3011 stores the management information in the target cache resident area and the target management area, it is configured to implement:
[0206] Determining the storage capacity of the target cache resident area as a target resident capacity;
[0207] Taking the modulus of the target resident capacity according to the target hash value to obtain a target storage address;
[0208] The management information is stored in the target cache resident area and the target management area at storage locations corresponding to the target storage address respectively.
[0209] In some implementations, the processor 3011 is further configured to implement:
[0210] Determine the remaining storage capacity of the target cache temporary area as the remaining temporary capacity;
[0211] When the remaining temporary capacity is less than a second value, selecting a temporary keyword and a temporary key value corresponding to the temporary keyword from temporary data in the target cache temporary area;
[0212] Concatenate the temporary keyword and the temporary key value to obtain a first record result, and determine the storage data volume corresponding to the first record result as a first data volume;
[0213] According to the storage status information of the target data area, configuring the temporary keyword and the storage file of the temporary key value, and determining that the storage path corresponding to the storage file is a matching storage path;
[0214] Obtaining a temporary check value corresponding to the temporary key value according to a preset algorithm, wherein the temporary check value is used to check the temporary key value;
[0215] The temporary keyword, the matching storage path, the temporary check value and the first data volume are concatenated to obtain a second record result, and the storage data volume corresponding to the second record result is determined as a second data volume;
[0216] When the first data amount is less than or equal to the second data amount, determining that the first record result is the management information of the temporary keyword and the temporary key value;
[0217] The first recording result is stored in the target cache resident area and the target management area.
[0218] In some implementations, the processor 3011 is further configured to implement:
[0219] When the first data volume is greater than the second data volume, determining that the second record result is the temporary keyword and the management information of the temporary key value;
[0220] According to the matching storage path, storing the first record result in the target data area;
[0221] The second recording result is stored in the target cache resident area and the target management area.
[0222] In some implementations, the processor 3011 is further configured to implement:
[0223] When receiving a data query instruction, obtaining a query keyword from the data query instruction;
[0224] Determine the hash value corresponding to the query keyword as the query hash value, and modulo the preset value according to the query hash value to obtain a query partition sequence;
[0225] Acquire the query disk partition and the query cache partition according to the query partition sequence;
[0226] Determine a query management area, a query data area, and a query recycle area according to the query disk partition, and determine a query cache temporary area and a query cache resident area according to the query cache partition;
[0227] Determining whether the query cache temporary area stores a query key value corresponding to the query keyword;
[0228] If the query cache temporary area stores the query key value, returning the query key value;
[0229] If the query key value is not stored in the query cache temporary area, query management information matching the query keyword is obtained from the query cache permanent area, and the query key value is obtained according to the query management information.
[0230] In some implementations, the processor 3011 is further configured to implement:
[0231] When receiving a data update instruction, obtaining an update keyword and an update key value corresponding to the update keyword from the data update instruction;
[0232] Determine the hash value corresponding to the update keyword as the update hash value, and modulo the preset value according to the update hash value to obtain an update partition sequence;
[0233] Acquire update disk partitions and update cache partitions according to the update partition sequence;
[0234] Determine an update management area, an update data area, and an update recycling area according to the update disk partition, and determine an update cache temporary area and an update cache resident area according to the update cache partition;
[0235] According to the update key value, updating the data information corresponding to the update key in the update cache temporary area;
[0236] When the update cache temporary area does not store data information corresponding to the update keyword, acquiring first management information matching the update keyword from the update cache permanent area;
[0237] updating the update reclaim area according to the first management information, and removing the first management information from the update management area and the update cache resident area;
[0238] Determining whether the amount of stored data corresponding to the update key value is greater than the first value;
[0239] If the amount of stored data corresponding to the update key value is less than or equal to the first value, storing the update keyword and the update key value in the update cache temporary area;
[0240] If the amount of stored data corresponding to the update key value is greater than the first value, the update keyword and the update key value are stored in the update data area, and second management information is generated based on the update keyword and the update key value, and the second management information is stored in the update cache resident area and the update management area.
[0241] In some implementations, the processor 3011 is further configured to implement:
[0242] Periodically checking the recycling areas corresponding to the disk partitions, and selecting the recycling areas whose recycling record information meets preset conditions from the recycling areas as the execution recycling areas;
[0243] Determine that the disk partition to which the execution recovery area belongs is a recovery disk partition, and determine that the cache partition corresponding to the recovery disk partition is a recovery cache partition;
[0244] Setting the reclaimed disk partition and the reclaimed cache partition to a locked state;
[0245] Acquire the data area corresponding to the recovered disk partition as the recovered data area;
[0246] According to the recycling record information of the execution recycling area, merging the stored data in the recycling data area;
[0247] When the merging process is completed, the reclaimed disk partition and the reclaimed cache partition are set to an unlocked state.
[0248] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the computer device described above can refer to the corresponding process in the aforementioned data access method embodiment, which will not be repeated here.
[0249] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the data access method of the present application.
[0250] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0251] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0252] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0253] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A data access method, characterized in that: include: When receiving a partition instruction, the disk and cache are divided into a preset number of partitions, wherein each cache partition includes a cache temporary area and a cache resident area, and each disk partition includes a management area, a data area, and a recycling area; When receiving a data storage instruction, obtaining a storage keyword and a storage key value corresponding to the storage keyword according to the data storage instruction; Determine the hash value corresponding to the storage keyword as a target hash value, and modulo the preset value according to the target hash value to obtain a target partition sequence; Acquire a target disk partition and a target cache partition according to the target partition sequence, determine a target management area, a target data area and a target reclaim area according to the target disk partition, and determine a target cache temporary area and a target cache resident area according to the target cache partition; Determining whether the amount of stored data corresponding to the storage key value is greater than a first value; If the amount of stored data is less than or equal to the first value, storing the storage keyword and the storage key value in the target cache temporary area; If the amount of stored data is greater than the first value, the storage keyword and the storage key value are stored in the target data area, and management information is generated based on the storage keyword and the storage key value, and the management information is stored in the target cache resident area and the target management area.
2. The method according to claim 1, characterized in that The storing the management information in the target cache resident area and the target management area includes: Determining the storage capacity of the target cache resident area as a target resident capacity; Taking the modulus of the target resident capacity according to the target hash value to obtain a target storage address; The management information is stored in the target cache resident area and the target management area at storage locations corresponding to the target storage address respectively.
3. The method according to claim 2, characterized in that The method further comprises: Determine the remaining storage capacity of the target cache temporary area as the remaining temporary capacity; When the remaining temporary capacity is less than a second value, selecting a temporary keyword and a temporary key value corresponding to the temporary keyword from temporary data in the target cache temporary area; Concatenate the temporary keyword and the temporary key value to obtain a first record result, and determine the storage data volume corresponding to the first record result as a first data volume; According to the storage status information of the target data area, configuring the temporary keyword and the storage file of the temporary key value, and determining that the storage path corresponding to the storage file is a matching storage path; Obtaining a temporary check value corresponding to the temporary key value according to a preset algorithm, wherein the temporary check value is used to check the temporary key value; The temporary keyword, the matching storage path, the temporary check value and the first data volume are concatenated to obtain a second record result, and the storage data volume corresponding to the second record result is determined as a second data volume; When the first data amount is less than or equal to the second data amount, determining that the first record result is the management information of the temporary keyword and the temporary key value; The first recording result is stored in the target cache resident area and the target management area.
4. The method according to claim 3, characterized in that The method further comprises: When the first data volume is greater than the second data volume, determining that the second record result is the temporary keyword and the management information of the temporary key value; According to the matching storage path, storing the first record result in the target data area; The second recording result is stored in the target cache resident area and the target management area.
5. The method according to claim 4, characterized in that The method further comprises: When receiving a data query instruction, obtaining a query keyword from the data query instruction; Determine the hash value corresponding to the query keyword as the query hash value, and modulo the preset value according to the query hash value to obtain a query partition sequence; Acquire the query disk partition and the query cache partition according to the query partition sequence; Determine a query management area, a query data area, and a query recycle area according to the query disk partition, and determine a query cache temporary area and a query cache resident area according to the query cache partition; Determining whether the query cache temporary area stores a query key value corresponding to the query keyword; If the query cache temporary area stores the query key value, returning the query key value; If the query key value is not stored in the query cache temporary area, query management information matching the query keyword is obtained from the query cache permanent area, and the query key value is obtained according to the query management information.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: When receiving a data update instruction, obtaining an update keyword and an update key value corresponding to the update keyword from the data update instruction; Determine the hash value corresponding to the update keyword as the update hash value, and modulo the preset value according to the update hash value to obtain an update partition sequence; Acquire update disk partitions and update cache partitions according to the update partition sequence; Determine an update management area, an update data area, and an update recycling area according to the update disk partition, and determine an update cache temporary area and an update cache resident area according to the update cache partition; According to the update key value, updating the data information corresponding to the update key in the update cache temporary area; When the update cache temporary area does not store data information corresponding to the update keyword, acquiring first management information matching the update keyword from the update cache permanent area; updating the update reclaim area according to the first management information, and removing the first management information from the update management area and the update cache resident area; Determining whether the amount of stored data corresponding to the update key value is greater than the first value; If the amount of stored data corresponding to the update key value is less than or equal to the first value, storing the update keyword and the update key value in the update cache temporary area; If the amount of stored data corresponding to the update key value is greater than the first value, the update keyword and the update key value are stored in the update data area, and second management information is generated based on the update keyword and the update key value, and the second management information is stored in the update cache resident area and the update management area.
7. The method according to claim 6, characterized in that The method further comprises: Periodically checking the recycling areas corresponding to the disk partitions, and selecting the recycling areas whose recycling record information meets preset conditions from the recycling areas as the execution recycling areas; Determine that the disk partition to which the execution recovery area belongs is a recovery disk partition, and determine that the cache partition corresponding to the recovery disk partition is a recovery cache partition; Setting the reclaimed disk partition and the reclaimed cache partition to a locked state; Acquire the data area corresponding to the recovered disk partition as the recovered data area; According to the recycling record information of the execution recycling area, merging the stored data in the recycling data area; When the merging process is completed, the reclaimed disk partition and the reclaimed cache partition are set to an unlocked state.
8. A data access device, characterized in that: include: A partitioning module, for dividing the disk and cache into a preset number of partitions upon receiving a partitioning instruction, wherein each cache partition includes a cache temporary area and a cache resident area, and each disk partition includes a management area, a data area, and a recycling area; A storage instruction receiving module, configured to, upon receiving a data storage instruction, obtain a storage keyword and a storage key value corresponding to the storage keyword according to the data storage instruction; A partition sequence acquisition module, used to determine the hash value corresponding to the storage keyword as a target hash value, and modulo the preset value according to the target hash value to obtain a target partition sequence; A partition acquisition module, used to acquire a target disk partition and a target cache partition according to the target partition sequence, and determine a target management area, a target data area and a target reclaim area according to the target disk partition, and determine a target cache temporary area and a target cache resident area according to the target cache partition; A judgment module, used to judge whether the amount of stored data corresponding to the storage key value is greater than a first value; A first storage module, configured to store the storage keyword and the storage key value in the target cache temporary area if the storage data amount is less than or equal to the first value; A second storage module is used to store the storage keyword and the storage key value in the target data area if the amount of stored data is greater than the first value, generate management information based on the storage keyword and the storage key value, and store the management information in the target cache resident area and the target management area.
9. A computer device, characterized in that: The computer device comprises a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the data access method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the data access method according to any one of claims 1 to 7 are implemented.
