CN110647502A - File loading method, equipment, device and computer storage medium - Google Patents

File loading method, equipment, device and computer storage medium Download PDF

Info

Publication number
CN110647502A
CN110647502A CN201810670446.3A CN201810670446A CN110647502A CN 110647502 A CN110647502 A CN 110647502A CN 201810670446 A CN201810670446 A CN 201810670446A CN 110647502 A CN110647502 A CN 110647502A
Authority
CN
China
Prior art keywords
file
index
index table
loaded
identification information
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.)
Withdrawn
Application number
CN201810670446.3A
Other languages
Chinese (zh)
Inventor
康凯歌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201810670446.3A priority Critical patent/CN110647502A/en
Publication of CN110647502A publication Critical patent/CN110647502A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention provides a file loading method, equipment, a device and a computer storage medium, wherein the method comprises the following steps: receiving a file loading instruction, wherein the file loading instruction carries identification information of a file to be loaded; inquiring a pre-established index table according to the identification information of the file to be loaded, wherein the index table comprises index items of the file pre-loaded into the memory from a network or a local disk; the index item comprises identification information, storage position information and access times; when the storage position information corresponding to the identification information is found in the index table, loading a file from the memory according to the found storage position information, and updating the access times of the file in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.

Description

File loading method, equipment, device and computer storage medium
Technical Field
Embodiments of the present invention relate to, but not limited to, file processing technologies, and in particular, to a file loading method, device, and apparatus, and a computer storage medium.
Background
With the progress of network technology and the development of markets, users have made higher and higher requirements on the file processing efficiency of terminal devices. For example, in a bank Next Generation Call Center (NGCC) system, many business-related files often need to be loaded, accessed, and modified; in the related art, when a file needs to be loaded, the file needs to be searched in a local path or downloaded from a network based on a Uniform Resource Locator (URL), and the file loading efficiency of this scheme is low because: if the same file needs to be processed for multiple times, the same file needs to be reloaded into the memory every time, which causes unnecessary repeated operation, and causes frequent file input/output (I/O) operation and lower execution performance of loading service.
Disclosure of Invention
The embodiment of the invention provides a file loading method, equipment and device and a computer storage medium, which can improve the file loading efficiency.
In order to achieve the above purpose, the technical solution of the embodiment of the present invention is realized as follows:
the embodiment of the invention provides a file loading method, which comprises the following steps:
receiving a file loading instruction, wherein the file loading instruction carries identification information of a file to be loaded;
inquiring a pre-established index table according to the identification information of the file to be loaded, wherein the index table comprises index items of the file pre-loaded into the memory from a network or a local disk; the index item comprises identification information, storage position information and access times;
when the storage position information corresponding to the identification information is found in the index table, loading a file from the memory according to the found storage position information, and updating the access times of the file in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.
The embodiment of the invention also provides file loading equipment, which comprises a processor and a memory, wherein the memory is used for storing the computer program capable of running on the processor; wherein the content of the first and second substances,
the processor is configured to execute any one of the above steps of the file loading method when the computer program is run.
An embodiment of the present invention further provides a file loading apparatus, where the apparatus includes: the device comprises a receiving module, a searching module and a processing module; wherein the content of the first and second substances,
the receiving module is used for receiving a file loading instruction, and the file loading instruction carries identification information of a file to be loaded;
the searching module is used for searching a pre-established index table according to the identification information of the file to be loaded, wherein the index table comprises index items of the file pre-loaded into the memory from a network or a local disk; the index item comprises identification information, storage position information and access times;
the processing module is used for loading a file from the memory according to the searched storage position information and updating the access times of the file in the index table when the storage position information corresponding to the identification information is searched in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.
The embodiment of the invention also provides a computer storage medium, and the computer program realizes the steps of any one of the file loading methods when being executed by the processor.
In a file loading method, device, apparatus, and computer storage medium provided by the embodiments of the present invention, first, a file loading instruction is received, where the file loading instruction carries identification information of a file to be loaded; then, inquiring a pre-established index table according to the identification information of the file to be loaded, wherein the index table comprises index items of the file pre-loaded into the memory from a network or a local disk; the index item comprises identification information, storage position information and access times; finally, when the storage position information corresponding to the identification information is found in the index table, loading a file from the memory according to the found storage position information, and updating the access times of the file in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.
It can be seen that after the file is preloaded into the memory, the file can be loaded from the memory; because the file loading speed of the memory is far higher than that of a network or a local disk, the file loading speed and efficiency can be improved.
Drawings
Fig. 1 is a flowchart of a file loading method according to an embodiment of the present invention;
FIG. 2 is a flowchart of another file loading method according to an embodiment of the present invention;
FIG. 3 is a flowchart of another file loading method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a file loading apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a hardware structure of a file loading device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of another file loading apparatus according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the invention can be applied to any file loading scene, for example, when a file needs to be loaded in the service execution process, or when an application program in the terminal needs to be loaded, the embodiment of the invention can be implemented based on the technical scheme provided by the embodiment of the invention; the embodiment of the present invention does not limit the types of the loaded files.
The embodiments of the present invention may be applied to a terminal or other devices, where the terminal described above may include devices such as a processor, a magnetic disk, and a memory.
Based on the above description, the following specific examples are proposed.
First embodiment
A first embodiment of the present invention describes a file loading method, and fig. 1 is a flowchart of a file loading method according to an embodiment of the present invention, and as shown in fig. 1, the flowchart may include:
step 101: and receiving a file loading instruction, wherein the file loading instruction carries identification information of a file to be loaded.
Here, the file loading instruction may be an instruction input by a user through a human-computer interaction manner, and the identification information of the file to be loaded may be a file name or other information of the file to be loaded.
Step 102: inquiring a pre-established index table according to the identification information of the file to be loaded, wherein the index table comprises index items of the file pre-loaded into the memory from a network or a local disk; the index entry includes identification information, storage location information, and access times.
That is, it is necessary to preload a file from a network or a local disk into a memory, and then establish an index table; in one embodiment, one or more files may be preloaded into the memory; the files pre-loaded into the memory can be pre-configured; the file may be preloaded into the memory cache from a network or local disk.
In one embodiment, when any application program of the terminal is started, an index table is created; determining a configuration file, wherein the configuration file can be preset, and the content of each line in the configuration file is a file name to be preloaded; in this way, by reading the configuration file in the terminal, the preloading operation can be executed on the file corresponding to each file name in the configuration file; after the file is preloaded in the memory, the relevant information of the preloaded file may be added to the index table, where the relevant information of the file includes identification information, storage location information, and access times.
In one embodiment, after receiving the file preloading instruction, the file preloading instruction can be analyzed to preload the file from a network or a local disk into a memory; illustratively, the file preloading instruction can be analyzed, a compressed packet of the file indicated by the file preloading instruction is received, and then the compressed packet is decompressed to a specified directory of the local disk; then, according to the configuration file, preloading a file from the recorded specified directory into a memory; in one example, the received file preloading instruction includes file information to be loaded and a tar format compressed package of a file, the file information includes file names and path information thereof, the file information may include a plurality of file names to support batch loading, and the plurality of file names are separated by an agreed symbol; thus, when file preloading is performed, tar files (i.e. compression packages in tar format) can be decompressed to a certain directory; the preloading operation may be performed on each file in turn.
In an embodiment, when the file preloading fails due to insufficient memory space, for example, when the available memory space in the memory is smaller than a set value, at least one of the following operations may be performed according to a processing manner selected by a user of the terminal:
deleting the M files with the minimum access frequency in each file corresponding to the index entry in the index table, and releasing the memory until the new files can be preloaded successfully;
a certain amount of memory is added (i.e., the allocated memory size is increased appropriately) for storing the new preloaded file.
It can be seen that, in the embodiment of the present invention, when the file preloading fails due to insufficient memory space, the user may select to add the memory or to clean the memory by the file unloading method according to the actual requirement, so that the implementation of the memory management mechanism has strong flexibility.
Here, in the index table, an index entry corresponds to a file, and the identification information of the file is used for identifying the file and is an identification that the file is different from other files; in one example, the file name is the unique identifying information in each index entry; the storage position information of the file is used for representing the storage position of the file in the memory, the access frequency of the file is used for representing the frequency of accessing the file from the memory after the memory is preloaded with the file, and after the file is preloaded, if the file is not read yet, the access frequency of the file can be recorded as 0 or 1; it is understood that the more the number of accesses of one file per unit time, the higher the access frequency of the file is described.
In one embodiment, each index entry in the index table may also be the creation time of the file (i.e., the time point of preloading to the memory).
In practical implementation, if the file needs to be preloaded from the network into the memory, the file needing to be preloaded can be downloaded from the network based on the URL, and then the downloaded file is preloaded into the memory; for example, according to the file name of the configuration file, the URL of the corresponding file can be searched from the network, and then the file can be preloaded based on the URL; here, the network described above may be the internet, a local area network, or the like.
If the file needs to be preloaded from the local disk into the memory, a storage path of the file corresponding to the file name can be searched on the terminal based on the file name in the configuration file, wherein the storage path of the file is used for representing the storage position information of the file on the local disk of the terminal; then, preloading the file from the local disk to the memory according to the storage path of the searched file; here, the local disk may be a hard disk or other nonvolatile memory on the terminal.
When the file is preloaded into the memory, the file can be stored in a predefined structure, and the described structure may further include the following information: file name, number of accesses, creation time, pointer to next structure.
Step 103: when the storage position information corresponding to the identification information is found in the index table, loading a file from the memory according to the found storage position information, and updating the access times of the file in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.
It can be understood that, when the storage location information corresponding to the identification information is found in the index table, it is described that the file to be loaded corresponding to the identification information carried in the file loading instruction is already preloaded in the memory, and the found storage location information represents the storage location of the file to be loaded in the memory, so that the file can be directly loaded from the memory; furthermore, in the embodiment of the invention, the files required to be used are preloaded into the memory, and when the files are reused, the file I/O operation is not required to be carried out, so that the times of the file I/O operation are reduced, and the disk I/O consumption is reduced.
After loading the file from the memory according to the searched storage location information, it can be considered that the file in the memory is accessed once, and thus, the access times of the file in the index table need to be updated; in specific implementation, for a file, after the file is loaded from the memory once, the value of the access times of the file in the index table can be increased by 1; for example, initially, the number of times of accessing a file in an index entry in the index table is 0, and after a corresponding file is loaded from the memory once, the value of the number of times of accessing the corresponding file in the index table is updated to 1.
In an embodiment, after receiving the file loading instruction, the file loading instruction may be looked up in the index table according to the file name, and if an index entry corresponding to the file name exists in the index table, the access frequency of the corresponding file in the index table may be updated.
In one embodiment, after loading the file from the memory, the information in the structure described above may be updated; for example, the number of accesses in the structure may be updated.
It can be understood that, when the storage location information corresponding to the identification information is found in the index table, it indicates that the file corresponding to the index item including the identification information in the index table has been preloaded into the memory, so that the corresponding file can be loaded from the memory; that is, when the storage location information corresponding to one identification information is found in the index table, the file corresponding to the index entry in the index table is loaded once; here, for the same file, the number of times of loading the file from the memory may be equal to 1, or may be greater than 1; specifically, if the file is not loaded from the memory, the number of times the file is loaded from the memory is recorded as 0.
It can be seen that the time for updating the ordering of the index entries of the files in the index table is as follows: after the file corresponding to the index item in the index table is loaded at least once; that is, the order of the index entries of the files in the index table may be updated each time a file corresponding to an index entry in the index table is loaded; or after loading the file corresponding to the index entry in the index table for the kth time, updating the ordering of the index entries of the file in the index table, where k may be sequentially valued from a predetermined positive integer set, and the positive integer set may be set according to actual needs; if the file corresponding to the index entry in the index table is not loaded for one time by the current time, the original sequence of the index entry of the file in the index table can be kept, that is, the sequence of the index entry of the file in the index table is not updated.
For example, the predetermined set of positive integers may be {2, 3, 5, 6 … }, {1, 3, 5, 6 … } or other sets, where ellipses in a set represent other integers not shown but greater than 6, when the predetermined set of positive integers is {2, 3, 5, 6 … }, it is necessary to update the rankings of the index entries of the files in the index table after loading the files corresponding to the index entries in the index table for the 2 nd, 3 rd, 5 th, and 6 th times, and not update the rankings of the index entries of the files in the index table after loading the files corresponding to the index entries in the index table for the 1 st and 4 th times.
In a specific example, the sorting of the index entries of the files in the index table may be updated every time a file corresponding to an index entry in the index table is loaded p times, where p may be a preset integer greater than or equal to 1, for example, after the files corresponding to the index entries in the index table are loaded 1 st time, 3 rd time, 5 th time, and 7 th time, the sorting of the index entries of the files in the index table is updated, that is, after the files corresponding to the index entries in the index table are loaded twice, the sorting of the index entries of the files in the index table is updated.
In actual implementation, the access frequency of the file can be determined according to the creation time of the file and the access times of the file, and the access frequency of the file is in direct proportion to the access times of the file; in one example, the access frequency of a file is calculated by the formula:
where freq represents the access frequency of a file, count represents the number of times of accessing the file, duration represents the current time, and efftime represents the creation time of the file (the time for preloading the file into a memory).
It can be understood that when the access frequency of the file is higher, the file is more likely to be reloaded, and when the index table is queried according to the identification information of the file, the index entries need to be sequentially searched from front to back, and the order of the index entries of the file in the updated index table is: when the access frequency of the files is in the order from high to low, the index item of the file with higher access frequency is placed at the front position in the index table, so that the loading efficiency of the file with high access frequency can be improved; that is to say, according to the access condition of the user to the file corresponding to each index entry in the index table, the sequence of the index entries in the index table is updated and optimized, so that the condition that the index table searching efficiency is low can be avoided, and the higher file loading speed can be maintained.
It should be noted that, when the storage location information corresponding to the identification information is not found in the index table, and when the identification information is not found in a pre-established standby table, a file corresponding to the identification information is loaded from a network or a local disk, and a record item of the file corresponding to the identification information is added to the standby table; the entry includes: the identification information and the access times of the file corresponding to the identification information.
And updating the access times of the files in the standby table when the storage position information corresponding to the identification information is not found in the index table and the identification information is found in the standby table.
That is, a standby table may be pre-established, where the standby table includes at least one entry, each entry corresponds to a file, and each entry may include corresponding file identification information and the number of accesses to the corresponding file; it can be seen that when the storage location information corresponding to the identification information is not found in the index table, it indicates that the file to be loaded is not in the memory that is not preloaded, and if the identification information of the file to be loaded is not found in the standby table at this time, it indicates that the file corresponding to the identification information (i.e., the file to be loaded) needs to be loaded from the network or the local disk, and at this time, the identification information of the file to be loaded and the access times of the file to be loaded may be added to the entries of the standby table;
further, the entry may further include: the path of the file corresponding to the identification information
When the storage location information corresponding to the identification information is not found in the index table, if the identification information of the file to be loaded is found in the standby table at this time, which indicates that the file corresponding to the identification information has been loaded from the network or the local disk, at this time, the value of the access frequency of the file corresponding to the standby table needs to be increased by 1, that is, for each file that cannot be loaded according to the index entry in the index table, the access frequency may gradually increase along with the change of time.
In an implementation manner of updating the ranking of the index items of the files in the index table, in an implementation manner, it is determined whether the average search times of the loaded files are greater than a preset threshold, and when the average search times of the loaded files are greater than the preset threshold, the ranking of the index items of the files in the index table is updated; when the average number of times of searching for each loaded file is less than or equal to a preset threshold, the ordering of the index entries of the files in the index table may be kept unchanged.
Here, the loaded files do not refer to the files already preloaded, and the loaded files include not only: the method comprises the following steps of loading files from a memory according to index entries of an index table, and further comprising the following steps: each file directly loaded from a network or a local disk (that is, each file directly loaded from the network or the local disk when the storage location information corresponding to the identification information cannot be searched in the index table); in one example, the above-mentioned files directly loaded from the network or the local disk are: the file corresponding to each record item in the backup table.
In the embodiment of the present invention, the number of times of searching for a file is used to indicate: when loading a file, the number of times of table lookup in the index table (i.e. the number of times of looking up the index entry in the index table) is required; if a file cannot be searched in the index table, since all index entries need to be searched in the index table first, it can be determined that there is no index entry of the corresponding file in the index table, and thus the number of times of searching the corresponding file is as follows: the number of index entries in the index table. Here, for each file directly loaded from the network or the local disk, the number of accesses may gradually increase with time, and the number of lookups remains unchanged, i.e., is always the number of index entries in the index table.
Further, the average number of search times of each loaded file is used to represent: and for each loaded file, averagely searching index items during each access.
For example, for each loaded file, the average number of times that index item lookup needs to be performed per access is: the ratio of the number of times of index item searching which is performed when each file is accessed to the total number of times of access of each file.
For example, n represents the number of index entries in the index table (which may be based on the number of files loaded in the index table), n1 represents the number of entries in the standby table (i.e., the number of files directly loaded from the network or the local disk), seq _ i represents the sequence number of the ith index entry in the index table, the sequence number of an index entry in the index table is a positive integer, and the larger the sequence number, the later the position of the index entry in the index table is; the count _ i represents the access frequency of a file corresponding to the ith index item in the index table, the count _ j represents the access frequency of a file corresponding to the jth record item in the standby table, and the access frequency of the file is the loading frequency of the file; find _ j represents the number of times of searching for the file corresponding to the jth record item in the standby table, wherein i is 1 to n, and j is 1 to n 1; the calculation formula of the average search times average of the loaded files is as follows:
Figure BDA0001708032610000091
here, the preset threshold may be set according to actual needs, for example, the preset threshold may be n, n/2, and the like.
In an embodiment, for a file with a higher access frequency but not preloaded in the memory, the index entry of the file may be selectively added to the index table in the memory where the file is preloaded again, for example, the index entry of the file preloaded in the memory again is added to the index table; two specific implementations are given below by way of example.
Mode 1:
when the access frequency of a file corresponding to the jth record item in the standby table is greater than a preset frequency value, preloading the file corresponding to the jth record item in the standby table into a memory, and adding an index item of the file corresponding to the jth record item in the standby table into an index table, wherein j is an integer greater than or equal to 1.
For example, a file corresponding to one record item in the standby table is marked as a file 1, and when the access frequency of the file 1 is greater than a preset frequency value, the file 1 can be preloaded into the memory so as to facilitate subsequent loading of the file 1 from the memory directly; and, an index entry is added in the index table, and the added index entry may include the name of the file 1, the number of accesses, storage location information, and the like.
In an optional example, when the access frequency of the file corresponding to the jth entry in the standby table is greater than a preset frequency value, the jth entry in the standby table may also be deleted.
Mode 2:
when the access frequency of a file corresponding to any record item in the standby table is greater than the minimum value of the access frequency of the file corresponding to each index item in the index table, preloading m files with the highest access frequency in the files corresponding to each record item in the standby table into a memory, adding the index items of the m files with the highest access frequency in the index table, and deleting the record items of the m files with the highest access frequency in the standby table; m is an integer greater than or equal to 1.
That is to say, in the files corresponding to each entry in the standby table, if there is a file whose access frequency is greater than the minimum value of the access frequencies of the files corresponding to each entry in the index table, m files with the highest access frequency can be preloaded into the memory in the files corresponding to each entry in the standby table; for example, if the access frequency of the file 2 is f2, the minimum value of the access frequency of the file corresponding to each index in the index table is f1, and if f2 is greater than f1, then 3 files with the highest access frequency in the files corresponding to each record in the standby table can be preloaded into the memory.
In an optional example, after m files with the highest access frequency are preloaded into the memory and the index entries of the m files with the highest access frequency are added to the index table, the record entries of the m files with the highest access frequency in the standby table may also be deleted.
In an optional example, when the access frequency of a file corresponding to any one entry in the standby table is greater than the minimum value of the access frequencies of files corresponding to the respective index entries in the index table, m files with the lowest access frequencies in the files corresponding to the respective index entries in the index table may be deleted; therefore, files with low access frequency can be deleted from the memory, and the memory space can be saved while the file loading efficiency is kept.
For the file with higher access frequency but not pre-loaded in the memory, the loading efficiency of the file with higher access frequency can be improved after the file is pre-loaded in the memory again.
In an embodiment, a file uninstalling instruction may also be received, where the file uninstalling instruction is used to instruct to delete a specified file in the memory and delete a corresponding index entry in the index table; thus, after receiving the file unloading instruction, searching the index table according to the identification information (which may be a file name) of the file which is indicated to be deleted by the file unloading instruction, and if the corresponding identification information is found in the index table, deleting the corresponding index entry in the index table and deleting the specified file in the memory; in addition, the file uninstall instruction may also delete a file name specified in the configuration file, so that, after receiving the file uninstall instruction, the configuration file may be updated, that is, the file name specified by the file uninstall instruction in the configuration file is deleted.
In practical applications, step 101 to step 103 may be implemented by a processor in the terminal.
In summary, in the file loading method according to the embodiment of the present invention, first, a file loading instruction is received, where the file loading instruction carries identification information of a file to be loaded; then, inquiring a pre-established index table according to the identification information of the file to be loaded, wherein the index table comprises index items of the file pre-loaded into the memory from a network or a local disk; the index item comprises identification information, storage position information and access times; finally, when the storage position information corresponding to the identification information is found in the index table, loading a file from the memory according to the found storage position information, and updating the access times of the file in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.
It can be seen that after the file is preloaded into the memory, the file can be loaded from the memory; because the file loading speed of the memory is much higher than that of a network or a local disk, the file loading speed and efficiency can be improved, namely, the file loading performance can be improved, the user experience is improved, and the requirement of a user for high file loading speed is met; if the file needs to be loaded during the service execution, the embodiment of the invention can improve the file loading efficiency and provide the service execution performance. In addition, the embodiment of the invention can be used for loading files in various formats, namely, the file loading method and the file loading device have universality aiming at the files in different formats.
Second embodiment
On the basis of the file loading method provided by the foregoing embodiment of the present invention, further illustration is performed.
Fig. 2 is a flowchart of another file loading method according to an embodiment of the present invention, and as shown in fig. 2, the flowchart may include:
step 201: and initializing the index table and the standby table, and reading the configuration file.
Here, after a certain application program is started, the index table and the standby table may be initialized; upon reading the configuration file, the file names recorded in the configuration file are processed in turn, i.e., for each file name in the configuration file, step 202 is performed.
Step 202: and establishing an index table node and distributing the memory.
Here, the index table node represents a record entry in the index table, that is, an index entry is newly created for each file name in the configuration file, and a corresponding storage location is allocated in the memory for the corresponding file.
Step 203: and judging whether the memory allocation is successful, if so, executing the step 205, and if not, executing the step 204.
Here, if the memory allocation is successful, it indicates that there is enough remaining storage space in the memory to store the corresponding file, and if the memory allocation fails, it indicates that there is not enough remaining storage space in the memory to store the corresponding file.
Step 204: cleaning up the memory and updating the configuration file.
Illustratively, M files with the lowest access frequency can be deleted in the memory, and the file names of the corresponding M files are deleted in the configuration file; in addition, the index entries of the corresponding M files may also be deleted in the index table.
In addition, the following implementation may also be adopted instead of the implementation of step 204: the user adds a certain memory cache.
Step 205: reading a file from a local disk, and filling an index table node; and receiving a file preloading instruction, analyzing the instruction, receiving a file compression package, and decompressing to a specified directory.
That is, after a file is read from a local disk, information such as a file name, creation time, access times and the like of the file can be filled into nodes of an index table, and the nodes are inserted into the index table; initially, the number of file accesses is 1.
The file compression package may be a compression package of a file read from a local disk, or may be a compression package carried in a file preloading instruction, and the specified directory is indicated by the file preloading instruction.
Step 206: judging whether all files in the file preloading instruction are loaded completely, if so, executing step 207; if not, return to step 202.
Step 207: after a file loading instruction is received, searching an index table and a standby table; and self-checking and updating the index table, and calculating the average searching times average of the loaded files.
Here, the implementation manners of searching the index table and the standby table and the implementation manner of calculating the average search times of the loaded files are already described in the foregoing embodiments, and are not described herein again.
Step 208: and judging whether the average searching times average is greater than a preset threshold, if so, executing the step 209, and if not, ending the process.
Step 209: and sorting the index items of the index table, and if the file with the access frequency greater than the minimum value of the access frequency of the file corresponding to each index item in the index table exists in the file corresponding to each record item in the standby table, executing the preloading operation again.
Here, the implementation of sorting the index entries of the index table has been described in the foregoing embodiments, and is not described here again.
In a specific example, in the files corresponding to each entry in the standby table, if there is a file whose access frequency is greater than the minimum value of the access frequencies of the files corresponding to each entry in the index table, the m files with the lowest access frequency in the files corresponding to each entry in the deletion index table may be deleted, and the file names of the m files with the lowest access frequency may be deleted from the configuration file; in addition, m files with the highest access frequency are preloaded into a memory in the files corresponding to all record items in the standby table, the index items of the m files with the highest access frequency are added into the index table, and the file names of the m files with the highest access frequency are added into the configuration file.
Third embodiment
On the basis of the file loading method provided by the foregoing embodiment of the present invention, further illustration is performed.
In the third embodiment of the invention, the process of file preloading is described from the perspective of human-computer interaction between a user and a terminal; in practical application, a user can input various instructions or data into the terminal through a human-computer interaction interface or other human-computer interaction modes of the terminal.
Fig. 3 is a flowchart of another file loading method according to an embodiment of the present invention, and as shown in fig. 3, the flowchart may include:
step 301: and sending a file preloading instruction and a file compression package to the terminal based on the instruction of the user.
After receiving the file preloading instruction, the terminal may perform file preloading according to the content described in the foregoing embodiment.
Step 302: the terminal judges whether the file preloading is successful, if the file preloading is successful, step 303 is executed, and if the file preloading is unsuccessful, step 304 is executed.
Here, when there is enough remaining storage space in the memory to store the corresponding file, the file preloading may be successfully performed, whereas if there is not enough remaining storage space in the memory to store the corresponding file, the file preloading fails.
Step 303: and after the file preloading is finished, the user inputs a file loading instruction to the terminal.
After the terminal receives the file loading instruction, the file loading may be performed according to the contents described in the foregoing embodiments.
Step 304: and judging whether to delete the file corresponding to the index item in the index table based on the instruction of the user, if so, executing step 306, and if not, executing step 305.
Here, the instructions input to the terminal by the user are: when the instruction of deleting the file in the memory is executed, that is, the file corresponding to the index entry of the index table is selected to be deleted, at this time, step 306 may be executed; if the instruction input by the user to the terminal is not: when the command to delete the file in the memory is executed, step 305 is executed.
Step 305: the user adds a certain memory cache.
Here, the effect of adding the memory cache is: storing the preloaded file.
Step 306: and cleaning the memory and updating the configuration file based on the instruction input to the terminal by the user.
Here, the implementation of clearing the memory and updating the configuration file has been described in the foregoing embodiments, and is not described here again.
Fourth embodiment
On the basis of the file loading method provided in the foregoing embodiment, a fourth embodiment of the present invention provides a file loading apparatus.
Fig. 4 is a schematic diagram of a component structure of a file loading apparatus according to an embodiment of the present invention, as shown in fig. 4, the apparatus includes a receiving module 401, a searching module 402, and a processing module 403; wherein the content of the first and second substances,
a receiving module 401, configured to receive a file loading instruction, where the file loading instruction carries identification information of a file to be loaded;
a searching module 402, configured to query a pre-established index table according to the identification information of the file to be loaded, where the index table includes an index entry of a file that is preloaded into an internal memory from a network or a local disk; the index item comprises identification information, storage position information and access times;
a processing module 403, configured to load a file from the memory according to the searched storage location information and update the access times of the file in the index table when the storage location information corresponding to the identification information is found in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.
In an embodiment, the processing module 403 is specifically configured to update the sequence of the index entries of the files in the index table when the average number of times of searching for each loaded file is greater than a preset threshold; the average number of searches for each loaded file is used to indicate: for each loaded file, the number of times of searching for the index entry is required on average during each access.
In an embodiment, for each loaded file, the average number of times that index item lookup needs to be performed per access is:
the ratio of the number of times of index item searching which is performed when each file is accessed to the total number of times of access of each file.
In an embodiment, the processing module 403 is further configured to, when the storage location information corresponding to the identification information is not found in the index table and when the identification information is not found in a pre-established standby table, load a file corresponding to the identification information from a network or a local disk, and add a record item of the file corresponding to the identification information to the standby table; the entry includes: the identification information and the access times of the file corresponding to the identification information;
the processing module 403 is further configured to update the access times of the file in the standby table when the storage location information corresponding to the identification information is not found in the index table and when the identification information is found in the standby table.
In an embodiment, the processing module 403 is further configured to, when the access frequency of the file corresponding to the jth record entry in the standby table is greater than a preset frequency value, preload the file corresponding to the jth record entry in the standby table into the memory, and add an index entry of the file corresponding to the jth record entry in the standby table to the index table, where j is an integer greater than or equal to 1.
In an embodiment, the processing module 403 is further configured to, when the access frequency of a file corresponding to any one entry in the standby table is greater than a minimum value of the access frequencies of files corresponding to all the index entries in the index table, preload, in the files corresponding to all the entries in the standby table, m files with the highest access frequency into a memory, and add, in the index table, the index entries of the m files with the highest access frequency; m is an integer greater than or equal to 1.
In practical applications, the receiving module 401, the searching module 402 and the Processing module 403 may be implemented by a Central Processing Unit (CPU), a microprocessor Unit (MPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), or the like in the terminal.
In addition, each functional module in this embodiment may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware or a form of a software functional module.
Based on the understanding that the technical solution of the present embodiment essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, and include several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the method of the present embodiment. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Specifically, the computer program instructions corresponding to a file loading method in the present embodiment may be stored on a storage medium such as an optical disc, a hard disc, a usb disk, or the like, and when the computer program instructions corresponding to a file loading method in the storage medium are read or executed by an electronic device, the steps of any one of the file loading methods in the foregoing embodiments are implemented.
Based on the same technical concept as the foregoing embodiment, referring to fig. 5, it shows a file loading device 50 provided by an embodiment of the present invention, which may include: memory 51, processor 52 and bus 53; wherein the content of the first and second substances,
the bus 53 is used for connecting the memory 51, the processor 52 and the intercommunication among these devices;
the memory 51 for storing computer programs and data;
the processor 52 is configured to execute the computer program stored in the memory to implement the steps of any one of the file loading methods of the foregoing embodiments.
In practical applications, the memory 51 may be a volatile memory (RAM); or a non-volatile memory (non-volatile memory) such as a ROM, a flash memory (flash memory), a Hard Disk (Hard Disk Drive, HDD) or a Solid-State Drive (SSD); or a combination of the above types of memories and provides instructions and data to the processor 52.
The processor 52 may be at least one of an Application Specific Integrated Circuit (ASIC), a DSP, a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), an FPGA, a CPU, a controller, a microcontroller, and a microprocessor. It will be appreciated that the electronic devices used to implement the processor functions described above may be other devices, and embodiments of the present invention are not limited in particular.
Fifth embodiment
On the basis of the foregoing embodiment, a fifth embodiment of the present invention proposes another file loading apparatus; fig. 6 is a schematic diagram of a structure of another file loading apparatus according to an embodiment of the present invention, as shown in fig. 6, the apparatus may include: an instruction receiving unit 601, an instruction parsing unit 602, a file preloading unit 603, a file loading unit 604, and an index table optimizing unit 605; wherein the content of the first and second substances,
an instruction receiving unit 601, configured to receive a file preloading instruction and a file loading instruction;
the instruction parsing unit 602 is configured to parse the instruction received by the instruction receiving unit 601, and perform corresponding processing on different instructions.
A file preloading unit 603, configured to perform a preloading operation on a file.
A file loading unit 604, configured to perform file loading according to the file loading instruction.
The processing method of the file preloading instruction and the file loading instruction, the implementation method of the preloading operation on the file, and the implementation method of the file loading according to the file loading instruction have been described in the first to third embodiments of the present invention, and are not repeated here.
The index table optimizing unit 605 is configured to update the ordering of each index entry in the index table, and when the file fails to be preloaded due to insufficient memory, delete a plurality of index entries in the index table according to the ordering result of each index entry in the index table; the operations of the index table optimization unit 605 to sort and delete the index items have been described in the first to third embodiments of the present invention, and are not repeated here.
In practical applications, the instruction receiving Unit 601, the instruction parsing Unit 602, the file preloading Unit 603, the file loading Unit 604, and the index table optimizing Unit 605 may all be implemented by a Central Processing Unit (CPU), a microprocessor Unit (MPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), or the like located in the terminal.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of a hardware embodiment, a software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.

Claims (10)

1. A file loading method, characterized in that the method comprises:
receiving a file loading instruction, wherein the file loading instruction carries identification information of a file to be loaded;
inquiring a pre-established index table according to the identification information of the file to be loaded, wherein the index table comprises index items of the file pre-loaded into the memory from a network or a local disk; the index item comprises identification information, storage position information and access times;
when the storage position information corresponding to the identification information is found in the index table, loading a file from the memory according to the found storage position information, and updating the access times of the file in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.
2. The method of claim 1, wherein updating the ordering of the index entries of the files in the index table comprises:
when the average searching times of the loaded files is larger than a preset threshold, updating the sequence of the index items of the files in the index table; the average number of searches for each loaded file is used to indicate: for each loaded file, the number of times of searching for the index entry is required on average during each access.
3. The method of claim 2, wherein for each loaded file, the average number of times that index lookup is required per access is:
the ratio of the number of times of index item searching which is performed when each file is accessed to the total number of times of access of each file.
4. The method of claim 1, further comprising:
when the storage position information corresponding to the identification information is not found in the index table and the identification information is not found in a pre-established standby table, loading a file corresponding to the identification information from a network or a local disk and adding a record item of the file corresponding to the identification information into the standby table; the entry includes: the identification information and the access times of the file corresponding to the identification information;
and updating the access times of the files in the standby table when the storage position information corresponding to the identification information is not found in the index table and the identification information is found in the standby table.
5. The method of claim 4, further comprising:
and when the access frequency of the file corresponding to the jth record item in the standby table is greater than a preset frequency value, preloading the file corresponding to the jth record item in the standby table into a memory, and adding an index item of the file corresponding to the jth record item in the standby table into the index table, wherein j is an integer greater than or equal to 1.
6. The method of claim 4, further comprising:
when the access frequency of a file corresponding to any one record item in the standby table is greater than the minimum value of the access frequency of a file corresponding to each index item in the index table, preloading m files with the highest access frequency in the files corresponding to each record item in the standby table into a memory, and adding the index items of the m files with the highest access frequency in the index table; m is an integer greater than or equal to 1.
7. A file loading apparatus, characterized in that the apparatus comprises a processor and a memory for storing a computer program capable of running on the processor; wherein the content of the first and second substances,
the processor is adapted to perform the steps of the method of any one of claims 1 to 6 when running the computer program.
8. A file loading apparatus, characterized in that the apparatus comprises: the device comprises a receiving module, a searching module and a processing module; wherein the content of the first and second substances,
the receiving module is used for receiving a file loading instruction, and the file loading instruction carries identification information of a file to be loaded;
the searching module is used for searching a pre-established index table according to the identification information of the file to be loaded, wherein the index table comprises index items of the file pre-loaded into the memory from a network or a local disk; the index item comprises identification information, storage position information and access times;
the processing module is used for loading a file from the memory according to the searched storage position information and updating the access times of the file in the index table when the storage position information corresponding to the identification information is searched in the index table; after the file corresponding to the index entry in the index table is loaded at least once, updating the sequence of the index entry of the file in the index table, wherein the updated sequence of the index entry of the file in the index table is as follows: the access frequency of the files is in order from high to low.
9. The apparatus according to claim 8, wherein the processing module is specifically configured to update the ordering of the index entries of the files in the index table when the average number of times of search of each loaded file is greater than a preset threshold; the average number of searches for each loaded file is used to indicate: for each loaded file, the number of times of searching for the index entry is required on average during each access.
10. A computer storage medium on which a computer program is stored, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 6 when executed by a processor.
CN201810670446.3A 2018-06-26 2018-06-26 File loading method, equipment, device and computer storage medium Withdrawn CN110647502A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810670446.3A CN110647502A (en) 2018-06-26 2018-06-26 File loading method, equipment, device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810670446.3A CN110647502A (en) 2018-06-26 2018-06-26 File loading method, equipment, device and computer storage medium

Publications (1)

Publication Number Publication Date
CN110647502A true CN110647502A (en) 2020-01-03

Family

ID=68988729

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810670446.3A Withdrawn CN110647502A (en) 2018-06-26 2018-06-26 File loading method, equipment, device and computer storage medium

Country Status (1)

Country Link
CN (1) CN110647502A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367580A (en) * 2020-02-28 2020-07-03 Oppo(重庆)智能科技有限公司 Application starting method and device and computer readable storage medium
CN111437602A (en) * 2020-03-23 2020-07-24 腾讯科技(深圳)有限公司 Flight trajectory display method, device, equipment and storage medium in virtual environment
CN112118352A (en) * 2020-08-31 2020-12-22 京东数字科技控股股份有限公司 Method and device for processing notification trigger message
CN112765443A (en) * 2020-12-31 2021-05-07 广州技象科技有限公司 Internet of things data query method and device based on historical operation data
CN113792171A (en) * 2021-11-15 2021-12-14 西安热工研究院有限公司 Image retrieval method, system, equipment and storage medium based on memory management
CN116954745A (en) * 2023-05-25 2023-10-27 成都融见软件科技有限公司 Target file partial loading system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081920A (en) * 2010-12-30 2011-06-01 深圳芯邦科技股份有限公司 Method and device for controlling picture display
CN102331920A (en) * 2011-07-26 2012-01-25 深圳市万兴软件有限公司 Data processing method and device
CN102750174A (en) * 2012-06-29 2012-10-24 Tcl集团股份有限公司 Method and device for loading file

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102081920A (en) * 2010-12-30 2011-06-01 深圳芯邦科技股份有限公司 Method and device for controlling picture display
CN102331920A (en) * 2011-07-26 2012-01-25 深圳市万兴软件有限公司 Data processing method and device
CN102750174A (en) * 2012-06-29 2012-10-24 Tcl集团股份有限公司 Method and device for loading file

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111367580A (en) * 2020-02-28 2020-07-03 Oppo(重庆)智能科技有限公司 Application starting method and device and computer readable storage medium
CN111367580B (en) * 2020-02-28 2024-02-13 Oppo(重庆)智能科技有限公司 Application starting method and device and computer readable storage medium
CN111437602A (en) * 2020-03-23 2020-07-24 腾讯科技(深圳)有限公司 Flight trajectory display method, device, equipment and storage medium in virtual environment
CN111437602B (en) * 2020-03-23 2021-08-17 腾讯科技(深圳)有限公司 Flight trajectory display method, device, equipment and storage medium in virtual environment
CN112118352A (en) * 2020-08-31 2020-12-22 京东数字科技控股股份有限公司 Method and device for processing notification trigger message
CN112765443A (en) * 2020-12-31 2021-05-07 广州技象科技有限公司 Internet of things data query method and device based on historical operation data
CN112765443B (en) * 2020-12-31 2023-10-24 广州技象科技有限公司 Internet of things data query method and device based on historical operation data
CN113792171A (en) * 2021-11-15 2021-12-14 西安热工研究院有限公司 Image retrieval method, system, equipment and storage medium based on memory management
CN113792171B (en) * 2021-11-15 2022-02-18 西安热工研究院有限公司 Image retrieval method, system, equipment and storage medium based on memory management
CN116954745A (en) * 2023-05-25 2023-10-27 成都融见软件科技有限公司 Target file partial loading system
CN116954745B (en) * 2023-05-25 2024-02-09 成都融见软件科技有限公司 Target file partial loading system

Similar Documents

Publication Publication Date Title
CN110647502A (en) File loading method, equipment, device and computer storage medium
US11461027B2 (en) Deduplication-aware load balancing in distributed storage systems
US7533230B2 (en) Transparent migration of files among various types of storage volumes based on file access properties
CN106657213B (en) File transmission method and device
CN110347651B (en) Cloud storage-based data synchronization method, device, equipment and storage medium
CN105095300A (en) Method and system for database backup
CN102495894A (en) Method, device and system for searching repeated data
CN108228799B (en) Object index information storage method and device
CN105302840A (en) Cache management method and device
CN109254981B (en) Data management method and device of distributed cache system
CN110750211B (en) Storage space management method and device
CN115617799A (en) Data storage method, device, equipment and storage medium
CN108399175B (en) Data storage and query method and device
CN113495883A (en) Data storage method and device for database
CN111552438B (en) Method, device, server and storage medium for writing object
CN112182328A (en) Method and device for expanding search engine, electronic equipment and storage medium
CN110765125B (en) Method and device for storing data
CN115840731A (en) File processing method, computing device and computer storage medium
CN107077509B (en) Method, device and equipment for improving browsing experience
CN110362769B (en) Data processing method and device
CN112612865A (en) Document storage method and device based on elastic search
CN114968069A (en) Data storage method and device, electronic equipment and storage medium
CN108021562B (en) Disk storage method and device applied to distributed file system and distributed file system
CN111831691B (en) Data reading and writing method and device, electronic equipment and storage medium
CN111723266A (en) Mass data processing method and device

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20200103

WW01 Invention patent application withdrawn after publication