CN112988737B - Data storage method and device, data acquisition method and device and electronic equipment - Google Patents

Data storage method and device, data acquisition method and device and electronic equipment Download PDF

Info

Publication number
CN112988737B
CN112988737B CN201911291142.7A CN201911291142A CN112988737B CN 112988737 B CN112988737 B CN 112988737B CN 201911291142 A CN201911291142 A CN 201911291142A CN 112988737 B CN112988737 B CN 112988737B
Authority
CN
China
Prior art keywords
class
stored
database
full
path
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.)
Active
Application number
CN201911291142.7A
Other languages
Chinese (zh)
Other versions
CN112988737A (en
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 QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201911291142.7A priority Critical patent/CN112988737B/en
Publication of CN112988737A publication Critical patent/CN112988737A/en
Application granted granted Critical
Publication of CN112988737B publication Critical patent/CN112988737B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures

Abstract

The application provides a data storage method and device, a data acquisition method and device and electronic equipment, wherein the method comprises the following steps: acquiring the full class name and the identification mark of the object to be stored; under the condition that the class path of the object to be stored is inquired in a first database based on the full class name, combining the full class name and the identification mark to form an inquiry key value; the class path of the object to be stored is stored with a directory file of the class object corresponding to the object to be stored; and storing the object content of the object to be stored and the query key value in a second database in an associated manner. The embodiment of the application can improve the development efficiency of the program.

Description

Data storage method and device, data acquisition method and device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data storage method and apparatus, a data acquisition method and apparatus, and an electronic device.
Background
With the rapid development of network technology, the docking data of the application program APP of the electronic device has the characteristics of multiple types and large quantity, and the like, and a very large number of attributes can be stored for each object. Taking odd-spectrum data as an example, the data types can comprise various data such as video, album, play list, live broadcast and the like, each data type has own data structure, and the data type has deep hierarchy and more attributes of each object.
In the prior art, when data is stored in a database, all data types and all attributes of each object in the data types are usually stored in the database, so that when data is acquired from the database, a reusable component java bean is required to be used for each object to construct a data structure of the object, and all the attributes of the object are acquired, thereby resulting in lower development efficiency of a program.
Disclosure of Invention
The embodiment of the application provides a data storage method and device, a data acquisition method and device and electronic equipment, which are used for solving the problem that when data is stored in a database, the data type of an object and all attributes of the object are stored, so that when the object is acquired from the database, all the attributes of the object are required to be acquired through a reusable component JavaBean, and the development efficiency of a program is low.
In a first aspect, an embodiment of the present application provides a data storage method, where the method includes:
acquiring the full class name and the identification mark of the object to be stored;
under the condition that the class path of the object to be stored is inquired in a first database based on the full class name, combining the full class name and the identification mark to form an inquiry key value; the class path of the object to be stored is stored with a directory file of the class object corresponding to the object to be stored;
and storing the object content of the object to be stored and the query key value in a second database in an associated manner.
In a second aspect, an embodiment of the present application further provides a data acquisition method, where the method includes:
acquiring the full class name and the identification of the object to be acquired;
under the condition that the class path associated with the full class name is inquired in a first database, acquiring a directory file stored in the class path associated with the full class name;
under the condition that the object content related to the query key value is queried in the second database, acquiring the object content related to the query key value; wherein the query key value is formed by combining the full class name and the identification mark;
and determining the object to be acquired based on the directory file and the object content.
In a third aspect, an embodiment of the present application further provides a data storage device, including:
the first acquisition module is used for acquiring the full class name and the identification mark of the object to be stored;
the combination module is used for combining the full class name and the identification mark to form a query key value under the condition that the class path of the object to be stored is queried in the first database based on the full class name; the class path of the object to be stored is stored with a directory file of the class object corresponding to the object to be stored;
and the first storage module is used for storing the object content of the object to be stored and the query key value in a second database in an associated manner.
In a fourth aspect, an embodiment of the present application further provides a data acquisition apparatus, where the apparatus includes:
the second acquisition module is used for acquiring the full class name and the identification mark of the object to be acquired;
the third acquisition module is used for acquiring the directory file stored in the class path associated with the full class name under the condition that the class path associated with the full class name is inquired in the first database;
a fourth obtaining module, configured to obtain, when it is queried in the second database that the query key value is associated with the object content, the object content associated with the query key value; wherein the query key value is formed by combining the full class name and the identification mark;
a determining module for determining the object to be acquired based on the directory file and the object content
In a fifth aspect, an embodiment of the present application further provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program when executed by the processor implements the steps of the data storage method or implements the steps of the data acquisition method.
In a sixth aspect, embodiments of the present application further provide a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the steps of the above-described data storage method, or implements the steps of the above-described data acquisition method.
In the embodiment of the application, under the condition that the class path of the object to be stored is queried in the first database based on the full class name, the query key value is formed by combining the full class name and the identification mark, and the object content of the object to be stored and the query key value are associated and stored in the second database, so that the object can be directly acquired through the directory file of the class object stored in the class path and the object content associated with the query key value.
Compared with the prior art, the object content of the object to be stored is stored according to the object unit when being stored, so that the data access layer code for acquiring the object attribute can be not required to be written when the object is acquired, and the code writing is simpler. In addition, the directory files of the class objects corresponding to the objects are stored, so that the data structures of the objects can be directly obtained, the directory files of the class objects in the database can be copied during program development, and the directory files can be directly input in the program without writing a large number of reusable components Java beans to construct the data structures of the objects. In this way, the development efficiency of the program can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort to a person of ordinary skill in the art.
FIG. 1 is a flow chart of a data storage method provided by an embodiment of the present application;
FIG. 2 is a flow chart of a data acquisition method provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of data storage in an embodiment of the application;
FIG. 4 is a block diagram of a data storage device according to an embodiment of the present application;
FIG. 5 is a second block diagram of a data storage device according to an embodiment of the present application;
FIG. 6 is a block diagram of a data acquisition device according to an embodiment of the present application;
FIG. 7 is a second block diagram of a data acquisition device according to an embodiment of the present application;
fig. 8 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
First, a data storage method provided by the embodiment of the present application is described.
It should be noted that the data storage method provided by the embodiment of the application can be applied to electronic equipment. Optionally, the electronic device may be a database server, configured to store the data structure and the object content of the data object in the database by using the object as a unit, so that the purpose of improving the program development efficiency can be achieved when the data object is obtained from the database.
In the following embodiments, the electronic device will be described in detail taking a database server as an example.
Referring to fig. 1, fig. 1 is a flowchart of a data storage method according to an embodiment of the present application, as shown in fig. 1, including the following steps:
step 101, obtaining the full class name and the identification mark of an object to be stored;
102, combining the full class name and the identification mark to form a query key value under the condition that the class path of the object to be stored is queried in a first database based on the full class name; the class path of the object to be stored is stored with a directory file of the class object corresponding to the object to be stored;
and step 103, storing the object content of the object to be stored and the query key value association in a second database.
In step 101, the object to be stored may be an instantiation object, which is a specific concept, such as a specific person, which may include a plurality of attributes, such as name, gender, etc.
Unlike class objects, which are abstract concepts, such as objects are human, an instantiation object can be created by instantiating a class object, and an instantiation process is a process of assigning a specific attribute to a class object, such as assigning a specific attribute to a human, and a specific person can be formed.
The object to be stored may be a data object to be stored in a database server, so that the data object may be saved, or may be developed and used by other service parties.
Further, for the specific implementation of step 101, first, the database server may receive information to be stored sent by the terminal device, where the information to be stored may include the object to be stored and an identification identifier of the object to be stored. The identification mark can comprise at least one of elements such as numbers, symbols, characters and the like, can be set by user definition, or can be automatically generated through a certain rule.
Then, the data server can judge whether the information to be stored comprises the full class name of the object to be stored, if so, the database server can acquire the full class name of the object to be stored based on the information to be stored; if not, the database server can reflect the object to be stored to obtain the full class name of the object to be stored.
In step 102, the database server may include a first database, where the first database stores the full class name of the data object and the class path in association, where the class path is a storage path of the directory file of the class object, and if the storage path is a D disc, that is, the directory file of the stored class object may be obtained at a corresponding location based on the class path. The directory file of the class object may represent a data structure of the class object, and includes a directory of each attribute in the class object, where the directory may be empty or may store description information of the attribute, which is not limited herein specifically.
Because the full class name and the class path of the data object are stored in the first database in an associated mode, when the object to be stored is stored, whether the class path associated with the full class name of the object to be stored is included in the first database can be inquired based on the association relation stored in the first database. And the class path stores a directory file of the class object corresponding to the object to be stored.
If the class path of the object to be stored is queried in the first database based on the full class name, the directory file of the class object corresponding to the object to be stored is indicated to be stored in the database server, and therefore, only the object content of the object to be stored is needed to be stored.
Further, there may be a variety of specific implementations of step 102.
For example, the full class name and the identification mark may be combined to form a query key in a prefix concatenation manner, and in an optional embodiment, the combining the full class name and the identification mark to form a query key includes: and performing prefix splicing on the identification identifier based on the full class name to generate the query key value. In another optional embodiment, the combining the full class name and the identification identifier to form a query key value includes: and performing prefix splicing on the full class name based on the identification mark to generate the query key value.
For another example, the query key value may be generated by combining the full class name and the identification identifier and combining other information. In short, the query key value formed by combining the full class name and the identification mark can be used as a query index to query and obtain the data object corresponding to the full class name and the identification mark.
In step 103, the object content may include an attribute field and field data, where the attribute field characterizes an attribute identifier of the object to be stored, and the field data characterizes an attribute content of the object to be stored. Wherein, for each attribute field, there may be field data corresponding thereto.
For example, for an object to be stored for user a, user a may include a plurality of attributes, each of which may be characterized by attribute fields such as name, gender, age, etc., and the field data corresponding to the attribute field "name" is "Zhang san", the field data corresponding to the attribute field "gender" is "men", and the field data corresponding to the attribute field "age" is "30".
Further, for the specific implementation of step 103, the database server may further include a second database, where the second database is used to store the object content of the data object. In order to facilitate the acquisition and maintenance of the data object, when the object content of the object to be stored is stored, the object content of the object to be stored and the query key value are stored in a second database in an associated mode.
In addition, the storage format of the object content may adopt an object numbered musical notation (JavaScript Object Notation, JSON) format, wherein the JSON format is used as a lightweight data exchange format, and attribute fields and field data are aligned in tandem to correspond to each other. For example, for the object to be stored for user a, the object content in JSON format is { "name", "Zhang Sano"; "sex", "men"; "age", "30", and so, by sequentially arranging each attribute field and field data one after another, the correspondence relationship between the attribute field and field data can be ensured.
According to the data storage method provided by the embodiment of the application, under the condition that the class path of the object to be stored is queried in the first database based on the full class name, the query key value is formed by combining the full class name and the identification mark, and the object content of the object to be stored and the query key value are stored in the second database in an associated manner, so that the object can be directly acquired through the directory file of the class object stored in the class path and the object content associated with the query key value.
Compared with the prior art, the object content of the object to be stored is stored according to the object unit when being stored, so that the data access layer code for acquiring the object attribute can be not required to be written when the object is acquired, and the code writing is simpler. In addition, the directory files of the class objects corresponding to the objects are stored, so that the data structures of the objects can be directly obtained, the directory files of the class objects in the database can be copied during program development, and the directory files can be directly input in the program without writing a large number of reusable components Java beans to construct the data structures of the objects. In this way, the development efficiency of the program can be improved.
In addition, the catalog file of the class object is stored, so that the data structure of the object is stored by taking the class object as a unit, the standardization of data storage is enhanced, and the later maintenance is facilitated.
In addition, the object content is stored according to the JSON format by taking the object as a unit, and the corresponding relation between the attribute field and the field data of the object content is clear, so that when the data object is acquired in the later period, the corresponding relation between each attribute field and the field data in the data object is not required to be matched, and the later maintenance cost can be reduced. When other databases are synchronized, the object contents are stored according to the object unit, so that the attribute fields of the data object and the source data object which are synchronized subsequently can be ensured to be consistent, and the later maintenance cost is reduced.
Optionally, based on embodiment one, before the step 103, the method further includes:
serializing the class object corresponding to the object to be stored under the condition that the class path of the object to be stored is not queried in the first database based on the full class name, and obtaining a directory file; wherein the directory file comprises a directory of each attribute in the class object;
storing the association of the full class name and the class path of the object to be stored in the first database; and the directory file is stored in the class path of the object to be stored.
In the embodiment of the present application, if the class path of the object to be stored is not queried in the first database based on the full class name, it indicates that the directory file of the class object corresponding to the object to be stored is not stored in the database server, so that it is required to first create the directory file of the class object corresponding to the object to be stored, and add the class path of the object to be stored in the first database.
In the specific implementation process, first, based on each attribute of the class object corresponding to the object to be stored, the class objects of the class of the object to be stored may be serialized to obtain a fixed directory. Based on these directories, a directory file may be generated, where the directory file may be a file obtained by compressing these directories.
And then, storing the catalog file in a preset position to obtain a class path of the object to be stored, and storing the association of the full class name and the class path of the object to be stored in the first database. The preset position may be a preset position for storing a directory file of the class object, such as a D disc.
Therefore, under the condition that the class path of the object to be stored is not queried in the first database based on the full class name, the directory file of the class object corresponding to the object to be stored is generated, so that the data structure of the newly added class object can be automatically stored, the subsequent use is convenient, the data structure stored in the first database can be expanded, and the data objects in the database are enriched.
Optionally, the first database and the second database are deployed in the same database container. Specifically, the data processing program can be packaged, a data processing interface such as a storage interface, an acquisition interface, a modification interface and the like is provided, and the packaged program, the first database and the second database are all deployed in the same database container, so that only the database container is required to be copied when the data processing is performed based on the database, and the development efficiency of the program can be further improved.
The following describes a data acquisition method provided in the embodiment of the present application.
It should be noted that the data acquisition method provided by the embodiment of the application can be applied to electronic equipment. Optionally, the electronic device may be a database server, configured to obtain, for a data object stored in a database, the data object from the database based on a full class name and an identification identifier of the data object, so as to achieve the purpose of improving program development efficiency.
Referring to fig. 2, fig. 2 is a flowchart of a data acquisition method according to an embodiment of the present application, as shown in fig. 2, including the following steps:
step 201, acquiring a full class name and an identification mark of an object to be acquired;
step 202, under the condition that a class path associated with the full class name is queried in a first database, acquiring a directory file stored in the class path associated with the full class name;
step 203, under the condition that the object content associated with the query key value is queried in the second database, acquiring the object content associated with the query key value; wherein the query key value is formed by combining the full class name and the identification mark;
and step 204, determining the object to be acquired based on the directory file and the object content.
In step 201, the object to be acquired is also an instantiation object, such as a data object of user a.
Further, for the specific implementation of step 201, the database server may receive the description information of the object to be obtained sent by the terminal device, where the description information of the object to be obtained may include a full class name and an identification identifier of the object to be obtained. Correspondingly, the database server acquires the full class name and the identification identifier of the object to be acquired from the description information of the object to be acquired.
Step 202 is a process of obtaining the data structure of the object to be obtained, specifically, based on the full class name, inquiring whether there is a class path associated with the full class name in the first database, if yes, obtaining a directory file stored in the class path associated with the full class name, if not, ending the data obtaining process, or triggering other processes.
Step 203 is a process of obtaining the object content of the object to be obtained, specifically, firstly, a query key value is formed based on the combination of the full class name and the identification mark, then, based on the query key value, whether the object content associated with the query key value exists is queried in the second database, if yes, the object content associated with the query key value is obtained, if not, the data obtaining process may be ended, or other processes may be triggered.
The implementation manner of forming the query key value based on the combination of the full class name and the identification mark can also comprise a plurality of implementations.
For example, the full class name and the identification mark may be combined to form a query key in a prefix concatenation manner, and in an optional embodiment, the combining the full class name and the identification mark to form a query key includes: and performing prefix splicing on the identification identifier based on the full class name to generate the query key value. In another optional embodiment, the combining the full class name and the identification identifier to form a query key value includes: and performing prefix splicing on the full class name based on the identification mark to generate the query key value.
For another example, the query key value may be generated by combining the full class name and the identification identifier and combining other information.
In summary, in order to obtain the object content based on the query key value, the implementation manner of forming the query key value based on the combination of the full class name and the identification identifier in the flow of the data obtaining method needs to be consistent with the implementation manner of forming the query key value based on the combination of the full class name and the identification identifier in the flow of the data storing method.
The specific implementation of step 204 may be that, based on the data structure represented by the directory file, the object content is arranged, so as to generate the object to be acquired.
In practical application, if other service parties need to use the data object in the process of program development, the catalog files of the first database, the second database and the class object can be directly copied and input in the program, so that the data multiplexing in the databases can be realized.
According to the data acquisition method provided by the embodiment of the application, under the condition that the class path associated with the full class name is inquired in the first database, the directory file stored in the class path associated with the full class name is acquired; under the condition that the object content related to the query key value is queried in the second database, acquiring the object content related to the query key value; and determining the object to be acquired based on the directory file and the object content. Thus, compared with the prior art, when the data object is acquired, the code of the data access layer for acquiring the object attribute does not need to be written, so that the code writing is simpler. Moreover, a large number of reusable components JavaBean need not be written to construct the data structure of the object. In this way, the development efficiency of the program can be improved.
For a better understanding of the overall process, please refer to fig. 3, fig. 3 is a schematic diagram illustrating data storage in an embodiment of the present application.
As shown in fig. 3, two databases may be used to store data objects, one of which stores the full class name of the data object, which may be referred to as a class_data database, and the other of which stores the object content of the data object in JSON format, which may be referred to as a value_data database.
First, when the instantiation object a needs to be stored in the database, the instantiation object a and the identification identifier of the instantiation object a are acquired, where the identification identifier can be set by user definition.
Then, the instantiation object A is reflected to obtain the full class name of the instantiation object A.
Then, if the class path associated with the full class name is not queried in the class_data database based on the full class name, the class object corresponding to the instantiation object A is serialized to obtain the directory file. And obtaining the class path of the directory file, and simultaneously storing the full class name and the class path association of the directory file in a class_data database. And under the condition that the class path associated with the full class name is queried by the class_data database based on the full class name, prefix splicing is carried out on the identification identifier based on the full class name, and a query key value is generated.
Finally, the object content of the instantiation object A and the query key value association are stored in a value_data database.
Accordingly, when the instantiation object a is acquired, a class path associated with the full class name can be inquired and acquired from a class_data database based on the full class name and the identification identifier of the instantiation object a, a directory file of a class object corresponding to the instantiation object a is acquired based on the class path, and object content associated with an inquiry key value is inquired and acquired from a value_data database, so that the instantiation object a can be acquired based on the directory file and the object content.
Since the object content of the instantiation object a is stored in units of objects when stored, when the instantiation object a is later acquired, the data access layer code for acquiring the attribute of the instantiation object a can be unnecessary to write, so that the code writing is simpler. In addition, the data structure of the instantiation object A can be directly obtained by storing the catalog file of the class object corresponding to the instantiation object A, so that the catalog file of the class object in the database can be copied during program development, and the catalog file can be directly input in the program without writing a large number of reusable components JavaBean to construct the data structure of the instantiation object A. In this way, the development efficiency of the program can be improved.
The following describes a data storage device provided in an embodiment of the present application.
Referring to fig. 4, fig. 4 is a block diagram of a data storage device according to an embodiment of the present application, which can implement details of the above data storage method and achieve the same effects. As shown in fig. 4, the data storage device 400 includes:
a first obtaining module 401, configured to obtain a full class name and an identification of an object to be stored;
a combination module 402, configured to combine the full class name and the identification identifier to form a query key value when the class path of the object to be stored is queried in the first database based on the full class name; the class path of the object to be stored is stored with a directory file of the class object corresponding to the object to be stored;
a first storage module 403, configured to store the object content of the object to be stored and the query key association in a second database.
Optionally, referring to fig. 5, fig. 5 is a second block diagram of a data storage device according to an embodiment of the present application, as shown in fig. 5, the data storage device 400 further includes
A serialization module 404, configured to serialize, based on the full class name, a class object corresponding to the object to be stored to obtain a directory file when the class path of the object to be stored is not queried in the first database; wherein the directory file comprises a directory of each attribute in the class object;
a second storage module 405, configured to store the full class name and the class path association of the object to be stored in the first database; and the directory file is stored in the class path of the object to be stored.
Optionally, the combining module 402 is specifically configured to perform prefix stitching on the identification identifier based on the full class name, so as to generate the query key value.
Optionally, the first database and the second database are deployed in the same database container.
The data storage device 400 can implement each process implemented by the electronic device in the embodiment of the data storage method, and can achieve the same technical effects, so that repetition is avoided and no further description is given here.
The following describes a data acquisition device provided in an embodiment of the present application.
Referring to fig. 6, fig. 6 is a block diagram of a data acquisition device according to an embodiment of the present application, which can implement details of the above data acquisition method and achieve the same effects. As shown in fig. 6, the data acquisition apparatus 600 includes:
a second obtaining module 601, configured to obtain a full class name and an identification of an object to be obtained;
a third obtaining module 602, configured to obtain, when the class path associated with the full class name is queried in the first database, a directory file stored in the class path associated with the full class name;
a fourth obtaining module 603, configured to obtain, when it is queried in the second database that the query key value is associated with the object content, the object content associated with the query key value; wherein the query key value is formed by combining the full class name and the identification mark;
a determining module 604, configured to determine the object to be acquired based on the directory file and the object content.
Optionally, referring to fig. 7, fig. 7 is a second structural diagram of a data acquisition device according to an embodiment of the present application, as shown in fig. 7, the data acquisition device 600 further includes:
and the generating module 605 is configured to perform prefix splicing on the identification identifier based on the full class name, and generate the query key value.
The data acquisition device 600 can implement each process implemented by the electronic device in the embodiment of the data acquisition method, and achieve the same technical effects, and for avoiding repetition, a detailed description is omitted here.
Referring to fig. 8, fig. 8 is a block diagram of an electronic device according to an embodiment of the present application, where the electronic device shown in fig. 8 includes: a processor 801, a memory 802 and a computer program stored on the memory 802 and executable on the processor, the individual components in the electronic device being coupled together by a bus interface 803, the computer program when executed by the processor 801 implementing the steps of:
acquiring the full class name and the identification mark of the object to be stored;
under the condition that the class path of the object to be stored is inquired in a first database based on the full class name, combining the full class name and the identification mark to form an inquiry key value; the class path of the object to be stored is stored with a directory file of the class object corresponding to the object to be stored;
and storing the object content of the object to be stored and the query key value in a second database in an associated manner.
Optionally, the processor 801 is further configured to:
serializing the class object corresponding to the object to be stored under the condition that the class path of the object to be stored is not queried in the first database based on the full class name, and obtaining a directory file; wherein the directory file comprises a directory of each attribute in the class object;
storing the association of the full class name and the class path of the object to be stored in the first database; and the directory file is stored in the class path of the object to be stored.
Optionally, the processor 801 is specifically configured to:
and performing prefix splicing on the identification identifier based on the full class name to generate the query key value.
Optionally, the first database and the second database are deployed in the same database container.
In addition, the computer program may also implement the following steps when executed by the processor 801:
acquiring the full class name and the identification of the object to be acquired;
under the condition that the class path associated with the full class name is inquired in a first database, acquiring a directory file stored in the class path associated with the full class name;
under the condition that the object content related to the query key value is queried in the second database, acquiring the object content related to the query key value; wherein the query key value is formed by combining the full class name and the identification mark;
and determining the object to be acquired based on the directory file and the object content.
Optionally, the processor 801 is further configured to:
and performing prefix splicing on the identification identifier based on the full class name to generate the query key value.
Preferably, the embodiment of the present application further provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program when executed by the processor implements each process of the data storage method of any one of the method embodiments, or implements each process of the data acquisition method of any one of the method embodiments, and the same technical effect can be achieved, so that repetition is avoided, and no further description is given here.
The embodiment of the application also provides a computer readable storage medium, on which a computer program is stored, where the computer program realizes each process of the data storage method or each process of the data acquisition method when executed by a processor, and the same technical effects can be achieved, and in order to avoid repetition, details are not repeated here. Wherein the computer readable storage medium is selected from Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present application.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (10)

1. A method of data storage, the method comprising:
acquiring the full class name and the identification mark of the object to be stored;
under the condition that the class path of the object to be stored is inquired in a first database based on the full class name, combining the full class name and the identification mark to form an inquiry key value; the class path of the object to be stored is stored with a directory file of the class object corresponding to the object to be stored;
the object content of the object to be stored and the query key value are stored in a second database in an associated mode;
the first database is used for storing the full class name and class path of the data object in an associated mode, the class path is a storage path of the directory file of the class object, the directory file of the class object represents the data structure of the class object, and the directory file of the class object comprises the directory of each attribute in the class object.
2. The method of claim 1, wherein prior to storing the object content of the object to be stored and the query key association in a second database, the method further comprises:
serializing the class object corresponding to the object to be stored under the condition that the class path of the object to be stored is not queried in the first database based on the full class name, and obtaining a directory file; wherein the directory file comprises a directory of each attribute in the class object;
storing the association of the full class name and the class path of the object to be stored in the first database; and the directory file is stored in the class path of the object to be stored.
3. The method of claim 1, wherein said combining the full class name and the identification tag to form a query key comprises:
and performing prefix splicing on the identification identifier based on the full class name to generate the query key value.
4. A method according to any one of claims 1 to 3, wherein the first database and the second database are deployed in the same database container.
5. A method of data acquisition, the method comprising:
acquiring the full class name and the identification of the object to be acquired;
under the condition that the class path associated with the full class name is inquired in a first database, acquiring a directory file stored in the class path associated with the full class name;
under the condition that the object content related to the query key value is queried in the second database, acquiring the object content related to the query key value; wherein the query key value is formed by combining the full class name and the identification mark;
determining the object to be acquired based on the directory file and the object content;
the first database is used for storing the full class name and class path of the data object in an associated mode, the class path is a storage path of the directory file of the class object, the directory file of the class object represents the data structure of the class object, and the directory file of the class object comprises the directory of each attribute in the class object.
6. The method according to claim 5, wherein, in the case that the object content associated with the query key is queried in the second database, before the object content associated with the query key is acquired, the method further comprises:
and performing prefix splicing on the identification identifier based on the full class name to generate the query key value.
7. A data storage device, the device comprising:
the first acquisition module is used for acquiring the full class name and the identification mark of the object to be stored;
the combination module is used for combining the full class name and the identification mark to form a query key value under the condition that the class path of the object to be stored is queried in the first database based on the full class name; the class path of the object to be stored is stored with a directory file of the class object corresponding to the object to be stored;
the first storage module is used for storing the object content of the object to be stored and the query key value in a second database in an associated manner;
the first database is used for storing the full class name and class path of the data object in an associated mode, the class path is a storage path of the directory file of the class object, the directory file of the class object represents the data structure of the class object, and the directory file of the class object comprises the directory of each attribute in the class object.
8. A data acquisition device, the device comprising:
the second acquisition module is used for acquiring the full class name and the identification mark of the object to be acquired;
the third acquisition module is used for acquiring the directory file stored in the class path associated with the full class name under the condition that the class path associated with the full class name is inquired in the first database;
a fourth obtaining module, configured to obtain, when it is queried in the second database that the query key value is associated with the object content, the object content associated with the query key value; wherein the query key value is formed by combining the full class name and the identification mark;
the determining module is used for determining the object to be acquired based on the directory file and the object content;
the first database is used for storing the full class name and class path of the data object in an associated mode, the class path is a storage path of the directory file of the class object, the directory file of the class object represents the data structure of the class object, and the directory file of the class object comprises the directory of each attribute in the class object.
9. An electronic device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program implementing the steps of the data storage method according to any one of claims 1 to 4 or the steps of the data acquisition method according to any one of claims 5 to 6 when executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the data storage method according to any one of claims 1 to 4, or the steps of the data acquisition method according to any one of claims 5 to 6.
CN201911291142.7A 2019-12-16 2019-12-16 Data storage method and device, data acquisition method and device and electronic equipment Active CN112988737B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911291142.7A CN112988737B (en) 2019-12-16 2019-12-16 Data storage method and device, data acquisition method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911291142.7A CN112988737B (en) 2019-12-16 2019-12-16 Data storage method and device, data acquisition method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112988737A CN112988737A (en) 2021-06-18
CN112988737B true CN112988737B (en) 2023-09-15

Family

ID=76343011

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911291142.7A Active CN112988737B (en) 2019-12-16 2019-12-16 Data storage method and device, data acquisition method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112988737B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005057364A2 (en) * 2003-12-08 2005-06-23 Ebay Inc. Custom caching
US7954110B1 (en) * 2004-06-22 2011-05-31 Apple Inc. Observing properties associated with an object in an object-oriented programming platform
CN102156717A (en) * 2011-03-25 2011-08-17 中国有色矿业集团有限公司 Method and device for mapping entity object into database
CN110287185A (en) * 2019-05-29 2019-09-27 南京理工大学 The storage organization and method of the many-one relationship inquiry of Oriented Documents key value database
CN110321367A (en) * 2019-06-28 2019-10-11 北京奇艺世纪科技有限公司 A kind of date storage method, data query method and relevant apparatus, electronic equipment
CN110457132A (en) * 2019-08-01 2019-11-15 武汉斗鱼鱼乐网络科技有限公司 A kind of creation method of functional object, device and terminal device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7284010B2 (en) * 2003-10-23 2007-10-16 Microsoft Corporation System and method for storing and retrieving a field of a user defined type outside of a database store in which the type is defined
US9934258B2 (en) * 2014-03-31 2018-04-03 Oracle International Corporation Dynamic generation of database views and class objects for providing access to repository data
US10824636B2 (en) * 2015-05-27 2020-11-03 Kaseya International Limited Mechanisms for querying disparate data storage systems

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005057364A2 (en) * 2003-12-08 2005-06-23 Ebay Inc. Custom caching
US7954110B1 (en) * 2004-06-22 2011-05-31 Apple Inc. Observing properties associated with an object in an object-oriented programming platform
CN102156717A (en) * 2011-03-25 2011-08-17 中国有色矿业集团有限公司 Method and device for mapping entity object into database
CN110287185A (en) * 2019-05-29 2019-09-27 南京理工大学 The storage organization and method of the many-one relationship inquiry of Oriented Documents key value database
CN110321367A (en) * 2019-06-28 2019-10-11 北京奇艺世纪科技有限公司 A kind of date storage method, data query method and relevant apparatus, electronic equipment
CN110457132A (en) * 2019-08-01 2019-11-15 武汉斗鱼鱼乐网络科技有限公司 A kind of creation method of functional object, device and terminal device

Also Published As

Publication number Publication date
CN112988737A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
CN110009334B (en) Meckel tree construction and simple payment verification method and device
CN104391725B (en) Page display method and page presentation device
CN111352935B (en) Index creating method, device and equipment in block chain type account book
CN110162526A (en) Querying method, device and the equipment of data record in a kind of piece of chain type account book
JP2021518021A (en) Data processing methods, equipment and computer readable storage media
CN110851209A (en) Data processing method and device, electronic equipment and storage medium
CN113722323A (en) Service serial number generation method, sender assembly, equipment and storage medium
CN105117489B (en) Database management method and device and electronic equipment
CN109698814A (en) Botnet finds that method and Botnet find device
US20150112993A1 (en) Method and Apparatus for Importing and Exporting Contact
CN111143410A (en) Accommodation public security management method, device and system
CN105843809B (en) Data processing method and device
CN111930363B (en) Block interface code generation method and device
CN112988737B (en) Data storage method and device, data acquisition method and device and electronic equipment
CN111444194B (en) Method, device and equipment for clearing indexes in block chain type account book
WO2018177414A1 (en) Data processing method, data processing device, computing device, and storage medium
CN109800273A (en) A kind of method, apparatus of data processing, computer storage medium and terminal
CN112162731B (en) Data expansion method, device, storage medium and electronic device
CN113986828A (en) Method and device for storing mass files, electronic equipment and storage medium
CN111400269B (en) IPFS file processing method, node, medium and equipment
CN110636042B (en) Method, device and equipment for updating verified block height of server
CN108628862A (en) database addressing method, device and system
CN112052234A (en) Service data processing method and device, storage medium and electronic device
CN112764802A (en) Business logic customization method and device, electronic equipment and storage medium
RU2010116211A (en) PERSONALIZED CARDS COMBINED BY USING THE COMPUTERIZED CARDS SERVICE

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
GR01 Patent grant
GR01 Patent grant