CN114328503A - Method, device and equipment for managing data based on hash table and storage medium - Google Patents

Method, device and equipment for managing data based on hash table and storage medium Download PDF

Info

Publication number
CN114328503A
CN114328503A CN202011065167.8A CN202011065167A CN114328503A CN 114328503 A CN114328503 A CN 114328503A CN 202011065167 A CN202011065167 A CN 202011065167A CN 114328503 A CN114328503 A CN 114328503A
Authority
CN
China
Prior art keywords
hash
hash table
key
key code
storage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011065167.8A
Other languages
Chinese (zh)
Inventor
赵博
罗旋
张勇
杨了
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Chengdu ICT Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Chengdu ICT Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Chengdu ICT Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202011065167.8A priority Critical patent/CN114328503A/en
Publication of CN114328503A publication Critical patent/CN114328503A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a method, a device, equipment and a storage medium for managing data based on a hash table, wherein the method comprises the following steps: acquiring target data; determining a key code corresponding to target data according to a preset strategy; calculating a key code through a first hash function corresponding to the first hash table to obtain an index address corresponding to the key code; acquiring a second hash table corresponding to the index address; calculating a key code through a second hash function corresponding to the second hash table to obtain a storage address corresponding to the key code; storing the target data in a storage position corresponding to the storage address; the embodiment of the invention can solve the technical problem of low memory caching efficiency in the prior art.

Description

Method, device and equipment for managing data based on hash table and storage medium
Technical Field
The invention belongs to the field of data caching, and particularly relates to a method, a device, equipment and a storage medium for managing data based on a hash table.
Background
Memory caching is used as a method for sacrificing memory space and improving high data access performance. The memory cache reduces the calculation amount of the server, shortens the request flow and provides the throughput as much as possible by using limited resources. Memory caching is widely used, particularly in database products.
However, the existing memory caching method has low efficiency of concurrent scene query, and operation conflict is generated between the memory caching data updating and the data query, which results in low memory caching efficiency.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, a device, and a storage medium for managing data based on a hash table, which can solve the technical problem of low memory caching efficiency in the prior art.
In a first aspect, an embodiment of the present invention provides a method for managing data based on a hash table, where the hash table includes a first hash table and a plurality of second hash tables, the first hash table includes a plurality of index addresses, each index address is associated with one second hash table, and each second hash table includes a plurality of storage addresses, the method including:
acquiring target data;
determining a key code corresponding to target data according to a preset strategy;
calculating a key code through a first hash function corresponding to the first hash table to obtain an index address corresponding to the key code;
acquiring a second hash table corresponding to the index address;
calculating a key code through a second hash function corresponding to the second hash table to obtain a storage address corresponding to the key code;
and storing the target data in a storage position corresponding to the storage address.
Further, in one embodiment, each index address includes first offset information;
calculating a key by a first hash function corresponding to the first hash table to obtain an index address corresponding to the key, including:
and calculating the key code through a first hash function to obtain first offset information, and acquiring an index address corresponding to the first offset information.
Further, in one embodiment, each memory address includes second offset information;
calculating the key code through a second hash function corresponding to the second hash table to obtain a storage address corresponding to the key code, including:
and calculating the key code through a second hash function to obtain second offset information, and acquiring a storage address corresponding to the second offset information.
Further, in one embodiment, each second hash table includes lock information, and the lock information included in each second hash table is different;
the method further comprises the following steps:
acquiring query data;
determining a key code corresponding to the query data according to a preset strategy;
calculating a key code through a first hash function corresponding to the first hash table to obtain an index address corresponding to the key code;
acquiring a second hash table corresponding to the index address and lock information included by the second hash table;
calculating a key code through a second hash function corresponding to the second hash table to obtain a storage address corresponding to the key code;
and reading the target data stored in the storage address according to the lock information.
Further, in one embodiment, the method further comprises:
acquiring update data;
determining a key code corresponding to the updating data according to a preset strategy;
calculating a key code through a first hash function corresponding to the first hash table to obtain an index address corresponding to the key code;
acquiring a second hash table corresponding to the index address and lock information included by the second hash table;
calculating a key code through a second hash function corresponding to the second hash table to obtain a storage address corresponding to the key code;
and updating the original data stored in the storage address into updated data according to the lock information.
In a second aspect, an embodiment of the present application provides an apparatus for managing data based on a hash table, where the hash table includes a first hash table and a plurality of second hash tables, the first hash table includes a plurality of index addresses, each index address is associated with a second hash table, and each second hash table includes a plurality of storage addresses, the apparatus includes:
the acquisition module is used for acquiring target data;
the determining module is used for determining a key code corresponding to the target data according to a preset strategy;
the obtaining module is further used for calculating a key through a first hash function corresponding to the first hash table to obtain an index address corresponding to the key;
the acquisition module is also used for acquiring a second hash table corresponding to the index address;
the obtaining module is further used for calculating a key code through a second hash function corresponding to the second hash table so as to obtain a storage address corresponding to the key code;
and the storage module is used for storing the target data in the storage position corresponding to the storage address.
Further, in one embodiment, each index address includes first offset information;
an acquisition module specifically configured to:
and calculating the key code through a first hash function to obtain first offset information, and acquiring an index address corresponding to the first offset information.
Further, in one embodiment, each memory address includes second offset information;
an acquisition module specifically configured to:
and calculating the key code through a second hash function to obtain second offset information, and acquiring a storage address corresponding to the second offset information.
Further, in one embodiment, each second hash table includes lock information, and the lock information included in each second hash table is different;
the acquisition module is also used for acquiring query data;
the determining module is also used for determining a key code corresponding to the query data according to a preset strategy;
the obtaining module is further used for calculating a key through a first hash function corresponding to the first hash table to obtain an index address corresponding to the key;
the acquisition module is further used for acquiring a second hash table corresponding to the index address and lock information included in the second hash table;
the obtaining module is further used for calculating a key code through a second hash function corresponding to the second hash table so as to obtain a storage address corresponding to the key code;
the device also includes:
and the reading module is used for reading the target data stored in the storage address according to the lock information.
Further, in one embodiment,
the acquisition module is also used for acquiring the updating data;
the determining module is further used for determining a key code corresponding to the updating data according to a preset strategy;
the obtaining module is further used for calculating a key through a first hash function corresponding to the first hash table to obtain an index address corresponding to the key;
the acquisition module is further used for acquiring a second hash table corresponding to the index address and lock information included in the second hash table;
the obtaining module is further used for calculating a key code through a second hash function corresponding to the second hash table so as to obtain a storage address corresponding to the key code;
the device also includes:
and the updating module is used for updating the original data stored in the storage address into updated data according to the lock information.
In a third aspect, an embodiment of the present application provides an apparatus for managing data based on a hash table, where the apparatus includes: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing a method of managing data based on a hash table.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where an implementation program for information transfer is stored, and when the program is executed by a processor, the method for managing data based on a hash table is implemented.
According to the method, the device, the equipment and the storage medium for managing data based on the hash table, the index address of target data is inquired through the first hash table, the position of the second hash table is confirmed through the index address, then the storage address of the target data is stored by applying the second hash table, and the target data is stored in the corresponding storage address; for a plurality of different target data, the corresponding storage addresses are stored in different second hash tables, so that the segmented storage of the target data storage addresses is realized, the query efficiency of the memory cache under high concurrency can be improved, and the conflict of the memory cache under the scene of data updating and data query can be reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments of the present invention will be briefly described below, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram illustrating a memory caching principle according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a hash table structure of a conventional memory cache according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a hash table structure provided in an embodiment of the present application according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a method for managing data based on a hash table according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus for managing data based on a hash table according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an apparatus for managing data based on a hash table according to an embodiment of the present invention.
Detailed Description
Features and exemplary embodiments of various aspects of the present invention will be described in detail below, and in order to make objects, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not to be construed as limiting the invention. It will be apparent to one skilled in the art that the present invention may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the present invention by illustrating examples of the present invention.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Memory caching is used as a method for sacrificing memory space and improving high data access performance. The memory cache reduces the calculation amount of the server, shortens the request flow and provides the throughput as much as possible by using limited resources. Memory caching is widely used, particularly in database products.
Fig. 1 shows a schematic diagram of a memory caching principle. As shown in fig. 1, the memory cache is located in the memory and the database is stored in the disk. The response speed of the disk is much slower than that of the memory. The use of memory caching can improve query efficiency. The contents of the database are synchronized to the memory cache, when the application service performs query operation, the memory cache can be accessed preferentially, if the memory cache has the queried data, the data is returned, and the query access efficiency can be greatly improved. The updating change of the database data needs to be synchronized to the memory database in time, and the application service is prevented from inquiring the 'failure' data.
The technical core of the memory cache is to maintain a huge Hash table-Hash Map in the memory. Fig. 2 shows a structural diagram of a conventional memory cache Hash table, and as shown in fig. 2, a Hash Map is based on an array: first position DATA + hash function + Key and linked list: key code Key + value + first position DATA + NULL value are constituteed, and the two kinds of DATA structures of having used multipurposely have realized that addressing is easy, insert the technological effect that the deletion is also easy.
The 1 HashMap storage body is a 1 large array data structure. The operations of adding, deleting, inquiring and modifying the data stored in the HashMap are all based on array operations, the thread safety is ensured in the concurrent operation, and the concurrent processing must be carried out by using a lock structure. Therefore, in a high concurrency situation, lock wait between different threads is necessarily caused, thereby causing data processing efficiency at the time of concurrency to be low.
In order to solve the problem of the prior art, embodiments of the present invention provide a method, an apparatus, a device, and a storage medium for managing data based on a hash table. In the embodiment of the invention, the index address of the target data is inquired through the first hash table, the position of the second hash table is confirmed through the index address, then the storage address of the target data is stored by applying the second hash table, and the target data is stored in the corresponding storage address; for a plurality of different target data, the corresponding storage addresses are stored in different second hash tables, so that the segmented storage of the target data storage addresses is realized, the query efficiency of the memory cache under high concurrency can be improved, and the conflict of the memory cache under the scene of data updating and data query can be reduced. First, a method for managing data based on a hash table according to an embodiment of the present invention is described below.
Fig. 3 illustrates a hash table structure according to an embodiment of the present application. As shown in fig. 3, the hash table includes a first hash table and a plurality of second hash tables, the first hash table includes a plurality of index addresses, each index address is associated with a second hash table, and each second hash table includes a plurality of storage addresses.
Based on the hash table, an embodiment of the present invention provides a method for managing data based on the hash table, which is described below with reference to managing student information, and fig. 4 shows a flowchart of the method. As shown in fig. 4, the method may include the steps of:
and S400, acquiring target data.
The target data is typically retrieved from a database in disk. The target data may specifically include student's: name, date of birth, gender, ethnicity, home address, and score.
S402, determining a key code corresponding to the target data according to a preset strategy.
The key with 'name + date of birth + sex + ethnicity + family address' is a preset strategy.
S404, calculating the key by the first hash function corresponding to the first hash table to obtain the index address corresponding to the key.
In one embodiment, each index address includes first offset information, and S404 may include:
and calculating the key code through a first hash function to obtain first offset information, and acquiring an index address corresponding to the first offset information.
And calculating 'name + date of birth + sex + ethnic group + family address' by using a first hash function, wherein the calculation result is '098100' and '98' is first offset information, and the corresponding index address can be determined after the first offset information is confirmed.
S406, a second hash table corresponding to the index address is obtained.
Because the index address and the second hash table have a correlation relationship, the index address is determined, and then the corresponding second hash table can be obtained.
S408, calculating the key code through a second hash function corresponding to the second hash table to obtain the storage address corresponding to the key code.
In one embodiment, each memory address includes second offset information, and S408 may include:
and calculating the key code through a second hash function to obtain second offset information, and acquiring a storage address corresponding to the second offset information.
And calculating the name, the birth date, the gender, the ethnicity and the family address by using a second hash function, wherein the calculation result is 036100, and 36 is second offset information, and the corresponding storage address can be obtained after the second offset information is confirmed.
And S410, storing the target data in the storage position corresponding to the storage address.
And storing the key code and the score into a storage position during storage.
In one embodiment, each of the second hash tables includes lock information, and the lock information included in each of the second hash tables is different, the method may further include:
s412, query data is obtained.
Query data is typically determined based on actual query requirements. For example, the student needs to be queried for Zhang III achievements.
And S416, determining a key code corresponding to the query data according to a preset strategy.
The name, the date of birth, the sex, the ethnicity and the home address are taken as keys, and the key is a preset strategy.
S418, calculate the key through the first hash function corresponding to the first hash table to obtain the index address corresponding to the key.
Specifically, the first hash function is used to calculate "name + date of birth + gender + ethnicity + home address", the calculation result is "098100", and "98" is the first offset information, and after the first offset information is confirmed, the corresponding index address can be determined.
S420, a second hash table corresponding to the index address and lock information included in the second hash table are obtained.
S422, the key is calculated through a second hash function corresponding to the second hash table, so as to obtain the storage address corresponding to the key.
And calculating the name, the birth date, the gender, the ethnicity and the family address by using a second hash function, wherein the calculation result is 036100, and 36 is second offset information, and the corresponding storage address can be obtained after the second offset information is confirmed.
S424, reading the target data stored in the storage address according to the lock information.
When reading the target data, the lock information is required to be used for reading, and the data consistency is kept.
In one embodiment, the method may comprise:
s426, the update data is acquired.
For example, new student data is formed after a certain examination and needs to be updated. The update data includes the name, date of birth, sex, ethnicity, home address, and updated score.
S428, determining a key code corresponding to the updating data according to a preset strategy.
The name, the date of birth, the sex, the ethnicity and the home address are taken as keys, and the key is a preset strategy.
S430, calculating the key by the first hash function corresponding to the first hash table to obtain the index address corresponding to the key.
Specifically, the first hash function is used to calculate "name + date of birth + gender + ethnicity + home address", the calculation result is "098100", and "98" is the first offset information, and after the first offset information is confirmed, the corresponding index address can be determined.
S432, a second hash table corresponding to the index address and lock information included in the second hash table are obtained.
S434, calculating a key by using a second hash function corresponding to the second hash table to obtain a storage address corresponding to the key.
And calculating the name, the birth date, the gender, the ethnicity and the family address by using a second hash function, wherein the calculation result is 036100, and 36 is second offset information, and the corresponding storage address can be obtained after the second offset information is confirmed.
And S436, updating the original data stored in the storage address into updated data according to the lock information.
When the target data is updated, the lock information needs to be used for updating, and the data consistency is kept. The storage address after the update stores the key and the updated achievement.
According to the method for managing data based on the hash table, the index address of target data is inquired through the first hash table, the position of the second hash table is confirmed through the index address, then the storage address of the target data is stored by applying the second hash table, and the target data is stored in the corresponding storage address; for a plurality of different target data, the corresponding storage addresses are stored in different second hash tables, so that the segmented storage of the target data storage addresses is realized, the query efficiency of the memory cache under high concurrency can be improved, and the conflict of the memory cache under the scene of data updating and data query can be reduced.
Fig. 1 to 4 illustrate a method for managing data based on a hash table, and the following describes apparatuses provided by embodiments of the present invention with reference to fig. 5 and 6.
Fig. 3 illustrates a hash table structure according to an embodiment of the present application. As shown in fig. 3, the hash table includes a first hash table and a plurality of second hash tables, the first hash table includes a plurality of index addresses, each index address is associated with a second hash table, and each second hash table includes a plurality of storage addresses.
Based on the hash table, an embodiment of the present invention provides a device for managing data based on the hash table, which is described below with reference to managing student information, fig. 5 shows a schematic structural diagram of the device, and each module in the device shown in fig. 5 has a function of implementing each step in fig. 4, and can achieve a corresponding technical effect. As shown in fig. 5, the apparatus may include:
an obtaining module 500, configured to obtain target data.
The target data is typically retrieved from a database in disk. The target data may specifically include student's: name, date of birth, gender, ethnicity, home address, and score.
The determining module 502 is configured to determine a key corresponding to the target data according to a preset policy.
The key with 'name + date of birth + sex + ethnicity + family address' is a preset strategy.
The obtaining module 500 is further configured to calculate a key by using a first hash function corresponding to the first hash table, so as to obtain an index address corresponding to the key.
In an embodiment, each index address includes first offset information, and the obtaining module 500 may be specifically configured to:
and calculating the key code through a first hash function to obtain first offset information, and acquiring an index address corresponding to the first offset information.
For example, the first hash function is used to calculate "name + date of birth + gender + ethnicity + home address", the calculation result is "098100", and "98" is the first offset information, and after the first offset information is confirmed, the corresponding index address can be determined.
The obtaining module 500 is further configured to obtain a second hash table corresponding to the index address.
Because the index address and the second hash table have a correlation relationship, the index address is determined, and then the corresponding second hash table can be obtained.
The obtaining module 500 is further configured to calculate a key by using a second hash function corresponding to the second hash table, so as to obtain a storage address corresponding to the key.
In an embodiment, each storage address includes second offset information, and the obtaining module 500 may be specifically configured to:
and calculating the key code through a second hash function to obtain second offset information, and acquiring a storage address corresponding to the second offset information.
For example, the second hash function is used to calculate "name + date of birth + gender + ethnicity + home address", the calculation result is "036100", and "36" is the second offset information, and after the second offset information is confirmed, the corresponding storage address can be obtained.
And the storage module 504 is configured to store the target data in a storage location corresponding to the storage address.
For example, when storing, the key + score is stored in the storage location.
In one embodiment, each of the second hash tables includes lock information, and each of the second hash tables includes different lock information.
The obtaining module 500 is further configured to obtain query data.
Query data is typically determined based on actual query requirements. For example, the student needs to be queried for Zhang III achievements.
The determining module 502 is further configured to determine a key corresponding to the query data according to a preset policy.
The name, the date of birth, the sex, the ethnicity and the home address are taken as keys, and the key is a preset strategy.
The obtaining module 500 is further configured to calculate a key by using a first hash function corresponding to the first hash table, so as to obtain an index address corresponding to the key.
Specifically, the first hash function is used to calculate "name + date of birth + gender + ethnicity + home address", the calculation result is "098100", and "98" is the first offset information, and after the first offset information is confirmed, the corresponding index address can be determined.
The obtaining module 500 is further configured to obtain a second hash table corresponding to the index address and lock information included in the second hash table.
The obtaining module 500 is further configured to calculate a key by using a second hash function corresponding to the second hash table, so as to obtain a storage address corresponding to the key.
And calculating the name, the birth date, the gender, the ethnicity and the family address by using a second hash function, wherein the calculation result is 036100, and 36 is second offset information, and the corresponding storage address can be obtained after the second offset information is confirmed.
The apparatus may further include:
and a reading module 506, configured to read the target data stored in the storage address according to the lock information.
When reading the target data, the lock information is required to be used for reading, and the data consistency is kept.
In one embodiment:
the obtaining module 500 is further configured to obtain the update data.
For example, new student data is formed after a certain examination and needs to be updated. The update data includes the name, date of birth, sex, ethnicity, home address, and updated score.
The determining module 502 is further configured to determine a key corresponding to the update data according to a preset policy.
The name, the date of birth, the sex, the ethnicity and the home address are taken as keys, and the key is a preset strategy.
The obtaining module 500 is further configured to calculate a key by using a first hash function corresponding to the first hash table, so as to obtain an index address corresponding to the key.
Specifically, the first hash function is used to calculate "name + date of birth + gender + ethnicity + home address", the calculation result is "098100", and "98" is the first offset information, and after the first offset information is confirmed, the corresponding index address can be determined.
The obtaining module 500 is further configured to obtain a second hash table corresponding to the index address and lock information included in the second hash table.
The obtaining module 500 is further configured to calculate a key by using a second hash function corresponding to the second hash table, so as to obtain a storage address corresponding to the key.
And calculating the name, the birth date, the gender, the ethnicity and the family address by using a second hash function, wherein the calculation result is 036100, and 36 is second offset information, and the corresponding storage address can be obtained after the second offset information is confirmed.
The apparatus may further include:
and the updating module 508 is configured to update the original data stored in the storage address into updated data according to the lock information.
When the target data is updated, the lock information needs to be used for updating, and the data consistency is kept. The storage address after the update stores the key and the updated achievement.
According to the device for managing data based on the hash table, the index address of the target data is inquired through the first hash table, the position of the second hash table is confirmed through the index address, the storage address of the target data is stored by applying the second hash table, and the target data is stored in the corresponding storage address; for a plurality of different target data, the corresponding storage addresses are stored in different second hash tables, so that the segmented storage of the target data storage addresses is realized, the query efficiency of the memory cache under high concurrency can be improved, and the conflict of the memory cache under the scene of data updating and data query can be reduced.
Fig. 6 is a schematic structural diagram illustrating an apparatus for managing data based on a hash table according to an embodiment of the present invention. As shown in fig. 6, the apparatus may include a processor 601 and a memory 602 storing computer program instructions.
Specifically, the processor 601 may include a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement the embodiments of the present invention.
Memory 602 may include mass storage for data or instructions. By way of example, and not limitation, memory 602 may include a Hard Disk Drive (HDD), floppy Disk Drive, flash memory, optical Disk, magneto-optical Disk, tape, or Universal Serial Bus (USB) Drive or a combination of two or more of these. In one example, the memory 602 may include removable or non-removable (or fixed) media, or the memory 602 is non-volatile solid-state memory. The memory 602 may be internal or external to the integrated gateway disaster recovery device.
In one example, the Memory 602 may be a Read Only Memory (ROM). In one example, the ROM may be mask programmed ROM, programmable ROM (prom), erasable prom (eprom), electrically erasable prom (eeprom), electrically rewritable ROM (earom), or flash memory, or a combination of two or more of these.
The processor 601 reads and executes the computer program instructions stored in the memory 602 to implement the steps of the method in the embodiment shown in fig. 4, and achieve the corresponding technical effects achieved by the embodiment shown in fig. 4 for executing the method, which are not described herein again for brevity.
In one example, the hash table based management data apparatus may further include a communication interface 603 and a bus 610. As shown in fig. 6, the processor 601, the memory 602, and the communication interface 603 are connected via a bus 610 to complete communication therebetween.
The communication interface 603 is mainly used for implementing communication between modules, apparatuses, units and/or devices in the embodiments of the present invention.
Bus 610 includes hardware, software, or both to couple the components of the online data traffic billing device to each other. By way of example, and not limitation, a Bus may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (Front Side Bus, FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) Bus, an infiniband interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a Micro Channel Architecture (MCA) Bus, a Peripheral Component Interconnect (PCI) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a video electronics standards association local (VLB) Bus, or other suitable Bus or a combination of two or more of these. Bus 610 may include one or more buses, where appropriate. Although specific buses have been described and shown in the embodiments of the invention, any suitable buses or interconnects are contemplated by the invention.
The device for managing data based on the hash table can execute the method for managing data based on the hash table in the embodiment of the invention, thereby realizing the corresponding technical effect of the method for managing data based on the hash table described in fig. 4.
In addition, in combination with the method for managing data based on the hash table in the foregoing embodiments, embodiments of the present invention may provide a computer storage medium to implement. The computer storage medium having computer program instructions stored thereon; the computer program instructions, when executed by a processor, implement any of the above-described embodiments of the method for managing data based on a hash table.
It is to be understood that the invention is not limited to the specific arrangements and instrumentality described above and shown in the drawings. A detailed description of known methods is omitted herein for the sake of brevity. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present invention are not limited to the specific steps described and illustrated, and those skilled in the art can make various changes, modifications and additions or change the order between the steps after comprehending the spirit of the present invention.
The functional blocks shown in the above-described structural block diagrams may be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic Circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, plug-in, function card, or the like. When implemented in software, the elements of the invention are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine-readable medium or transmitted by a data signal carried in a carrier wave over a transmission medium or a communication link. A "machine-readable medium" may include any medium that can store or transfer information. Examples of a machine-readable medium include electronic circuits, semiconductor memory devices, ROM, flash memory, Erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, Radio Frequency (RF) links, and so forth. The code segments may be downloaded via computer networks such as the internet, intranet, etc.
It should also be noted that the exemplary embodiments mentioned in this patent describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, may be performed in an order different from the order in the embodiments, or may be performed simultaneously.
Aspects of the present disclosure are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions/acts specified in the flowchart and/or block diagram block or blocks. Such a processor may be, but is not limited to, a general purpose processor, a special purpose processor, an application specific processor, or a field programmable logic circuit. It will also be understood that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware for performing the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As described above, only the specific embodiments of the present invention are provided, and it can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the module and the unit described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. It should be understood that the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present invention, and these modifications or substitutions should be covered within the scope of the present invention.

Claims (12)

1. A method for managing data based on hash tables, wherein the hash tables include a first hash table and a plurality of second hash tables, the first hash table includes a plurality of index addresses, each of the index addresses is associated with one of the second hash tables, each of the second hash tables includes a plurality of storage addresses, the method comprising:
acquiring target data;
determining a key code corresponding to the target data according to a preset strategy;
calculating the key code through a first hash function corresponding to the first hash table to obtain the index address corresponding to the key code;
acquiring the second hash table corresponding to the index address;
calculating the key code through a second hash function corresponding to the second hash table to obtain the storage address corresponding to the key code;
and storing the target data in a storage position corresponding to the storage address.
2. The hash-table based method of managing data according to claim 1, wherein each of said index addresses includes first offset information;
the calculating the key by using the first hash function corresponding to the first hash table to obtain the index address corresponding to the key includes:
and calculating the key code through the first hash function to obtain the first offset information, and acquiring the index address corresponding to the first offset information.
3. The hash-table based method of managing data according to claim 1, wherein each of said storage addresses includes second offset information;
the calculating the key by using a second hash function corresponding to the second hash table to obtain the storage address corresponding to the key includes:
and calculating the key code through the second hash function to obtain the second offset information, and acquiring the storage address corresponding to the second offset information.
4. The hash-table based method of managing data according to claim 1, wherein each of said second hash tables includes lock information, and said lock information included in each of said second hash tables is different;
the method further comprises the following steps:
acquiring query data;
determining a key code corresponding to the query data according to the preset strategy;
calculating the key code through a first hash function corresponding to the first hash table to obtain the index address corresponding to the key code;
acquiring the second hash table corresponding to the index address and the lock information included in the second hash table;
calculating the key code through a second hash function corresponding to the second hash table to obtain the storage address corresponding to the key code;
and reading the target data stored in the storage address according to the lock information.
5. The method for managing data based on a hash table of claim 4, wherein the method further comprises:
acquiring update data;
determining a key code corresponding to the updating data according to the preset strategy;
calculating the key code through a first hash function corresponding to the first hash table to obtain the index address corresponding to the key code;
acquiring the second hash table corresponding to the index address and the lock information included in the second hash table;
calculating the key code through a second hash function corresponding to the second hash table to obtain the storage address corresponding to the key code;
and updating the original data stored in the storage address into the updated data according to the lock information.
6. An apparatus for managing data based on hash tables, wherein the hash tables include a first hash table and a plurality of second hash tables, the first hash table includes a plurality of index addresses, each of the index addresses is associated with one of the second hash tables, each of the second hash tables includes a plurality of storage addresses, the apparatus comprising:
the acquisition module is used for acquiring target data;
the determining module is used for determining a key code corresponding to the target data according to a preset strategy;
the obtaining module is further configured to calculate the key by using a first hash function corresponding to the first hash table, so as to obtain the index address corresponding to the key;
the obtaining module is further configured to obtain the second hash table corresponding to the index address;
the obtaining module is further configured to calculate the key by using a second hash function corresponding to the second hash table, so as to obtain the storage address corresponding to the key;
and the storage module is used for storing the target data in a storage position corresponding to the storage address.
7. The hash-table-based management data apparatus of claim 6, wherein each of the index addresses includes first offset information;
the acquisition module is specifically configured to:
and calculating the key code through the first hash function to obtain the first offset information, and acquiring the index address corresponding to the first offset information.
8. The hash-table-based management data apparatus of claim 6, wherein each of said storage addresses includes second offset information;
the acquisition module is specifically configured to:
and calculating the key code through the second hash function to obtain the second offset information, and acquiring the storage address corresponding to the second offset information.
9. The hash-table-based apparatus for managing data according to claim 6, wherein each of the second hash tables includes lock information, and the lock information included in each of the second hash tables is different;
the acquisition module is also used for acquiring query data;
the determining module is further configured to determine a key corresponding to the query data according to the preset policy;
the obtaining module is further configured to calculate the key by using a first hash function corresponding to the first hash table, so as to obtain the index address corresponding to the key;
the obtaining module is further configured to obtain the second hash table corresponding to the index address and the lock information included in the second hash table;
the obtaining module is further configured to calculate the key by using a second hash function corresponding to the second hash table, so as to obtain the storage address corresponding to the key;
the device further comprises:
and the reading module is used for reading the target data stored in the storage address according to the lock information.
10. The hash table based apparatus for managing data according to claim 9,
the acquisition module is further used for acquiring the updating data;
the determining module is further configured to determine a key corresponding to the update data according to the preset policy;
the obtaining module is further configured to calculate the key by using a first hash function corresponding to the first hash table, so as to obtain the index address corresponding to the key;
the obtaining module is further configured to obtain the second hash table corresponding to the index address and the lock information included in the second hash table;
the obtaining module is further configured to calculate the key by using a second hash function corresponding to the second hash table, so as to obtain the storage address corresponding to the key;
the device further comprises:
and the updating module is used for updating the original data stored in the storage address into the updated data according to the lock information.
11. An apparatus for managing data based on a hash table, comprising: memory, processor and computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, implements a method of managing data based on a hash table as claimed in any one of claims 1 to 5.
12. A computer-readable storage medium, on which an information transfer implementation program is stored, which when executed by a processor implements the method for managing data based on a hash table according to any one of claims 1 to 5.
CN202011065167.8A 2020-09-30 2020-09-30 Method, device and equipment for managing data based on hash table and storage medium Pending CN114328503A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011065167.8A CN114328503A (en) 2020-09-30 2020-09-30 Method, device and equipment for managing data based on hash table and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011065167.8A CN114328503A (en) 2020-09-30 2020-09-30 Method, device and equipment for managing data based on hash table and storage medium

Publications (1)

Publication Number Publication Date
CN114328503A true CN114328503A (en) 2022-04-12

Family

ID=81032563

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011065167.8A Pending CN114328503A (en) 2020-09-30 2020-09-30 Method, device and equipment for managing data based on hash table and storage medium

Country Status (1)

Country Link
CN (1) CN114328503A (en)

Similar Documents

Publication Publication Date Title
JP6875557B2 (en) Methods and devices for writing service data to the blockchain system
US11593337B2 (en) Data processing method, device, and a storage medium
CN108153757B (en) Hash table management method and device
CN109710190B (en) Data storage method, device, equipment and storage medium
CN107451152B (en) Computing device, data caching and searching method and device
US11245762B1 (en) Data request servicing using smart network interface cards
CN111090663A (en) Transaction concurrency control method, device, terminal equipment and medium
CN111737564A (en) Information query method, device, equipment and medium
US10838875B2 (en) System and method for managing memory for large keys and values
CN111444188A (en) Stock test data preparation method and device, storage medium and electronic equipment
JP2020123320A (en) Method, apparatus, device and storage medium for managing index
CN107368513B (en) Method and device for updating client database
CN106599247B (en) Method and device for merging data files in LSM-tree structure
US10565184B2 (en) Method and system for committing transactions in a semi-distributed manner
US11120002B2 (en) Method and system for concurrent database operation
CN111694992A (en) Data processing method and device
CN111382179B (en) Data processing method and device and electronic equipment
CN114328503A (en) Method, device and equipment for managing data based on hash table and storage medium
CN110263060B (en) ERP electronic accessory management method and computer equipment
CN109842482B (en) Information synchronization method, system and terminal equipment
CN113064902A (en) Method and device for retrieving transaction data on chain and electronic equipment
CN107038617B (en) Pre-creation method and device of payment order
CN115687359A (en) Data table partitioning method and device, storage medium and computer equipment
CN111338574B (en) Data self-repairing method, device, medium and electronic equipment based on block chain
CN114741384A (en) Patient information processing method and device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination