File downloading method and apparatus, electronic device, and storage medium
By determining candidate files in the file set and pre-downloading, the problem of long-term file download time in the prior art is solved, faster download speed is achieved, and user experience is improved.
Patent Information
- Application Number
- PCT/CN2024/120866
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-26
- Filing Date
- 2024-09-24
- Publication Date
- 2025-04-03
AI Technical Summary
In the prior art, the file download method is mostly serial download, which causes users to wait for a long time when downloading large files or multiple files, affecting the user experience.
Several candidate files are determined in the file set, and pre-downloads are performed to obtain cached data. When a download instruction is received, the download of the file to be downloaded is quickly completed based on the cached data.
By pre-downloading files that users may need, shortening the download waiting time and improving the user experience.
Smart Images

Figure CN2024120866_03042025_PF_FP_ABST
Abstract
Description
File downloading method, device, electronic device, and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to Chinese patent application No. 202311248367.0, filed on September 26, 2023, entitled “File downloading method, device, electronic device and storage medium”. The entire contents of that application are incorporated herein by reference. Technical Field
[0003] The present disclosure relates to the field of downloading technology, and in particular to a file downloading method, device, electronic device, and storage medium. Background Art
[0004] With the continuous development of Internet technology, more and more terminals support downloading various files from the Internet, so that users can obtain massive data through the terminals.
[0005] Currently, most file downloads are serial downloads. If a user wants to download a large file or a large number of files, the user usually needs to wait a long time before viewing the downloaded file, which affects the user experience.
[0006] Summary of the Invention
[0007] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a file downloading method, device, electronic device and storage medium.
[0008] In a first aspect, the present disclosure provides a file downloading method, comprising:
[0009] Determine several candidate files in the file set;
[0010] Pre-downloading the plurality of candidate files to obtain cache data corresponding to the candidate files respectively;
[0011] Obtaining a download instruction, wherein the download instruction includes identification information of a file to be downloaded;
[0012] If the file to be downloaded matches one of the candidate files, the file to be downloaded is obtained based on the cache data corresponding to the target file, and the target file is a candidate file that matches the file to be downloaded.
[0013] In a second aspect, the present disclosure further provides a file downloading device, comprising:
[0014] A determination module, used for determining a number of candidate files in a file set;
[0015] A pre-download module, configured to pre-download the plurality of candidate files and obtain cache data corresponding to the candidate files respectively;
[0016] An acquisition module, configured to acquire a download instruction, wherein the download instruction includes identification information of a file to be downloaded;
[0017] The download module is configured to obtain the file to be downloaded based on the cache data corresponding to the target file if the file to be downloaded matches one of the candidate files, where the target file is a candidate file that matches the file to be downloaded.
[0018] In a third aspect, the present disclosure further provides an electronic device, comprising:
[0019] one or more processors;
[0020] a storage device for storing one or more programs;
[0021] When the one or more programs are executed by the one or more processors, the one or more processors implement the file downloading method as described above.
[0022] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, which implements the file downloading method described above when the program is executed by a processor.
[0023] The technical solution provided by the embodiments of the present disclosure has the following advantages over the prior art:
[0024] The technical solution provided by the embodiment of the present disclosure determines several candidate files by setting in a file set; pre-downloads several candidate files to obtain cache data corresponding to the candidate files respectively; obtains a download instruction, and the download instruction includes identification information of the file to be downloaded; if the file to be downloaded matches a candidate file, based on the cache data corresponding to the target file, the file to be downloaded is obtained, and the target file is a candidate file matching the file to be downloaded. The essence of the technical solution is to predict which files the user may download, and then pre-download the files that the user may download based on the prediction results. After receiving the download instruction, the remaining download steps can be completed according to the progress of the pre-download. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0026] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0027] FIG1 is a flow chart of a file downloading method provided by an embodiment of the present disclosure;
[0028] FIG2 is a schematic structural diagram of a file downloading device according to an embodiment of the present disclosure;
[0029] FIG3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0030] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features therein can be combined with each other in the absence of conflict.
[0031] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0032] FIG1 is a flowchart of a file download method provided by an embodiment of the present disclosure. This embodiment is applicable to situations where file downloading is performed on a client. The method can be executed by a file download device, which can be implemented using software and / or hardware. The device can be configured in an electronic device, such as a terminal, specifically including but not limited to a smartphone, a PDA, a tablet computer, a wearable device with a display screen, a desktop computer, a laptop computer, an all-in-one computer, a smart home device, etc. Alternatively, this embodiment is applicable to situations where file downloading is performed on a server. The method can be executed by a file download device, which can be implemented using software and / or hardware. The device can be configured in an electronic device, such as a server.
[0033] As shown in FIG1 , the method may specifically include:
[0034] S110: Determine several candidate files in the file set.
[0035] The file set may be, for example, a collection of downloadable files. The downloadable files may include at least one of the following: images, videos, audios, text information, folders, and compressed files.
[0036] This application does not limit the specific information referred to by a file set. For example, a file set can be a collection of all files included in an information stream viewed by a user, where an information stream refers to each piece of information / content in an information stream playback sequence. An information stream playback sequence is a collection of multiple information streams arranged in a certain order. An information stream playback sequence is a data format that continuously provides content to users.
[0037] Optionally, the file set may also be a set consisting of exposed files (ie, files displayed by a terminal), or the file set may also be a set consisting of files that have been collected, liked, or followed by a user.
[0038] The candidate files may be, for example, files screened out from a file set and required to be pre-downloaded later.
[0039] In practice, a number of candidate files can be determined from a file set based on a screening condition. The screening condition can, for example, be the basis for determining whether a file in the file set can be used as a candidate file. This application does not limit the content of the screening condition. For example, if the file set is a collection of exposed files, the screening condition can be files with an exposure count greater than a first set threshold. The exposure count can, for example, refer to the number of times the file has been displayed by a terminal. The first set threshold is a pre-specified value. Optionally, the first set threshold is a constant.
[0040] S120: Pre-download several candidate files to obtain cache data corresponding to the candidate files.
[0041] Pre-downloading the candidate file may, for example, be downloading the candidate file in advance without receiving an instruction for instructing to download the candidate file.
[0042] There are multiple ways to implement this step, which are not limited in this application. For example, in one embodiment, the file download process includes N different processing steps, where N is a positive integer greater than or equal to 2. The specific implementation method of this step includes: for each candidate file, executing the first Q processing steps of the file download process, and storing the execution result of the Qth processing step as cache data corresponding to the candidate file in the local storage space. Where 1≤Q≤N-1, and Q is a positive integer.
[0043] In another embodiment, optionally, the file download process includes N different processing steps, each processing step corresponds to a processing queue; N is a positive integer greater than or equal to 2; the implementation method of this step includes: for the candidate file, let M be 1, and repeat the loop step until M=N-1, M is a positive integer. The loop step includes: inserting the candidate file into the processing queue corresponding to the Mth processing step; if the sequence number of the candidate file in the target queue is 1, executing the Mth processing step for each candidate file in the target queue, obtaining the Mth cache data corresponding to the candidate file, and saving the Mth cache data to the local storage space; updating the value of M so that the difference between the value of M after the update and the value of M before the update is 1; the target queue is the processing queue corresponding to the Mth processing step.
[0044] "The file download process includes N different processing steps" means that the file download process is broken down into N processing steps. This application does not limit the specific processing content and processing method of each processing step. The purpose of breaking the file download process into N processing steps here is to enable the subsequent timely storage of the processing results of each step.
[0045] When executing each processing step, each file is processed in sequence according to the order in which the files are arranged in the processing queue corresponding to the processing step. "The sequence number of the candidate file in the target queue is 1" means that it is the turn of the candidate file to execute the processing step corresponding to the target queue.
[0046] Exemplarily, the file download process is broken down into three processing steps: step a, step b, and step c. Step a involves downloading the file to be downloaded from the cloud server to obtain an initial download result; step b converts the format of the initial download result to obtain a format-converted result; and step c reads the format-converted result to obtain the final download result. This arrangement is because the format of the initial download result is usually a format that is conducive to data transmission. This format may not be directly readable using a designated API interface. The purpose of step b is to convert the format of the initial download result so that the converted result can be directly read using a designated API interface. The purpose of step c is to call a designated API interface to read the format-converted result. Exemplarily, if the candidate file is an image, the format of the initial download result is png, and the format of the result converted in step b is blob. Subsequently, the browser uses the download function API to read the file in blob format to obtain the final download result. Step a corresponds to processing queue A, step b corresponds to processing queue B, and step c corresponds to processing queue C.
[0047] The specific implementation method of this step includes: inserting the candidate file into the processing queue A; according to the sorting order of each candidate file in the processing queue A, downloading each candidate file from the cloud server in turn, obtaining the initial download result corresponding to each candidate file, and saving the initial download result as the first cache data to the local storage space; inserting the downloaded candidate file into the processing queue B; according to the sorting order of each file to be downloaded in the processing queue B, converting the format of the initial download result corresponding to each file to be downloaded in turn, and obtaining the format-converted result corresponding to each candidate file; saving the format-converted result as the second cache data to the local storage space.
[0048] Optionally, "inserting the candidate file into the processing queue corresponding to the Mth processing step" includes: determining a priority of the candidate file; and inserting the candidate file into the processing queue corresponding to the Mth processing step based on the priority of the candidate file. The priority of the candidate file is used to describe the importance of the candidate file. This setting is intended to ensure that the candidate files in the processing queue are arranged according to their importance.
[0049] Optionally, the higher the priority of a candidate file, the smaller its sequence number in the processing queue corresponding to the Mth processing step. Since the Mth processing step is executed sequentially according to the sequence number of each candidate file in the processing queue, the Mth processing step is executed on each candidate file in sequence. This setting is intended to prioritize the execution of the Mth processing step for candidate files with a high degree of importance.
[0050] Furthermore, "determining the priority of the candidate file" includes: determining the priority of the candidate file based on the number of exposures of the candidate file and / or the time information of the transfer to the processing queue corresponding to the Mth processing step. The number of exposures of the candidate file can be, for example, the number of times the candidate file is displayed. The time information of the transfer to the processing queue corresponding to the Mth processing step can be, for example, the time when the candidate file can be inserted into the processing queue corresponding to the Mth processing step, or the time when the M-1th processing step is completed (in this case, M is required to be greater than 2).
[0051] S130: Obtain a download instruction, where the download instruction includes identification information of the file to be downloaded.
[0052] The download instruction may be, for example, an instruction for indicating which file to download. In some scenarios, the download instruction is generated based on the user's operation on the terminal, reflecting the user's wishes.
[0053] The file to be downloaded may be, for example, a file that needs to be downloaded as indicated by a download instruction.
[0054] The identification information of the file to be downloaded may be information used to distinguish the file to be downloaded from other files. For example, the identification information of the file to be downloaded includes the name, number, download address or hash value of the file to be downloaded.
[0055] S140: If the file to be downloaded matches a candidate file, the file to be downloaded is obtained based on cache data corresponding to the target file, and the target file is a candidate file that matches the file to be downloaded.
[0056] The file to be downloaded matches a candidate file. For example, the file to be downloaded and the candidate file may be the same file.
[0057] For example, if the file download process includes N different processing steps, if before S140, S steps (1≤S≤N-1, S is a positive integer) have been executed for the file to be downloaded and the execution result of the S-th step (i.e., cached data) has been recorded. When executing this step, the execution result of the S-th step obtained in the previous pre-download process (i.e., cached data) can be used to start execution from the S+1-th step. In this way, starting from the time the download instruction is received, it is only necessary to wait for the execution time of NS steps to complete the download of the file to be downloaded.
[0058] The above technical solution determines several candidate files by setting in a file set; pre-downloads several candidate files to obtain cache data corresponding to the candidate files respectively; obtains a download instruction, and the download instruction includes identification information of the file to be downloaded; if the file to be downloaded matches a candidate file, based on the cache data corresponding to the target file, the file to be downloaded is obtained, and the target file is a candidate file that matches the file to be downloaded. The essence of the above technical solution is to predict which files the user may download, and then pre-download the files that the user may download based on the prediction results. After receiving the download instruction, the remaining download steps can be completed according to the progress of the pre-download, which can substantially shorten the waiting time for users to download files and improve the user experience.
[0059] Based on the above technical solution, there are many specific implementation methods of S140, and this application does not limit this.
[0060] In one embodiment, the specific implementation method of S140 includes: executing N different processing steps in sequence for the file to be downloaded; wherein, for the file to be downloaded, the process of executing the Pth processing step includes: if the serial number of the file to be downloaded in the processing queue corresponding to the Pth processing step is 1, judging whether the local storage space includes the processing result corresponding to the Pth processing step; if included, inserting the file to be downloaded into the processing queue corresponding to the P+1th processing step; if not included, executing the Pth processing step for the file to be downloaded, and then inserting the file to be downloaded into the processing queue corresponding to the P+1th processing step; 1≤P≤N-1, P is a positive integer.
[0061] For example, let's assume the file download process includes three steps: step a, step b, and step c. Step a corresponds to processing queue A, step b corresponds to processing queue B, and step c corresponds to processing queue C. Step a downloads the desired file from the cloud server, obtaining an initial download result; step b converts the initial download result to obtain a converted result; and step c reads the converted result to obtain the final download result.
[0062] If a download instruction instructs to download file e, file e is first inserted into processing queue A. Based on the order of the files in processing queue A, when it is time to execute step a on file e, first determine whether the local storage space contains the processing result corresponding to step a. If the local storage space contains the processing result corresponding to step a, file e is inserted into processing queue B. If the local storage space does not contain the processing result corresponding to step a, file e is downloaded from the cloud server to obtain the initial download result, and then file e is inserted into processing queue B. Based on the order of the files in processing queue B, when it is time to execute step b on file e, first determine whether the local storage space contains the processing result corresponding to step b. If the local storage space contains the processing result corresponding to step b, file e is inserted into processing queue C. If the local storage space does not contain the processing result corresponding to step b, the initial download result is formatted to obtain the format-converted result, and file e is inserted into processing queue C. According to the arrangement order of the files in the processing queue C, when it is the turn to execute step c for file e, the result after format conversion is read to obtain the final download result.
[0063] In another embodiment, the specific implementation method of S140 includes: determining whether the local storage space includes cache data corresponding to the file to be downloaded; if so, determining the target processing queue based on the processing steps corresponding to the cache data; inserting the file to be downloaded into the target processing queue; and continuing to execute the steps included in the file download process from the processing steps corresponding to the target processing queue.
[0064] Furthermore, the target processing queue is determined according to the processing step of the cached data, including: if the processing step corresponding to the cached data is the Tth processing step, the processing queue corresponding to the T+1th processing step is used as the target processing queue.
[0065] Furthermore, the target processing queue is determined based on the processing steps of the cached data, including: if the local storage space includes multiple cached data corresponding to the file to be downloaded, the processing steps corresponding to each cached data are determined respectively; and the target processing queue is determined based on the processing step with the largest number.
[0066] For example, let's assume the file download process includes three steps: step a, step b, and step c. Step a corresponds to processing queue A, step b corresponds to processing queue B, and step c corresponds to processing queue C. Step a downloads the desired file from the cloud server, obtaining an initial download result; step b converts the initial download result to obtain a converted result; and step c reads the converted result to obtain the final download result.
[0067] If a download instruction instructs to download file f, a determination is made as to whether the local storage space contains cached data corresponding to file f. If the local storage space contains only cached data corresponding to step a, this indicates that step a has already been executed for file f. Processing queue B is then determined as the target processing queue, and file f is subsequently inserted into processing queue B before executing step b. After step b is completed, file f is inserted into processing queue C, and then executing step c.
[0068] If the local storage space includes both cache data corresponding to step a and cache data corresponding to step b, since step b has the largest number, it means that step b has been executed on file f. Processing queue C is determined as the target processing queue, and file f is subsequently inserted into processing queue C, and then step c is executed.
[0069] If the local storage space does not contain the cached data corresponding to step a or step b, file f is inserted into processing queue A and then step a is executed. After step a is executed, file f is inserted into processing queue B and then step b is executed. After step b is executed, file f is inserted into processing queue C and then step c is executed.
[0070] The above two methods for implementing S140 both have simple design logic and are easy to implement.
[0071] In addition, the above technical solution sets the file download process to include N different processing steps, each processing step corresponds to a processing queue. In essence, the file download process is processed into a pipeline with a file download function. The pipeline includes multiple links (i.e., corresponding to multiple processing steps), and each link can be executed synchronously. For example, in the processing queue corresponding to the first processing step, the candidate files are file 1, file 2, and file 3. In the processing queue corresponding to the second processing step, the candidate files are file 4, file 5, and file 6. While executing the first processing step on file 1, the second processing step is executed on file 4 at the same time, which can increase the number of overall pre-download candidate files. And because the number of pre-downloaded candidate files is large, the probability of matching the file to be downloaded with the pre-download candidate file can be increased, thereby shortening the average waiting time for users to download files.
[0072] Based on the above technical solution, the insertion position of the to-be-downloaded file in the processing queue can optionally be set to the first position in the processing queue. This setting is intended to give the to-be-downloaded file indicated by the download instruction the highest priority. This allows the to-be-downloaded file indicated by the download instruction to be downloaded first after receiving the download instruction, further shortening the time interval from receiving the download instruction to obtaining the to-be-downloaded file, thereby improving the user experience.
[0073] Based on the above technical solutions, the method may optionally further include: periodically updating the priority of each candidate file; and updating the order of candidate files in the processing queue based on the updated priority. This is because, in practice, during the pre-download process of each candidate file, the user may still be using the terminal, causing the priority of each candidate file to change. This configuration ensures that the order of candidate files in each processing queue is appropriate.
[0074] Furthermore, the file downloading method further includes: obtaining an expiration condition corresponding to each cached data; and when the expiration condition is satisfied, deleting the cached data corresponding to the satisfied expiration condition.
[0075] The expiration condition is a condition for determining whether cached data needs to be deleted. This application does not limit the content of the expiration condition. In practice, the expiration conditions of cached data corresponding to different candidate files can be the same or different. The expiration conditions of cached data obtained by different processing steps corresponding to the same candidate file can be the same or different.
[0076] For example, the expiration condition may be that the number of exposures within a preset time period is less than a set number. Alternatively, the expiration condition may be that the page containing the candidate file is closed. Alternatively, the expiration condition may be that the cached data generation time exceeds a preset time threshold.
[0077] By setting the expiration condition to be met, the cached data corresponding to the satisfied expiration condition is deleted, so as to avoid the local storage space being occupied by a large amount of cached data, thereby affecting the performance of the execution subject of the file download method provided by this application.
[0078] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0079] FIG2 is a schematic diagram of the structure of a file downloading device in an embodiment of the present disclosure. The file downloading device provided by the embodiment of the present disclosure can be configured in a client or in a server. Referring to FIG2 , the file downloading device specifically includes:
[0080] A determination module 210 is configured to determine a number of candidate files in a file set;
[0081] A pre-download module 220 is configured to pre-download the plurality of candidate files and obtain cache data corresponding to the candidate files respectively;
[0082] An acquisition module 230 is configured to acquire a download instruction, wherein the download instruction includes identification information of a file to be downloaded;
[0083] The download module 240 is configured to obtain the file to be downloaded based on the cache data corresponding to the target file if the file to be downloaded matches one of the candidate files, where the target file is a candidate file that matches the file to be downloaded.
[0084] Furthermore, the file download process includes N different processing steps, each processing step corresponds to a processing queue; N is a positive integer greater than or equal to 2; the pre-download module 220 is used to:
[0085] For the candidate file, let M be 1, and repeat the loop steps until M=N-1, where M is a positive integer;
[0086] Among them, the loop step includes: inserting the candidate file into the processing queue corresponding to the Mth processing step; if the serial number of the candidate file in the target queue is 1, executing the Mth processing step on each candidate file in the target queue, obtaining the Mth cache data corresponding to the candidate file, and saving the Mth cache data to the local storage space; updating the value of M so that the difference between the value of M after the update and the value of M before the update is 1; the target queue is the processing queue corresponding to the Mth processing step.
[0087] Furthermore, the download module 240 is used to:
[0088] For the file to be downloaded, executing the N different processing steps in sequence;
[0089] Among them, for the file to be downloaded, the process of executing the Pth processing step includes: if the serial number of the file to be downloaded in the processing queue corresponding to the Pth processing step is 1, determine whether the local storage space includes the processing result corresponding to the Pth processing step; if included, insert the file to be downloaded into the processing queue corresponding to the P+1th processing step; 1≤P≤N-1, P is a positive integer.
[0090] Furthermore, the download module 240 is used to:
[0091] Determining whether the local storage space includes cache data corresponding to the file to be downloaded;
[0092] If so, determining a target processing queue according to the processing steps corresponding to the cached data;
[0093] Inserting the file to be downloaded into the target processing queue;
[0094] The steps included in the file downloading process are continued to be executed starting from the processing step corresponding to the target processing queue.
[0095] Furthermore, the pre-download module 220 is configured to:
[0096] Determining the priority of the candidate files;
[0097] Based on the priority of the candidate file, the candidate file is inserted into the processing queue corresponding to the Mth processing step.
[0098] Furthermore, the pre-download module 220 is configured to:
[0099] The priority of the candidate file is determined according to the exposure times of the candidate file and / or the time information of being transferred to the processing queue corresponding to the Mth processing step.
[0100] Furthermore, the insertion position of the file to be downloaded in the processing queue is the first position of the processing queue.
[0101] Furthermore, the device also includes a maintenance module, which is used to:
[0102] Obtaining an expiration condition corresponding to each cached data;
[0103] When the expiration condition is satisfied, the cache data corresponding to the satisfied expiration condition is deleted.
[0104] The file downloading device provided in the embodiment of the present disclosure can execute the steps executed by the client or server in the file downloading method provided in the embodiment of the method of the present disclosure, and has the execution steps and beneficial effects, which will not be repeated here.
[0105] FIG3 is a schematic diagram of the structure of an electronic device in an embodiment of the present disclosure. Specific reference will be made below to FIG3 , which shows a schematic diagram of the structure of an electronic device 1000 suitable for implementing an embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), wearable electronic devices, and the like, as well as fixed terminals such as digital TVs, desktop computers, smart home devices, and the like. The electronic device shown in FIG3 is merely an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0106] As shown in Figure 3, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes to implement the file download method of the embodiment described in the present disclosure according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage device 1008 into the random access memory (RAM) 1003. In the RAM 1003, various programs and information required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0107] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange information. Although FIG3 shows the electronic device 1000 with various devices, it should be understood that not all of the devices shown are required to be implemented or present. More or fewer devices may alternatively be implemented or present.
[0108] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart, thereby implementing the file download method as described above. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 1009, or installed from the storage device 1008, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0109] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include an information signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated information signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0110] In some embodiments, the client and server can communicate using any known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital information communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any known or future developed network.
[0111] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0112] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device:
[0113] Determine several candidate files in the file set;
[0114] Pre-downloading the plurality of candidate files to obtain cache data corresponding to the candidate files respectively;
[0115] Obtaining a download instruction, wherein the download instruction includes identification information of a file to be downloaded;
[0116] If the file to be downloaded matches one of the candidate files, the file to be downloaded is obtained based on the cache data corresponding to the target file, and the target file is a candidate file that matches the file to be downloaded.
[0117] Optionally, when the above one or more programs are executed by the electronic device, the electronic device may also execute other steps described in the above embodiments.
[0118] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0119] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0120] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0121] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0122] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0123] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:
[0124] one or more processors;
[0125] a memory for storing one or more programs;
[0126] When the one or more programs are executed by the one or more processors, the one or more processors implement any file downloading method provided in the present disclosure.
[0127] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any file downloading method provided in the present disclosure.
[0128] An embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, the file downloading method described above is implemented.
[0129] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0130] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the embodiments described herein, but rather to be construed in the broadest manner consistent with the principles and novel features disclosed herein.
Claims
1. A file downloading method, comprising: Determine a number of candidate files in the file set; Pre-downloading the plurality of candidate files to obtain cache data corresponding to the candidate files respectively; Obtaining a download instruction, wherein the download instruction includes identification information of a file to be downloaded; If the file to be downloaded matches one of the candidate files, the file to be downloaded is obtained based on the cache data corresponding to the target file, and the target file is a candidate file that matches the file to be downloaded.
2. The method according to claim 1, wherein the file download process includes N different processing steps, each processing step corresponds to a processing queue; N is a positive integer greater than or equal to 2; the pre-downloading of the plurality of candidate files to obtain cache data corresponding to the candidate files respectively includes: For the candidate file, let M be 1, and repeat the loop steps until M=N-1, where M is a positive integer; Among them, the loop step includes: inserting the candidate file into the processing queue corresponding to the Mth processing step; if the sequence number of the candidate file in the target queue is 1, executing the Mth processing step for each candidate file in the target queue, obtaining the Mth cache data corresponding to the candidate file, and saving the Mth cache data to the local storage space; updating the value of M so that the difference between the value of M after the update and the value of M before the update is 1; the target queue is the processing queue corresponding to the Mth processing step.
3. The method according to claim 2, wherein if the file to be downloaded matches one of the candidate files, obtaining the file to be downloaded based on the cache data corresponding to the target file comprises: For the file to be downloaded, executing the N different processing steps in sequence; Among them, for the file to be downloaded, the process of executing the Pth processing step includes: if the serial number of the file to be downloaded in the processing queue corresponding to the Pth processing step is 1, determine whether the local storage space includes the processing result corresponding to the Pth processing step; if included, insert the file to be downloaded into the processing queue corresponding to the P+1th processing step; 1≤P≤N-1, P is a positive integer.
4. The method according to claim 2, wherein if the file to be downloaded matches one of the candidate files, obtaining the file to be downloaded based on the cache data corresponding to the target file comprises: Determining whether the local storage space includes cache data corresponding to the file to be downloaded; If so, determining a target processing queue according to the processing steps corresponding to the cached data; Inserting the file to be downloaded into the target processing queue; Starting from the processing step corresponding to the target processing queue, the steps included in the file downloading process are continuously executed.
5. The method according to claim 2, wherein inserting the candidate file into a processing queue corresponding to the Mth processing step comprises: Determining the priority of the candidate files; Based on the priority of the candidate file, the candidate file is inserted into the processing queue corresponding to the Mth processing step.
6. The method according to claim 5, wherein determining the priority of the candidate file comprises: The priority of the candidate file is determined according to the exposure times of the candidate file and / or the time information of being transferred to the processing queue corresponding to the Mth processing step.
7. The method according to claim 3 or 4, wherein The insertion position of the file to be downloaded in the processing queue is the first position of the processing queue.
8. The method according to claim 1, further comprising: Obtaining an expiration condition corresponding to each cache data; When the expiration condition is satisfied, the cache data corresponding to the satisfied expiration condition is deleted.
9. A file downloading device, comprising: A determination module, used for determining a number of candidate files in a file set; A pre-download module, used to pre-download the plurality of candidate files to obtain cache data corresponding to the candidate files respectively; An acquisition module, used to acquire a download instruction, wherein the download instruction includes identification information of a file to be downloaded; The download module is used to obtain the file to be downloaded based on the cache data corresponding to the target file if the file to be downloaded matches one of the candidate files, and the target file is a candidate file matching the file to be downloaded.
10. An electronic device, wherein the electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium having a computer program stored thereon, wherein the program implements the method according to any one of claims 1 to 8 when executed by a processor.
Citation Information
Patent Citations
Data file downloading method and device, computer equipment and storage medium
CN109462650A
File transmission system and method, computing device and storage medium
CN109756581A
Video content downloading method and device, equipment and storage medium
CN113747212A
File previewing method and device, equipment and medium
CN115878676A
File downloading method and device, electronic equipment and storage medium
CN117118976A