Data storage and processing method, server, and computer-readable storage medium

By using basic information tables and storage information tables in data storage technology, combined with the unique label information of the md5 algorithm, the problem of repeated storage of resource files is solved, and the utilization rate of storage space and the efficiency of database are improved.

CN112966133BActive Publication Date: 2024-12-31SHENZHEN KONKA ELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110322047.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-25
Publication Date
2024-12-31
Estimated Expiration
2041-03-25

AI Technical Summary

Technical Problem

Existing data storage technologies will lead to duplicate storage when storing resource files, resulting in waste of storage space and database redundancy.

Method used

By pre-establishing the basic information table and the storage information table, the unique label information calculated by the md5 algorithm is used to determine whether the resource file has a history record. If it exists, only the mapping relationship between the current basic information and the historical storage information is saved to avoid repeated storage.

Benefits of technology

Reduces duplicate recording of stored information, improves the utilization of storage space, and avoids bandwidth waste and database redundancy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112966133B_ABST
    Figure CN112966133B_ABST
Patent Text Reader

Abstract

The present invention provides a data storage processing method, a server, and a computer-readable storage medium, wherein the data storage processing method includes: when receiving unique identification information corresponding to a resource file to be uploaded sent by a client, searching a storage information table according to the unique identification information; when finding that the unique identification information exists in the storage information table, obtaining the current basic information corresponding to the resource file to be uploaded sent by the client; determining the historical storage information corresponding to the unique identification information in the storage information table, and establishing a mapping relationship between the historical storage information and the current basic information. The present invention determines whether there is a historical record of the resource file to be uploaded through the unique identification information. If there is a historical record, only the current basic information corresponding to the resource file to be uploaded needs to be saved, which reduces the recording of storage information, avoids duplicate storage, and improves the utilization rate of storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data storage, and in particular to a data storage processing method, a server, and a computer-readable storage medium. Background Art

[0002] In the existing data storage process, each resource file uploaded by the user will generate a database record and correspond to a file stored on the hard disk. Even if it is the same resource file, the same database record will be generated when it is stored. In other words, if there are a large number of identical resource files, they will be stored repeatedly, resulting in a huge waste of storage space. In addition, all data records of existing resource files are stored in the same table, which will lead to redundant database fields and increase the storage of the database itself.

[0003] Therefore, the prior art has defects and needs to be improved and developed. Summary of the invention

[0004] The technical problem to be solved by the present invention is that, in view of the above-mentioned defects of the prior art, a data storage and processing method, a server and a computer-readable storage medium are provided, aiming to solve the problem of duplicate storage when storing resource files in the prior art, resulting in waste of storage space.

[0005] The technical solution adopted by the present invention to solve the technical problem is as follows:

[0006] A data storage and processing method, comprising:

[0007] When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, searching the storage information table according to the unique identification information;

[0008] When the unique identification information is found in the storage information table, the current basic information corresponding to the resource file to be uploaded sent by the client is obtained;

[0009] Determine the historical storage information corresponding to the unique identification information in the storage information table, and establish a mapping relationship between the historical storage information and the current basic information.

[0010] In a further implementation, when receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, before searching the storage information table according to the unique identification information, the method further includes:

[0011] Pre-establish basic information table and storage information table;

[0012] Among them, the basic information table is used to store the historical basic information of the uploaded resource files, the storage information table is used to store the historical storage information of the uploaded resource files and the unique identification information associated with the historical storage information, and there is a mapping relationship between the historical basic information and the historical storage information.

[0013] In a further implementation, the basic information of the resource file includes file name, file size, video file resolution or image file size, file number, creation date and number of references; the storage information of the resource file includes storage address and storage directory; the unique identification information is the md5 value of the resource file calculated according to the md5 algorithm.

[0014] In a further implementation, when receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, searching the storage information table according to the unique identification information includes:

[0015] When the client separates the resource file to be uploaded into the current basic information and the current storage information, and uploads the unique identification information corresponding to the resource file to be uploaded, the storage information table is searched according to the unique identification information.

[0016] In a further implementation, determining the historical storage information corresponding to the unique identification information in the storage information table and establishing a mapping relationship between the historical storage information and the current basic information includes:

[0017] storing the current basic information in the basic information table;

[0018] Determine the historical storage information corresponding to the unique identification information in the storage information table;

[0019] A mapping relationship between the current basic information and the historical storage information is established.

[0020] In a further implementation, when receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, after searching the storage information table according to the unique identification information, the method further includes:

[0021] When the unique identification information does not exist in the storage information table, the current basic information and current storage information corresponding to the resource file to be uploaded sent by the client are obtained.

[0022] In a further implementation, when the unique identification information does not exist in the storage information table, after obtaining the current basic information and current storage information corresponding to the resource file to be uploaded sent by the client, the method includes:

[0023] The current basic information is stored in the basic information table, and the current stored information and the unique identification information are stored in the stored information table, and the current stored information and the unique identification information are associated with each other;

[0024] A mapping relationship between the current basic information and the current stored information is established.

[0025] In a further implementation, the data storage processing method further includes:

[0026] Create an index that uniquely identifies the information.

[0027] The present invention also provides a server, which includes: a memory, a processor, and a data storage processing program stored in the memory and executable on the processor, wherein the data storage processing program implements the steps of the data storage processing method described above when executed by the processor.

[0028] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program can be executed to implement the steps of the data storage processing method as described above.

[0029] The present invention provides a data storage processing method, a server, and a computer-readable storage medium, wherein the data storage processing method includes: when receiving unique identification information corresponding to a resource file to be uploaded sent by a client, searching a storage information table according to the unique identification information; when finding that the unique identification information exists in the storage information table, obtaining the current basic information corresponding to the resource file to be uploaded sent by the client; determining the historical storage information corresponding to the unique identification information in the storage information table, and establishing a mapping relationship between the historical storage information and the current basic information. The present invention determines whether there is a historical record of the resource file to be uploaded through the unique identification information. If there is a historical record, only the current basic information corresponding to the resource file to be uploaded needs to be saved, and a mapping relationship is established between the current basic information and the historical storage information, thereby reducing the recording of storage information, preventing duplicate storage, and improving the utilization of storage space. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 It is a flow chart of a preferred embodiment of the data storage and processing method in the present invention.

[0031] Figure 2 It is a specific flow chart of step S300 in a preferred embodiment of the data storage and processing method of the present invention.

[0032] Figure 3It is a specific flow chart of the preferred embodiment of the data storage and processing method of the present invention when there is no unique identification information in the storage information table after step S100.

[0033] Figure 4 It is a functional principle block diagram of a preferred embodiment of the server in the present invention. DETAILED DESCRIPTION

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

[0035] For the existing data storage method, each resource file will generate a database record and correspond to a file stored on the hard disk. If there are a large number of identical files, it will cause a great waste of storage space. For example, there is a public platform system that needs to upload resource files. Different users are very likely to upload the same resource files, such as pictures, videos, and audios; even the same user will upload the same file repeatedly because of different file names, which will cause the upload process to consume a lot of bandwidth, and storing the same file will also waste space. Based on this situation, it is very necessary to optimize the data storage method. The present invention redesigns the database table to achieve the purpose of optimizing storage space.

[0036] See also Figure 1 , Figure 1 Flowchart of the data storage processing method in the present invention. Figure 1 As shown, the data storage and processing method described in the embodiment of the present invention includes the following steps:

[0037] Step S100: When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, searching the storage information table according to the unique identification information.

[0038] Specifically, users generally upload resource files to the server through a client. The client can be a smart terminal, and the server can be a server, including a physical server or a cloud server. If a user wants to upload a resource file, first, before uploading, it is necessary to check whether the resource file has been uploaded. The present invention determines whether the resource file has been uploaded based on the unique identification information of the resource file. For the same resource file, even if the file name, file number or creation date is different, its unique identification information is the same.

[0039] In one implementation, before step S100, the method further includes: pre-establishing a basic information table and a storage information table. The basic information table is used to store the historical basic information of the uploaded resource files, and the storage information table is used to store the historical storage information of the uploaded resource files and the unique identification information associated with the historical storage information, and there is a mapping relationship between the historical basic information and the historical storage information.

[0040] Specifically, when storing resource files in the existing server database, there is only one table, as shown in Table 1:

[0041] Table 1:

[0042]

[0043] In Table 1, the first record and the third record are the same files with different file names, but they are recorded repeatedly in the database, that is, the same audio file is stored twice.

[0044] The present invention pre-establishes two tables, a basic information table and a storage information table, as shown in Table 2 and Table 3:

[0045] Table 2:

[0046]

[0047]

[0048] Table 3:

[0049] id Storage Information Md5 … … 1 http: / / ip:port / Sfsfsfdd435354sfds.mp3 Sfsfsfdd435354sfds … … 2 http: / / ip:port / Dgd5464dgdgddfg.mp4 Dgd5464dgdgddfg … …

[0050] Among them, Table 2 is the basic information table, Table 3 is the storage information table, and the basic information table stores the basic information of each uploaded file. The basic information in the basic information table is associated with the storage information in the storage information table. The same file in the storage information table will only store one record, and the md5 value is used to represent the uniqueness. It can be seen that the first record and the third record in the basic information table are mapped to the first record in the storage information table, and the server stores only this one file; and so on.

[0051] Furthermore, the basic information of the resource file includes the file name, file size, video file resolution or image file size, file number, creation date and number of references; the storage information of the resource file includes the storage address and storage directory; the unique identification information is the md5 value of the resource file calculated according to the md5 algorithm. Specifically, the basic information of the resource file includes but is not limited to the file name, file size, video file resolution, image file size, file number, creation date, and number of references; the basic information is recorded at each file upload action and displayed to the client. The storage information of the resource file is mainly the storage address, storage directory, etc.; the storage information is associated with the basic information table, which is convenient for finding the storage information table according to the basic information table. The md5 value is the unique identifier of the resource file calculated by the resource file according to the md5 algorithm. It is a 32-bit unique string that is used to indicate the uniqueness of the resource.

[0052] The present invention establishes a basic information table to represent the basic attributes of a resource file, establishes a storage information table to represent the uniqueness and storage address of a file, and establishes an association relationship between the basic information and the storage information to establish a connection between the two. In this way, when a client uploads the same resource file, it is no longer necessary to repeatedly store the file itself and the database record, the database table structure is clearer, and the hard disk space utilization rate is improved.

[0053] In a further implementation, the step S100 is specifically as follows: when the client separates the resource file to be uploaded into current basic information and current storage information, and uploads the unique identification information corresponding to the resource file to be uploaded, searching the storage information table according to the unique identification information.

[0054] The present invention separates the basic information and storage information of the resource file through the client, and adds the md5 value to the storage information as a unique mark, so that the resource file can be separated into two database tables and the association relationship between the two is added. In this way, the same resource file is distinguished by the md5 value, and the same file does not need to be stored multiple times, thereby improving the utilization rate of the storage space.

[0055] The step S100 is followed by: step S200, when the storage information table is found to contain the unique identification information, obtaining the current basic information corresponding to the resource file to be uploaded sent by the client.

[0056] Specifically, when a user uploads a resource file on the client, the unique identification information (i.e., md5 value) of the resource file is first calculated, and the unique identification information is sent to the server. In other words, the client does not upload the resource file first, but only transmits the unique identification information of the resource file. Since the server stores a storage information table, and the storage information table stores the unique identification information of the historical record, it is only necessary to check whether the unique identification information exists in the storage information table to determine whether the resource file has been uploaded.

[0057] When the unique identification information is found in the storage information table, it is determined that the resource file to be uploaded has been uploaded, and the client does not need to upload the current storage information corresponding to the resource file to be uploaded, but only needs to upload the current basic information corresponding to the resource file to be uploaded. The server only receives the current basic information corresponding to the resource file to be uploaded.

[0058] The step S200 includes: step S300, determining the historical storage information corresponding to the unique identification information in the storage information table, and establishing a mapping relationship between the historical storage information and the current basic information.

[0059] In one implementation, see Figure 2 , the step S300 specifically includes:

[0060] Step S310, storing the current basic information in the basic information table;

[0061] Step S320, determining the historical storage information corresponding to the unique identification information in the storage information table;

[0062] Step S330: Establish a mapping relationship between the current basic information and the historical storage information.

[0063] Specifically, the current storage information of the resource file to be uploaded has a historical record, and a mapping relationship between the historical storage information and the current basic information is directly established, without repeatedly saving the storage information corresponding to the resource file, thereby improving the utilization rate of the storage space.

[0064] For further information, see Figure 3 , after step S100, the following further includes: step S410, when the unique identification information does not exist in the storage information table, obtaining the current basic information and current storage information corresponding to the resource file to be uploaded sent by the client.

[0065] When the unique identification information does not exist in the storage information table, it means that the resource file to be uploaded has not been uploaded, and the client needs to upload the complete resource file. That is, the current storage information and current storage information corresponding to the resource file to be uploaded are uploaded to the server. The server receives the current basic information and current storage information corresponding to the resource file to be uploaded.

[0066] After step S410, the following steps are further included:

[0067] Step S420: storing the current basic information in the basic information table, storing the current stored information and the unique identification information in the stored information table, and the current stored information and the unique identification information are associated with each other;

[0068] Step S430: Establish a mapping relationship between the current basic information and the current stored information.

[0069] That is to say, the current basic information and the current stored information become the historical basic information and the historical stored information for reference when uploading resource files later.

[0070] In one implementation, the data storage and processing method further includes: establishing an index corresponding to the unique identification information. That is, establishing an index for the md5 column can improve database retrieval efficiency, and the reduction of stored information records will also increase database retrieval speed.

[0071] Furthermore, if Figure 4 As shown, based on the above data storage and processing method, the present invention also provides a server, including a processor 10 and a memory 20. Figure 4 Only some components of the server are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.

[0072] In some embodiments, the memory 20 may be an internal storage unit of the server, such as a hard disk or memory of the server. In other embodiments, the memory 20 may also be an external storage device of the server, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the server. Furthermore, the memory 20 may also include both an internal storage unit and an external storage device of the server. The memory 20 is used to store application software and various types of data installed on the server, such as program codes for installing the server. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a data storage processing program 30 is stored on the memory 20, and the data storage processing program 30 can be executed by the processor 10, thereby realizing the data storage processing method in the present application.

[0073] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code stored in the memory 20 or process data, such as executing the data storage processing method.

[0074] In one embodiment, when the processor 10 executes the data storage processing program 30 in the memory 20, the following steps are implemented:

[0075] When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, searching the storage information table according to the unique identification information;

[0076] When the unique identification information is found in the storage information table, the current basic information corresponding to the resource file to be uploaded sent by the client is obtained;

[0077] Determine the historical storage information corresponding to the unique identification information in the storage information table, and establish a mapping relationship between the historical storage information and the current basic information.

[0078] When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, before searching the storage information table according to the unique identification information, the method further includes:

[0079] Pre-establish basic information table and storage information table;

[0080] Among them, the basic information table is used to store the historical basic information of the uploaded resource files, the storage information table is used to store the historical storage information of the uploaded resource files and the unique identification information associated with the historical storage information, and there is a mapping relationship between the historical basic information and the historical storage information.

[0081] The basic information of the resource file includes the file name, file size, video file resolution or image file size, file number, creation date and number of references; the storage information of the resource file includes the storage address and storage directory; the unique identification information is the md5 value of the resource file calculated according to the md5 algorithm.

[0082] When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, searching the storage information table according to the unique identification information includes:

[0083] When the client separates the resource file to be uploaded into the current basic information and the current storage information, and uploads the unique identification information corresponding to the resource file to be uploaded, the storage information table is searched according to the unique identification information.

[0084] The determining of the historical storage information corresponding to the unique identification information in the storage information table and establishing a mapping relationship between the historical storage information and the current basic information includes:

[0085] storing the current basic information in the basic information table;

[0086] Determine the historical storage information corresponding to the unique identification information in the storage information table;

[0087] A mapping relationship between the current basic information and the historical storage information is established.

[0088] When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, after searching the storage information table according to the unique identification information, the method further includes:

[0089] When the unique identification information does not exist in the storage information table, the current basic information and current storage information corresponding to the resource file to be uploaded sent by the client are obtained.

[0090] When the unique identification information does not exist in the storage information table, after obtaining the current basic information and current storage information corresponding to the resource file to be uploaded sent by the client, the method includes:

[0091] The current basic information is stored in the basic information table, and the current stored information and the unique identification information are stored in the stored information table, and the current stored information and the unique identification information are associated with each other;

[0092] A mapping relationship between the current basic information and the current stored information is established.

[0093] In one embodiment, when the processor 10 executes the data storage processing program 30 in the memory 20, the following steps are also implemented: establishing an index corresponding to the unique identification information.

[0094] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program can be executed to implement the steps of the data storage processing method as described above.

[0095] In summary, the present invention discloses a data storage processing method, a server, and a computer-readable storage medium, wherein the data storage processing method includes: when receiving unique identification information corresponding to a resource file to be uploaded sent by a client, searching a storage information table according to the unique identification information; when finding that the unique identification information exists in the storage information table, obtaining the current basic information corresponding to the resource file to be uploaded sent by the client; determining the historical storage information corresponding to the unique identification information in the storage information table, and establishing a mapping relationship between the historical storage information and the current basic information. The present invention determines whether there is a historical record of the resource file to be uploaded through the unique identification information. If there is a historical record, only the current basic information corresponding to the resource file to be uploaded needs to be saved, and a mapping relationship is established between the current basic information and the historical storage information, thereby reducing the recording of storage information, preventing duplicate storage, and improving the utilization of storage space.

[0096] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A data storage and processing method, characterized in that: include: Pre-establish basic information table and storage information table; When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, searching the storage information table according to the unique identification information; When the unique identification information is found in the storage information table, the current basic information corresponding to the resource file to be uploaded sent by the client is obtained; Determine the historical storage information corresponding to the unique identification information in the storage information table, and establish a mapping relationship between the historical storage information and the current basic information; The basic information table represents the basic attributes of the resource file, and the storage information table represents the uniqueness and storage address of the resource file. The basic information table is used to store the historical basic information of the uploaded resource file, and the storage information table is used to store the historical storage information of the uploaded resource file and the unique identification information associated with the historical storage information. There is a mapping relationship between the historical basic information and the historical storage information. The basic information of the resource file includes the file name, file size, video file resolution or image file size, file number, creation date and number of references; the storage information of the resource file includes the storage address and storage directory; the unique identification information is the md5 value of the resource file calculated according to the md5 algorithm; When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, searching the storage information table according to the unique identification information includes: When the client separates the resource file to be uploaded into the current basic information and the current storage information, and uploads the unique identification information corresponding to the resource file to be uploaded, the storage information table is searched according to the unique identification information; The determining of the historical storage information corresponding to the unique identification information in the storage information table and establishing a mapping relationship between the historical storage information and the current basic information includes: storing the current basic information in the basic information table; Determine the historical storage information corresponding to the unique identification information in the storage information table; Establishing a mapping relationship between the current basic information and the historical storage information; When receiving the unique identification information corresponding to the resource file to be uploaded sent by the client, after searching the storage information table according to the unique identification information, the method further includes: When the unique identification information does not exist in the storage information table, obtaining the current basic information and current storage information corresponding to the resource file to be uploaded sent by the client; The current basic information is stored in the basic information table, and the current stored information and the unique identification information are stored in the stored information table, and the current stored information and the unique identification information are associated with each other; Establishing a mapping relationship between the current basic information and the current stored information; The data storage processing method further includes: establishing an index corresponding to the unique identification information; Record basic information each time a file is uploaded and display the basic information to the client; Separate the resource file into two database tables and add an association relationship between the two database tables; The client only transmits the unique identification information of the resource file to be uploaded. When the unique identification information is found in the storage information table, it is determined that the resource file to be uploaded has been uploaded. The client no longer uploads the current storage information of the resource file to be uploaded, but only uploads the current basic information of the resource file to be uploaded.

2. A server, characterized in that: include: A memory, a processor, and a data storage processing program stored in the memory and executable on the processor, wherein the data storage processing program implements the steps of the data storage processing method according to claim 1 when executed by the processor.

3. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed to implement the steps of the data storage processing method according to claim 1.