CN115878605A - Data storage method and device, electronic equipment and storage medium - Google Patents

Data storage method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115878605A
CN115878605A CN202111137969.XA CN202111137969A CN115878605A CN 115878605 A CN115878605 A CN 115878605A CN 202111137969 A CN202111137969 A CN 202111137969A CN 115878605 A CN115878605 A CN 115878605A
Authority
CN
China
Prior art keywords
data
keyword
storage unit
physical space
determining
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
CN202111137969.XA
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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology 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 Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202111137969.XA priority Critical patent/CN115878605A/en
Publication of CN115878605A publication Critical patent/CN115878605A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

The specification discloses a data storage method, a data storage device, an electronic device and a storage medium, wherein a server acquires service related data, the service related data comprises first data, second data and associated data, then a first keyword can be determined according to part of data in the first data, and a second keyword can be determined according to other data and the second data. Determining a hash table address stored in the first storage unit corresponding to the first keyword according to the first hash code corresponding to the first keyword, determining a second hash code corresponding to the second keyword, and determining a physical space in the second storage unit according to the hash table address and the second hash code. And finally, storing the second keyword and the associated data as data combinations in the physical space, wherein the second storage unit is a persistent memory, and the physical spaces corresponding to the data combinations in the second storage unit are continuous, so that the data loading time is reduced.

Description

Data storage method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for storing data, an electronic device, and a storage medium.
Background
In internet services, in order to support service execution, a service platform often needs to store a large amount of data locally in the server, and query the server locally for the required data when the service is executed. For example, for a delivery service, navigation distances between geographic positions need to be stored in advance, and corresponding navigation distances need to be queried as needed during delivery scheduling; for example, for services such as real-time delivery scheduling and information recommendation, order features, user features, and the like need to be stored, and if the user features need to be used in the services, the corresponding user features can be determined through the user identifiers.
In the prior art, a service platform may load required data into a local memory of a server, that is: in a Dynamic Random Access Memory (DRAM), when data needs to be queried, a server may obtain corresponding data from a Memory. However, due to the characteristics of the DRAM, if the server is down or restarted, the data in the memory is completely lost, and the server needs to reload the data into the memory, and the data is usually large in volume, so that the time consumption for data loading is too long.
Therefore, how to avoid the long time consumption of data loading is an urgent problem to be solved.
Disclosure of Invention
The present specification provides a method, an apparatus, an electronic device and a storage medium for storing data, so as to partially solve the above problems in the prior art.
The technical scheme adopted by the specification is as follows:
the present specification provides a method of data storage, comprising:
acquiring service related data, wherein the service related data comprises first data, second data and associated data, and the associated data is determined through the first data and the second data;
determining a first keyword according to partial data in the first data, and determining a second keyword according to other data except the partial data in the first data and the second data, wherein the first keyword and the second keyword are commonly used for inquiring the associated data;
determining a hash code corresponding to the first keyword as a first hash code, and determining a hash table address stored in a first storage unit corresponding to the first keyword according to the first hash code;
determining a hash code corresponding to the second keyword as a second hash code, and determining a physical space for storing the second keyword and the associated data in a second storage unit according to the hash table address and the second hash code;
and storing the second keyword and the associated data as data combinations in the physical space, wherein the first storage unit is a volatile memory, the second storage unit is a persistent memory, and the physical space corresponding to each data combination in the second storage unit is continuous.
Optionally, storing the second keyword and the associated data as a data combination in the physical space, specifically including:
if the physical space is determined to be occupied by other data combinations, sequentially inquiring an idle physical space behind the physical space;
storing the data combination in the free physical space.
Optionally, determining, according to the first hash code, a hash table address stored in the first storage unit in correspondence with the first keyword, specifically including;
if the first keyword is determined not to be stored in the storage position corresponding to the first hash code in the first storage unit, determining a hash table address in the second storage unit corresponding to the first keyword, and correspondingly storing the hash table address and the first keyword in the first storage unit according to the storage position;
and if the first keyword is determined to be stored in the storage position corresponding to the first hash code in the first storage unit, determining a hash table address stored in the first storage unit corresponding to the first keyword.
Optionally, determining, according to the first hash code, a hash table address stored in the first storage unit in correspondence with the first keyword, specifically including:
determining a data position corresponding to the first hash code in a hash table of the first storage unit;
and determining a hash table address which is stored in the first storage unit and corresponds to the first keyword according to the data position.
Optionally, the method further comprises:
if a query request for querying the associated data is received, acquiring the first keyword and the second keyword;
determining a first hash code corresponding to the first keyword and a second hash code corresponding to the second keyword;
determining a hash table address, which is stored in the first storage unit corresponding to the first keyword, according to the first hash code;
determining a physical space in the second storage unit for storing the second keyword and the associated data according to the hash table address and the second hash code, and using the physical space as a target physical space;
and determining the first data behind the second keyword according to the target physical space to obtain the queried associated data.
Optionally, determining, according to the target physical space, first data located after the second keyword to obtain the queried associated data, specifically including:
if the second keyword is inconsistent with the keyword in the target physical space, sequentially inquiring each physical space behind the target physical space until the physical space in which the second keyword is stored is inquired;
and determining the first data after the first keyword in the physical space in which the second keyword is stored to obtain the queried data.
Optionally, the first data is a position code of a start position, the second data is a position code of an end position, the related data is a navigation distance between the start position and the end position, the first keyword includes a partial position code corresponding to the start position, and the second keyword includes position codes other than the partial position code in the start position and a position code corresponding to the end position.
The present specification provides an apparatus for data storage, comprising:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is configured to be used for acquiring service related data, the service related data comprises first data, second data and associated data, and the associated data is determined by the first data and the second data;
a keyword determining module configured to determine a first keyword according to partial data in the first data, and determine a second keyword according to other data in the first data except the partial data and the second data, wherein the first keyword and the second keyword are used together for querying the associated data;
the code determining module is configured to determine a hash code corresponding to the first keyword as a first hash code, and determine a hash table address stored in a first storage unit corresponding to the first keyword according to the first hash code;
a space determining module, configured to determine a hash code corresponding to the second keyword as a second hash code, and determine a physical space for storing the second keyword and the associated data in a second storage unit according to the hash table address and the second hash code;
and the storage module is configured to store the second keyword and the associated data as data combinations in the physical space, wherein the second storage unit is a persistent memory, the physical space corresponding to each data combination in the second storage unit is continuous, and the first storage unit is a volatile memory.
The present specification provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the above-described method of data storage.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the above-mentioned data storage method when executing the program.
The technical scheme adopted by the specification can achieve the following beneficial effects:
in the data storage method provided by the present specification, a server may obtain service-related data, where the service-related data includes first data, second data, and associated data, and the associated data may be determined by the first data and the second data, and then, a first keyword may be determined according to a part of data in the first data, and a second keyword may be determined according to other data except for the part of data in the first data and the second data, and the first keyword and the second keyword are used together to query the associated data. Determining a hash code corresponding to the first keyword as a first hash code, determining a hash table address corresponding to the first keyword in the first storage unit according to the first hash code, determining a hash code corresponding to the second keyword as a second hash code, and determining a physical space for storing the second keyword and the associated data in the second storage unit according to the hash table address and the second hash code. And finally, storing the second keyword and the associated data as data combinations in the physical space, wherein the first storage unit is a volatile memory, the second storage unit is a persistent memory, and the physical space corresponding to each data combination in the second storage unit is continuous.
It can be seen from the above method that, when storing the second keyword and the associated data, the server may store the second keyword and the associated data in the persistent memory space, and make the physical addresses of the second keyword and the associated data continuous, by storing the data in the persistent memory space, the data does not need to be reloaded even if the server is restarted or down, and because the server needs to read a large data block at a time when reading the data through the persistent memory space, the efficiency of reading the data by the server can be ensured to a certain extent by making the physical addresses of the second keyword and the associated data continuous.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the specification and not to limit the specification in a non-limiting sense. In the drawings:
FIG. 1 is a schematic flow chart of a method for storing data in the present specification;
fig. 2 is a schematic diagram of various associated data provided in this specification and a storage location of a second keyword corresponding to each associated data;
FIG. 3 is a schematic diagram of determining free physical space provided herein;
FIG. 4 is a diagram illustrating a relationship between a first keyword, a second keyword, and associated data provided in the present specification;
FIG. 5 is a schematic diagram of a data storage device provided herein;
fig. 6 is a schematic diagram of an electronic device corresponding to fig. 1 provided in the present specification.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below with reference to the specific embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present specification without making any creative effort belong to the protection scope of the present specification.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a data storage method in this specification, including the following steps:
s101: acquiring service related data, wherein the service related data comprises first data, second data and associated data, and the associated data is determined by the first data and the second data.
S102: and determining a first keyword according to partial data in the first data, and determining a second keyword according to other data except the partial data in the first data and the second data, wherein the first keyword and the second keyword are jointly used for inquiring the associated data.
In practical applications, in order to facilitate querying of the service-related data, after the service-related data is determined, the server may store the service-related data locally. Based on this, the server may obtain service-related data, where the service-related data may include first data, second data, and associated data, may determine a first keyword according to partial data in the first data, and determine a second keyword according to other data in the first data except the partial data and the second data, where the first keyword and the second keyword may be used to jointly query the associated data.
The related data may refer to a navigation distance, the first data may refer to a position code of a start position, and the second data may refer to a position code of an end position, that is, the data storage method in this specification may be applied to a scenario of querying a distribution navigation distance (for example, querying a navigation distance from a distribution start point to a distribution end point), and when a server needs to query a navigation distance from a start position to an end position, the server may query the navigation distance by using a position code corresponding to the start position and a first keyword and a second keyword of the end position. That is, the associated data is data to be queried in the service-related data, and the associated data can be determined by the first data and the second data, and the first keyword and the second keyword are determined by the first data and the second data, so that the associated data can be queried by the first keyword and the second keyword, for example, if the associated data is a navigation distance, the first data may refer to a position code (e.g., a geohash code) of a start point position, the second data may refer to a position code of an end point data, the first keyword may include a partial position code of the start point position, and the second keyword may include a remaining position code of the start point position and a position code of the end point position.
S102: and determining a hash code corresponding to the first keyword as a first hash code, and determining a hash table address stored in a first storage unit corresponding to the first keyword according to the first hash code.
S103: and determining a hash code corresponding to the second keyword as a second hash code, and determining a physical space used for storing the second keyword and the associated data in a second storage unit according to the hash table address and the second hash code.
S104: and storing the second keyword and the associated data as data combinations in the physical space, wherein the first storage unit is a volatile memory, the second storage unit is a persistent memory, and the physical space corresponding to each data combination in the second storage unit is continuous.
After determining the first keyword and the second keyword, the server may determine a hash code corresponding to the first keyword as the first hash code, determine, according to the first hash code, a hash table address stored in the first storage unit corresponding to the first keyword, determine, according to the second keyword, a hash code corresponding to the second keyword as the second hash code, and determine, according to the hash table address and the second hash code, a physical space in the second storage unit for storing the second keyword and associated data. Then, the second keyword and the associated data may be stored in the physical space as a data combination, where the first storage unit is a volatile memory, the second storage unit is a persistent memory, and the physical space corresponding to each data combination in the second storage unit is continuous.
The hash table address stored in the first storage unit corresponding to the first keyword may refer to a physical address pointing to the second storage unit, and the hash table in which the second keyword and the associated data in the second storage unit are located may be determined according to the physical address. In practical application, a situation that first keywords corresponding to a plurality of associated data are consistent may exist, and therefore, when the same first keyword is repeatedly obtained, the first keyword does not need to be stored again, and only the hash table address stored corresponding to the first keyword needs to be determined.
Specifically, if the server determines that the first keyword is not stored in the storage location corresponding to the first hash code in the first storage unit, the server determines a hash table address in the second storage unit corresponding to the first keyword, and stores the hash table address and the first keyword in the first storage unit according to the storage location, and if the server determines that the first keyword is stored in the storage location corresponding to the first hash code in the first storage unit, the server may directly determine the hash table address stored in the first storage unit corresponding to the first keyword.
And storing the associated data and the second key words in a persistent memory, so that even if the server is restarted, the associated data and the second key words are not lost and do not need to be reloaded. Moreover, the storage addresses of the second key corresponding to one piece of associated data and the associated data are continuous physically, and the physical spaces in which each combination of data (i.e., associated data and second key) is stored are continuous, as shown in fig. 2.
Fig. 2 is a schematic diagram of various associated data provided in this specification and a storage location of a second keyword corresponding to each associated data.
As can be seen from fig. 2, the physical spaces corresponding to the data combination a, the data combination B, and the data combination C are consecutive, the second keyword a in the data combination a is the second keyword corresponding to the associated data a, and so on, the second keyword B in the data combination B is the second keyword corresponding to the associated data B, and the second keyword C in the data combination C is the second keyword corresponding to the associated data C, and it can be seen that the physical addresses between the associated data and the second keyword corresponding to the associated data are also consecutive.
Compared with a DRAM, a persistent memory can read a plurality of consecutive data blocks (cache lines) at a time, for example, a PMEM can read 4 cache lines at a time, that is, 256 bytes of data at a time, and a DRAM can read 1 cache line at a time, so that associated data and a second keyword are continuously stored in a second storage unit (that is, the associated data and a physical address of the second keyword are continuous), it can be ensured that the server reads the associated data corresponding to the second keyword when reading the second keyword, thereby ensuring the reading efficiency of the server, and in the following, if a physical space in which the associated data should be stored is determined according to the second keyword is occupied, a free physical space can be determined backwards, so that, comprehensively, the physical spaces corresponding to the associated data are continuous, and the efficiency of the server for reading data can be improved to a certain extent.
It should be noted that, when the server stores the second keyword and the associated data, it is determined in accordance with the determined hash code of the second keyword in which the second keyword and the associated data should be stored, but in this case, when the second keyword and the associated data corresponding to the second keyword are stored, the physical space in which the second keyword and the associated data corresponding to the second keyword should be stored is occupied, and therefore, it is necessary to determine another physical space in which the second keyword and the associated data corresponding to the second keyword should be stored.
Based on this, if the physical space determined by the server according to the second hash code is occupied by other data combinations, the free physical space located behind the physical space may be sequentially queried, and the data combinations are stored in the physical space. The free physical space may refer to the first free physical space after the physical address is located in the physical space, as shown in fig. 3.
Fig. 3 is a schematic diagram of determining a free physical space provided in this specification.
As can be seen from fig. 3, the associated data a is already stored in the hash table, and the associated data B needs to be stored in the hash table, but the physical space determined by the hash encoding of the second key B corresponding to the associated data B overlaps with the physical space where the associated data a is located, that is, the physical space is already occupied by the data combination corresponding to the associated data a, so that the first free physical space after the physical space needs to be determined as the physical space for storing the associated data B and the second key B.
Therefore, if the server receives a query request for querying the associated data, the first keyword and the second keyword may be obtained, a first hash code corresponding to the first keyword, a second hash code corresponding to the second keyword, a hash table address corresponding to the first storage unit and the first keyword, a physical space for storing the second keyword and the associated data in the second storage unit as a target physical space, and a first data located after the second keyword according to the target physical space, to obtain the queried associated data.
That is to say, when the associated data is queried, the hash code of the first keyword corresponding to the associated data may be determined, so as to determine the position of the first keyword in the hash table of the first storage unit, so as to determine the hash table in which the associated data is located in the second storage unit. Then, the position of the associated data in the hash table (hash table in the second storage unit) is determined through the hash code of the second keyword, so as to query the associated data.
Correspondingly, when the server performs the query, it is also necessary to consider a situation that the physical space is occupied by other data combinations, and therefore, if the second keyword is inconsistent with the keyword in the target physical space, each physical space after the target physical space is sequentially queried until the physical space in which the second keyword is stored is queried, and determining the first data after the first keyword in the physical space in which the second keyword is stored to obtain the queried data, that is, if the keyword stored in the physical space is inconsistent with the second keyword, each physical space after the physical space may be sequentially queried until the physical space in which the first keyword is stored is queried, thereby determining the first data after the keyword in the physical space to obtain the queried associated data, which is still exemplified in fig. 3.
It should be noted that the first key may include the first 20 digits in the position code of the starting position, the second key may include the last 20 digits in the position code of the starting position and all the position codes of the end position, and in addition, for efficient determination of the hash code, the first data key and the second data key may be stored as a number type (e.g., integer int, long integer long, etc.) at the time of storage.
In summary, the hash table address stored corresponding to the first keyword and the second hash code corresponding to the second keyword can determine the physical space of the second keyword and the associated data in the hash table corresponding to the hash table address, that is, the physical space in the second storage unit can be determined, that is, the first keyword and the second keyword are required to determine the location of the associated data together, as shown in fig. 4.
Fig. 4 is a schematic diagram of a relationship between a first keyword, a second keyword, and associated data provided in this specification.
As can be seen from fig. 4, one first keyword may correspond to a plurality of different associated data, and therefore, the hash table address of the hash table where the second keyword and the associated data are located needs to be determined through the first keyword, and then the associated data is found through the second keyword.
It can be seen from the above method that, when storing the second keyword and the associated data, the server may store the second keyword and the associated data in the persistent memory space, and make the physical addresses of the second keyword and the associated data continuous, by storing the data in the persistent memory space, the data does not need to be reloaded even if the server is restarted or down, and because the server needs to read a large data block at a time when reading the data through the persistent memory space, the efficiency of reading the data by the server can be ensured to a certain extent by making the physical addresses of the second keyword and the associated data continuous.
Based on the same idea, the data storage method provided in one or more embodiments of the present specification further provides a corresponding data storage apparatus, as shown in fig. 5.
Fig. 5 is a schematic diagram of a data storage apparatus provided in this specification, including:
an obtaining module 501, configured to obtain service-related data, where the service-related data includes first data, second data, and associated data, and the associated data is determined by the first data and the second data;
a keyword determining module 502 configured to determine a first keyword according to a part of the first data, and determine a second keyword according to other data except the part of the first data and the second data, wherein the first keyword and the second keyword are used together for querying the associated data;
an encoding determining module 503, configured to determine a hash code corresponding to the first keyword as a first hash code, and determine, according to the first hash code, a hash table address stored in the first storage unit corresponding to the first keyword;
a space determining module 504, configured to determine a hash code corresponding to the second keyword as a second hash code, and determine a physical space for storing the second keyword and the associated data in a second storage unit according to the hash table address and the second hash code;
a storage module 505 configured to store the second keyword and the associated data as a data combination in the physical space, where the second storage unit is a persistent memory, the physical space corresponding to each data combination in the second storage unit is continuous, and the first storage unit is a volatile memory.
Optionally, the storage module 505 is specifically configured to, if it is determined that the physical space is already occupied by other data combinations, sequentially query a free physical space located behind the physical space; storing the data combination in the free physical space.
Optionally, the code determining module 503 is specifically configured to, if it is determined that the first keyword is not stored in the storage location corresponding to the first hash code in the first storage unit, determine a hash table address in the second storage unit corresponding to the first keyword, and store the hash table address and the first keyword in the first storage unit correspondingly according to the storage location; and if the first keyword is determined to be stored in the storage position corresponding to the first hash code in the first storage unit, determining a hash table address stored in the first storage unit corresponding to the first keyword.
Optionally, the code determining module 503 is specifically configured to determine a data position corresponding to the first hash code in the hash table of the first storage unit; and determining the hash table address which is stored in the first storage unit and corresponds to the first keyword according to the data position.
Optionally, the apparatus further comprises:
a query module 506, configured to obtain the first keyword and the second keyword if a query request for querying the associated data is received; determining a first hash code corresponding to the first keyword and a second hash code corresponding to the second keyword; determining a hash table address, which is stored in the first storage unit corresponding to the first keyword, according to the first hash code; determining a physical space used for storing the second keyword and the associated data in the second storage unit as a target physical space according to the hash table address and the second hash code; and determining the first data behind the second keyword according to the target physical space to obtain the queried associated data.
Optionally, the query module 506 is specifically configured to, if the second keyword is inconsistent with the keyword in the target physical space, sequentially query each physical space after the target physical space until the physical space in which the second keyword is stored is queried; and determining the first data after the first keyword in the physical space in which the second keyword is stored to obtain the queried data.
Optionally, the first data is a position code of a start position, the second data is a position code of an end position, the related data is a navigation distance between the start position and the end position, the first keyword includes a partial position code corresponding to the start position, and the second keyword includes position codes other than the partial position code in the start position and a position code corresponding to the end position.
The present specification also provides a computer readable storage medium having stored thereon a computer program operable to perform a method of data storage as provided above with respect to fig. 1.
This specification also provides a schematic block diagram of an electronic device corresponding to that of figure 1, shown in figure 6. As shown in fig. 6, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs the computer program to implement the data storage method described in fig. 1. Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as ABEL (Advanced Boolean Expression Language), AHDL (alternate Hardware Description Language), traffic, CUPL (core universal Programming Language), HDCal, jhddl (Java Hardware Description Language), lava, lola, HDL, PALASM, rhyd (Hardware Description Language), and vhigh-Language (Hardware Description Language), which is currently used in most popular applications. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in purely computer readable program code means, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be regarded as a hardware component and the means for performing the various functions included therein may also be regarded as structures within the hardware component. Or even means for performing the functions may be conceived to be both a software module implementing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functions of the various elements may be implemented in the same one or more software and/or hardware implementations of the present description.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The description has been presented with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the description. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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, embedded processor, 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, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that 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 a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
This description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A method of data storage, comprising:
acquiring service related data, wherein the service related data comprises first data, second data and associated data, and the associated data is determined through the first data and the second data;
determining a first keyword according to partial data in the first data, and determining a second keyword according to other data except the partial data in the first data and the second data, wherein the first keyword and the second keyword are commonly used for inquiring the associated data;
determining a hash code corresponding to the first keyword as a first hash code, and determining a hash table address stored in a first storage unit corresponding to the first keyword according to the first hash code;
determining a hash code corresponding to the second keyword, using the hash code as a second hash code, and determining a physical space used for storing the second keyword and the associated data in a second storage unit according to the hash table address and the second hash code;
and storing the second keyword and the associated data as data combinations in the physical space, wherein the first storage unit is a volatile memory, the second storage unit is a persistent memory, and the physical space corresponding to each data combination in the second storage unit is continuous.
2. The method of claim 1, wherein storing the second key and the associated data as a data combination in the physical space comprises:
if the physical space is determined to be occupied by other data combinations, sequentially inquiring an idle physical space behind the physical space;
storing the data combination in the free physical space.
3. The method according to claim 1, wherein determining, according to the first hash code, a hash table address stored in the first storage unit in correspondence with the first keyword specifically includes;
if the first keyword is determined not to be stored in the storage position corresponding to the first hash code in the first storage unit, determining a hash table address in the second storage unit corresponding to the first keyword, and correspondingly storing the hash table address and the first keyword in the first storage unit according to the storage position;
and if the first keyword is determined to be stored in the storage position corresponding to the first hash code in the first storage unit, determining a hash table address stored in the first storage unit corresponding to the first keyword.
4. The method according to claim 1, wherein determining, according to the first hash code, a hash table address stored in the first storage unit in correspondence with the first keyword specifically includes:
determining a data position corresponding to the first hash code in a hash table of the first storage unit;
and determining the hash table address which is stored in the first storage unit and corresponds to the first keyword according to the data position.
5. The method of claim 1, wherein the method further comprises:
if a query request for querying the associated data is received, acquiring the first keyword and the second keyword;
determining a first hash code corresponding to the first keyword and a second hash code corresponding to the second keyword;
determining a hash table address, which is stored in the first storage unit corresponding to the first keyword, according to the first hash code;
determining a physical space in the second storage unit for storing the second keyword and the associated data according to the hash table address and the second hash code, and using the physical space as a target physical space;
and determining the first data behind the second keyword according to the target physical space to obtain the queried associated data.
6. The method according to claim 5, wherein determining the first data located after the second keyword according to the target physical space to obtain the queried associated data specifically includes:
if the second keyword is inconsistent with the keyword in the target physical space, sequentially querying each physical space behind the target physical space until the physical space in which the second keyword is stored is queried;
and determining the first data after the first keyword in the physical space in which the second keyword is stored to obtain the queried data.
7. The method according to any one of claims 1 to 6, wherein the first data is a position code of a start position, the second data is a position code of an end position, the associated data is a navigation distance between the start position and the end position, the first keyword comprises a partial position code corresponding to the start position, the second keyword comprises a position code other than the partial position code in the start position, and a position code corresponding to the end position.
8. An apparatus for data storage, comprising:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is configured to be used for acquiring service related data, the service related data comprises first data, second data and associated data, and the associated data is determined by the first data and the second data;
a keyword determining module configured to determine a first keyword according to partial data in the first data, and determine a second keyword according to other data in the first data except the partial data and the second data, wherein the first keyword and the second keyword are used together for querying the associated data;
the code determining module is configured to determine a hash code corresponding to the first keyword as a first hash code, and determine a hash table address stored in the first storage unit corresponding to the first keyword according to the first hash code;
a space determining module, configured to determine a hash code corresponding to the second keyword, as a second hash code, and determine, according to the hash table address and the second hash code, a physical space in a second storage unit for storing the second keyword and the associated data;
a storage module, configured to store the second keyword and the associated data as a data combination in the physical space, where the second storage unit is a persistent memory, the physical spaces corresponding to the data combinations in the second storage unit are continuous, and the first storage unit is a volatile memory.
9. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1 to 7.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 7 when executing the program.
CN202111137969.XA 2021-09-27 2021-09-27 Data storage method and device, electronic equipment and storage medium Pending CN115878605A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111137969.XA CN115878605A (en) 2021-09-27 2021-09-27 Data storage method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111137969.XA CN115878605A (en) 2021-09-27 2021-09-27 Data storage method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115878605A true CN115878605A (en) 2023-03-31

Family

ID=85763077

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111137969.XA Pending CN115878605A (en) 2021-09-27 2021-09-27 Data storage method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115878605A (en)

Similar Documents

Publication Publication Date Title
CN107450979B (en) Block chain consensus method and device
CN107038041B (en) Data processing method, error code dynamic compatibility method, device and system
CN108268289B (en) Parameter configuration method, device and system for web application
CN108848244B (en) Page display method and device
CN110263050B (en) Data processing method, device, equipment and storage medium
CN108845876B (en) Service distribution method and device
CN107578338B (en) Service publishing method, device and equipment
CN107528885B (en) Service request processing method and device
CN109597678B (en) Task processing method and device
CN111241040B (en) Information acquisition method and device, electronic equipment and computer storage medium
CN111355672A (en) Message forwarding method and device
CN111273965B (en) Container application starting method, system and device and electronic equipment
CN112163150A (en) Information pushing method and device
CN110083602B (en) Method and device for data storage and data processing based on hive table
CN107704502B (en) Routing method, device, equipment and system
CN108769152B (en) Service refresh policy registration method, service refresh request method, device and equipment
CN109446271B (en) Data synchronization method, device, equipment and medium
CN111538667A (en) Page testing method and device
CN115878605A (en) Data storage method and device, electronic equipment and storage medium
CN113254163B (en) Processing method and device of block chain data
CN111339117B (en) Data processing method, device and equipment
CN111796864A (en) Data verification method and device
CN112596780A (en) Service execution method and device
CN112286572A (en) Configuration method and device of business process
CN107645541B (en) Data storage method and device and server

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