File storage method and device, equipment, storage medium and program product
By setting a score for files and distinguishing them according to access frequency, the problem of unordered files accumulation in object storage services is solved, and efficient storage space utilization and rapid download are achieved.
Patent Information
- Application Number
- CN202411190585.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-27
AI Technical Summary
The existing object storage services lack unified classification standards and effective labeling systems, resulting in disorderly accumulation of files and occupying storage space, reducing the flexibility of storage space and resource utilization, and affecting download speed and efficiency.
By setting an initial score for the file, increasing or decreasing the score according to the access frequency, and storing the file to different spaces, high-frequency access files are stored in standard spaces, and low-frequency access files are stored in cold backup spaces to achieve high compression and improve storage Space utilization and download speed.
It improves the utilization rate and efficiency of storage space, ensures the rapid download of high-frequency access files, reduces the consumption of storage space, and improves the flexibility of file storage and resource utilization.
Smart Images

Figure CN119200966A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a file storage method, device, equipment, storage medium and program product. Background Art
[0002] With the continuous development of IoT technology, users and IoT systems have more and more demands for file storage and downloading.
[0003] At present, in the cloud environment, file storage mainly uses object storage services. However, in the face of the ever-increasing number of files, object storage services lack a unified classification standard and an effective labeling system, resulting in a large number of files piling up in disorder, occupying storage space, and the storage space is difficult to flexibly adjust according to actual usage needs, which reduces the flexibility of storage space, affects the resource utilization of storage space, and thus reduces the efficiency of storage space usage. Summary of the invention
[0004] Embodiments of the present application provide a file storage method, apparatus, device, storage medium, and program product.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a file storage method, comprising: obtaining an initial score of a file in a first space; determining a first score of the file in the first space based on the access frequency of the file in the first space, the first score being a score obtained by at least one of increasing or decreasing the initial score; if a first file exists in the first space, storing the first file in a second space; wherein the first file is a file whose first score is lower than a first preset score, and the second space has a higher compression ratio than the first space; if a second file exists in the first space, performing an expected operation on the second file; wherein the second file is a file whose first score is higher than a second preset score, and the expected operation indicates that a download speed of the second file is higher than a download speed of other files in the first space except the second file.
[0007] It is understandable that an initial score is set for the file, and the score is increased and / or decreased based on the initial score of the file according to the frequency of file download by the user, so as to continuously update the score of the file and judge the score of the file according to the frequency of use of the file. Files with different scores are distinguished by setting a first preset score and a second preset score. Files with scores exceeding the second preset score are subjected to the expected operation to facilitate faster access; files with scores below the first preset score are stored in the cold backup space to facilitate the compression of files with low access frequency in the cold backup space. Based on this, on the one hand, the method realizes the storage of the first file with low access frequency in the cold backup space with a high compression ratio, so that the standard storage space can store more files, effectively improving the utilization rate of the storage space and improving the storage efficiency. On the other hand, the method enables the second file with high frequency of access to be accessed faster, thereby improving the download speed of the second file.
[0008] In some embodiments, based on the access frequency of files in the first space, a first score of files in the first space is determined, including: when files in the first space are accessed, for a third file that is accessed, the score is increased on the basis of an initial score of the third file according to a first preset method to determine a first score; and, when files in the first space are not accessed within a first preset period, for a fourth file that is not accessed within the first preset period, the score is reduced on the basis of an initial score of the fourth file according to a second preset method to determine a second score, the first score includes the first score and the second score.
[0009] It can be understood that the first preset method is used to increase the score of the third file to determine the first score, and the second preset method is used to reduce the score of the fourth file to determine the second score. That is, the first preset method and the second preset method are used to increase or decrease the scores of the files in the first space, and to update the scores of the files in the first space, so that files with high access frequency and files with low access frequency are distinguished by scores, thereby effectively improving the accuracy of file scores.
[0010] In some embodiments, obtaining an initial score of a file in the first space includes: detecting file attributes of the file in the first space, where the file attributes include at least one of a file type, a file size, and a file service; and determining an initial score of the file in the first space based on the file attributes.
[0011] It can be understood that by detecting the type, file size and file business of the file in the first space, the initial score of the file in the first space is determined, so that the initial score of the file in the first space is associated with the file attribute, thereby improving the accuracy and effectiveness of the initial score.
[0012] In some embodiments, the method further includes: detecting scores of files in the first space, determining files with scores lower than a first preset score as first files, and determining files with scores higher than a second preset score as second files.
[0013] It can be understood that by detecting the scores of files in the first space, files with scores lower than the first preset score are determined as first files, and files with scores higher than the second preset score are determined as second files, thereby distinguishing files into first files and second files according to their scores, so that the first files and the second files can be stored in different spaces, thereby improving the effectiveness of partitioned storage of files.
[0014] In some embodiments, when the second file exists in the first space, an expected operation is performed on the second file, including: when the second file exists in the first space, storing the second file in a third space; and performing a CDN pre-fetch operation on the second file based on the third space.
[0015] It can be understood that by storing the second file in the third space and performing a CDN pre-fetch operation, the second file can be downloaded faster when accessed, thereby improving the download speed of the second file and further improving the download efficiency of the second file.
[0016] In some embodiments, the first preset method is related to at least one of an access period and an access count of files in the first space; and the second preset method is related to an access period of files in the first space.
[0017] It can be understood that by setting the first preset mode, the score of the file in the first space is increased, and by setting the second preset mode, the score of the file in the first space is reduced. By setting the relevant factors (access cycle, access times) of the first preset mode and the second preset mode, a basis is provided for updating the score of the file in the first space, thereby improving the accuracy of the score of the file in the first space.
[0018] In a second aspect, an embodiment of the present application provides a device for storing files, including:
[0019] An acquisition module, used to acquire an initial score of a file in the first space;
[0020] A determination module, configured to determine a first score of a file in the first space based on an access frequency of the file in the first space;
[0021] A storage module, configured to store the first file in the second space if the first file exists in the first space;
[0022] The operation module is used to perform an expected operation on the second file when the second file exists in the first space.
[0023] In a third aspect, an embodiment of the present application provides a waveform data storage device, including a memory and a processor, wherein the memory is used to store executable data instructions; when the processor is used to execute the executable data instructions stored in the memory, the steps in the above method are implemented.
[0024] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above method when executed by a processor.
[0025] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program or instructions, which implement the steps in the above method when the computer program or instructions are executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 One of the flowcharts of a file storage method provided in an embodiment of the present application;
[0027] Figure 2 A second flowchart of a method for storing a file provided in an embodiment of the present application;
[0028] Figure 3a A schematic diagram of the size and initial score of a video file provided in an embodiment of the present application;
[0029] Figure 3b A schematic diagram of the size and initial score of image files provided in an embodiment of the present application;
[0030] Figure 3c A schematic diagram of files and initial scores of different business types provided in an embodiment of the present application;
[0031] Figure 3d A schematic diagram of the access frequency and initial score of a file provided in an embodiment of the present application;
[0032] Figure 4 A schematic diagram of a flow chart of an exemplary file storage method provided in an embodiment of the present application;
[0033] Figure 5 A schematic diagram of the structure of a file storage device provided in an embodiment of the present application;
[0034] Figure 6 A hardware entity schematic diagram of a file storage device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application are further elaborated in detail below in conjunction with the drawings and embodiments. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0036] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0037] It should be pointed out that the terms "first\second\third" involved in the embodiments of the present application are merely to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0038] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as the general understanding of those skilled in the art in the field to which the embodiments of the present application belong. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.
[0039] The following is an illustrative introduction to the file storage method, device, equipment and storage medium provided in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application.
[0040] In the embodiments of the present application, Figure 1 This is one of the flowcharts of a method for storing a file provided in an embodiment of the application. The method may include S101 to S104:
[0041] S101: Obtain an initial score of a file in a first space.
[0042] In the embodiment of the present application, the first space is the initial storage space of the file. The present application does not limit the type of the first space, for example, object storage OSS, block storage EBS, file storage NAS.
[0043] In the embodiment of the present application, when a file is first stored in the first space, the file is evaluated and an initial score of the file is determined. The embodiment of the present application does not limit the representation type of the initial score, but it is a score that can represent the initial state of the file.
[0044] Exemplarily, the initial score may be the letter B, or the initial score may be the number 10.
[0045] In the embodiment of the present application, the method for obtaining the initial score of the file in the first space is not limited, and in short, the method for obtaining the initial score of the file is a method that can obtain the initial score of the file. The purpose of obtaining the initial score of the file in the first space is to increase and / or decrease the score based on the initial score of the file, so as to update the score of the file in the first space.
[0046] S102: Determine a first score of the file in the first space based on the access frequency of the file in the first space, where the first score is a score obtained by at least one of increasing or decreasing the initial score;
[0047] In the embodiment of the present application, when a user downloads a file in the first space, the file is accessed.
[0048] Exemplarily, the access frequency of a file may be 10 times per hour, that is, the file is accessed 10 times within one hour.
[0049] In an embodiment of the present application, all files in the first space have initial scores. The files in the first space are scored according to the access frequencies of different files to determine the first score of each file. That is to say, when a file in the first space is frequently accessed or has not been accessed for a long time, the score of the file is changed from the initial score to the first score.
[0050] In some embodiments, for a file with a high access frequency, a first score is obtained by increasing an initial score of the file.
[0051] In some embodiments, for a file that has not been accessed for a long time, the first score is obtained by reducing the initial score of the file.
[0052] S103. If the first file exists in the first space, store the first file in the second space; wherein the first file is a file whose first score is lower than a first preset score, and the second space has a higher compression ratio than the first space.
[0053] In the embodiment of the present application, the files in the first space are continuously updated based on the initial score to obtain a first score. The storage method of different files in the first space is determined by comparing the first score with the first preset score and the second preset score, that is, the files in the first space may still be stored in the first space, or may be transferred to the second space or the third space.
[0054] In the embodiment of the present application, the first preset score is used to determine whether the file is stored in the second space. Only when the first score of the file is lower than the first preset score, the file can be transferred from the first space to the second space.
[0055] In some embodiments, when a file in the first space has not been accessed for a long time, a first score is obtained by reducing the score based on the initial score of the file. If the first score is lower than a first preset score, it means that the demand or probability of accessing the file is low, and the file is stored in the second space.
[0056] In the embodiment of the present application, the second space and the first space are two different spaces, and the second space has a higher compression ratio than the first space. That is, if the first space and the second space have the same capacity, the second space can store more files than the first space because the second space has a stronger file compression capability than the first space.
[0057] S104. If a second file exists in the first space, perform an expected operation on the second file; wherein the second file is a file having a first score higher than a second preset score, and the expected operation indicates that a download speed of the second file is higher than a download speed of other files in the first space except the second file.
[0058] In the embodiment of the present application, the second preset score is used to determine whether the second file exists, and the second file is a file whose first score is higher than the second preset score.
[0059] In some embodiments, when files in the first space are frequently accessed, a first score is obtained by adding a score to the initial score of the file, and the first score is higher than a second preset score, which indicates that the file is a second file. In other words, the demand or probability of the second file being accessed is high, and an expected operation is performed on the second file. The expected operation indicates that the download speed of the second file is higher than the download speed of other files in the first space except the second file.
[0060] In the embodiment of the present application, the method of the expected operation is not limited. In short, it is an operation that can make the download speed of the second file higher. For example, the expected operation may be an operation of storing the second file in a CDN node.
[0061] It is understandable that an initial score is set for the file, and the score is increased and / or decreased based on the initial score of the file according to the frequency of file download by the user, so as to continuously update the score of the file and judge the score of the file according to the frequency of use of the file. Files with different scores are distinguished by setting a first preset score and a second preset score. Files with scores exceeding the second preset score are subjected to the expected operation to facilitate faster access; files with scores below the first preset score are stored in the cold backup space to facilitate the compression of files with low access frequency in the cold backup space. Based on this, on the one hand, the method realizes the storage of the first file with low access frequency in the cold backup space with a high compression ratio, so that the standard storage space can store more files, effectively improving the utilization rate of the storage space and improving the storage efficiency. On the other hand, the method enables the second file with high frequency of access to be accessed faster, thereby improving the download speed of the second file.
[0062] In some embodiments, S102 may include:
[0063] When a file in the first space is accessed, for the accessed third file, a score is increased based on an initial score of the third file in a first preset manner to determine a first score; and,
[0064] When the files in the first space have not been accessed within the first preset period, for the fourth file that has not been accessed within the first preset period, the score is reduced based on the initial score of the fourth file in a second preset manner to determine the second score, and the first score includes the first score and the second score.
[0065] In the embodiment of the present application, the first preset method is not limited. In short, it is a method for increasing the score of the third file.
[0066] Exemplarily, the first preset method may be a method of increasing a fixed score, a method of increasing a score in a step-by-step manner, or a method of increasing a score based on different intelligent algorithms.
[0067] In some embodiments, the first preset method is a step-by-step increase method. For example, when the access frequency of the third file is 10 times / hour, 5 points are added to the third file; when the access frequency of the third file is 50 times / hour, 10 points are added to the third file.
[0068] In some embodiments, the second preset method is not limited, and in short, it is a method for reducing the score of the third file.
[0069] Exemplarily, the second preset method may be a method of reducing the score by a fixed score, a method of reducing the score by a step-by-step manner, or a method of reducing the score based on different intelligent algorithms.
[0070] In some embodiments, the second preset method is a step-by-step reduction method. For example, if the third file has not been accessed within 7 days, 5 points will be reduced for the third file; if the third file has not been accessed within 30 days, 20 points will be reduced for the third file.
[0071] In the embodiment of the present application, the first score and the second score are scores of the file obtained by increasing or decreasing the score on the basis of the initial score. Therefore, the first score and the second score belong to the first score.
[0072] It can be understood that the first preset method is used to increase the score of the third file to determine the first score, and the second preset method is used to reduce the score of the fourth file to determine the second score. That is, the first preset method and the second preset method are used to increase or decrease the scores of the files in the first space, and to update the scores of the files in the first space, so that files with high access frequency and files with low access frequency are distinguished by scores, thereby effectively improving the accuracy of file scores.
[0073] In some embodiments, Figure 2 As shown, S101 may include S301 and S302:
[0074] S301: Detect file attributes of a file in a first space, where the file attributes include at least one of a file type, a file size, and a file service.
[0075] S302: Determine an initial score of the file in the first space based on the file attribute.
[0076] In the embodiment of the present application, there is no limitation on the type of file, which may be a log file, a multimedia file, a configuration file, a diagnostic file, etc.
[0077] In the embodiment of the present application, there is no limitation on the size of the file, for example, 10KB, 120MB, 1.3G, etc.
[0078] In the embodiment of the present application, there is no limitation on the business of the file, which may be an Over-The-Air (OTA) file, a map data file, or a diagnostic log file.
[0079] In some embodiments, different weight ratios are assigned to the file type, file size, and file business, and an intelligent algorithm is used to calculate the initial score of the file based on the file type, file size, and file business under different weight ratios. A higher initial score calculated indicates that the file has a higher probability of being transferred to the CDN node.
[0080] For example, Figure 3a As shown in the figure, it can be seen from the schematic diagram of the file size of the video type and the initial score that the relationship between the file size of the video type and the initial score presents a Poisson distribution. The video type files with a relatively high playback volume are generally 1-10 minutes, and their video size is generally between 100M-500M. Therefore, the initial score corresponding to the file size of 100M-500M is higher.
[0081] For example, Figure 3b As shown in the figure, from the diagram of the file size and initial score of the image type, it can be seen that the most visited images should appear on the homepage of each client, and their image size is generally not more than 1M, so the initial score corresponding to the file size of 500KB to 1M is higher;
[0082] For example, Figure 3c As shown in the figure, from the schematic diagram of different file business types and initial scores, it can be seen that for files of a specific business type, its access frequency is strongly correlated with the business type: for example, OTA files are generally accompanied by a large number of vehicle-side downloads after uploading, so they should be given a higher initial score. For example, vehicle-side event log files are generally not downloaded if no problems occur after uploading, so they can be given a lower initial score.
[0083] For example, Figure 3d As shown in FIG. 1 , it can be seen from the schematic diagram of access frequency and initial score that for files within the high-frequency access range, a higher initial score is assigned, and vice versa.
[0084] It can be understood that by detecting the type, file size and file business of the file in the first space, the initial score of the file in the first space is determined, so that the initial score of the file in the first space is associated with the file attribute, thereby improving the accuracy and effectiveness of the initial score.
[0085] In some embodiments, the method further includes: detecting scores of files in the first space, determining files with scores lower than a first preset score as first files, and determining files with scores higher than a second preset score as second files.
[0086] In the embodiment of the present application, the detection method is not limited. In short, it is a method that can read the score of the file in the first space.
[0087] In some embodiments, detecting the scores of files in the first space may be a timed detection, for example, setting a detection to score all files in the first space every 1 minute.
[0088] In some embodiments, the way of detecting the score of the file in the first space may be a trigger detection, and when the score of the file in the first space is changed, the score of the file in the first space is detected.
[0089] It can be understood that by detecting the scores of files in the first space, files with scores lower than the first preset score are determined as first files, and files with scores higher than the second preset score are determined as second files, thereby distinguishing files into first files and second files according to their scores, so that the first files and the second files can be stored in different spaces, thereby improving the effectiveness of partitioned storage of files.
[0090] In some embodiments, S104 may include S401 and S402:
[0091] S401: If the second file exists in the first space, store the second file in the third space;
[0092] S402: Based on the third space, perform a CDN pre-fetch operation on the second file.
[0093] In an embodiment of the present application, after the score of the file in the first space is updated according to the access frequency of the file, the file is determined to be the second file, the second file is transferred from the first space to the third space, and the CDN pre-fetch operation is performed on the second file in the third space.
[0094] In some embodiments, CDN pre-fetching means that before the actual peak of the Internet of Vehicles system, the source station or CDN management system proactively pushes the files or data that are expected to be frequently accessed to various nodes in the CDN network. In this way, when a large number of users actually initiate requests, they can directly obtain data from the CDN node without having to go back to the source station to pull it, thereby significantly reducing latency, increasing access speed, and alleviating the pressure on the source station.
[0095] It should be noted that CDN nodes are the basic components of CDN architecture. They are usually deployed in data centers or edge locations around the world, connected through high-speed networks to form a huge distributed network. The third space where CDN nodes are located refers to the collection of data centers, edge servers or cloud infrastructures where CDN nodes are distributed around the world.
[0096] It can be understood that by storing the second file in the third space and performing a CDN pre-fetch operation, the second file can be downloaded faster when accessed, thereby improving the download speed of the second file and further improving the download efficiency of the second file.
[0097] In some embodiments, the first preset method is related to at least one of an access period and an access count of files in the first space; and the second preset method is related to an access period of files in the first space.
[0098] In some embodiments, the first preset method can be to increase the score of the files in the first space according to the access cycle of the files in the first space, or it can be to reduce the score of the files in the first space according to two factors: the access cycle and the number of accesses of the files in the first space, and different weights can be matched to the two factors.
[0099] It can be understood that by setting the first preset mode, the score of the file in the first space is increased, and by setting the second preset mode, the score of the file in the first space is reduced. By setting the relevant factors (access cycle, access times) of the first preset mode and the second preset mode, a basis is provided for updating the score of the file in the first space, thereby improving the accuracy of the score of the file in the first space.
[0100] The storage method of the above-mentioned files is described below in conjunction with an application example. However, it should be noted that this example is only for better illustrating the present application and does not constitute an improper limitation on the present application.
[0101] Below, an exemplary application of the embodiment of the present application in an application scenario of file storage in a connected vehicle environment will be described.
[0102] In the embodiment of the present application, based on the cloud environment, the storage of files in the Internet of Vehicles environment mainly uses object storage services, and client downloads are performed through CDN services.
[0103] In an embodiment of the present application, a method for storing a file is as follows: Figure 4 As shown, it may include S1001 to S1009:
[0104] S1001. Obtain file.
[0105] In the embodiment of the present application, the files uploaded by the user are first stored in a standardized storage space (first space).
[0106] S1002. Calculate the initial score value (initial score) of the file and save it.
[0107] In the embodiment of the present application, the initial score of the file is calculated according to the type of each file, the size of the file, and the business type of the file (for example, OTA file type, etc.).
[0108] S1003: When the file download frequency exceeds a preset value, increase the file score.
[0109] In an embodiment of the present application, according to the frequency of file downloads, when the frequency of downloading a certain file exceeds a preset value, a score is increased based on the initial score of the file, and the current score is updated each time the file is downloaded.
[0110] S1004: When the file has not been accessed for more than a preset period (a first preset period), the file score is reduced.
[0111] In an embodiment of the present application, when it is identified that a file has not been downloaded for more than a preset period, the score of the file is reduced based on the initial score of the file. The preset period can be a plurality of different time periods. Every time the file exceeds any preset period, the current score will be updated.
[0112] S1005: Does the score of the file exceed the CDN pre-fetch threshold (a second preset score)? If so, proceed to S1006; if not, proceed to S1009.
[0113] In the embodiment of the present application, after the score of a file increases and / or decreases, it is determined whether the score of the file exceeds the CDN pre-fetching threshold.
[0114] S1006: Perform CDN pre-fetching operation on the file.
[0115] In an embodiment of the present application, if the score of a file exceeds the CDN pre-fetch threshold, the file is stored in a data center, edge server, or cloud infrastructure area (third space) of the CDN node, and a CDN pre-fetch operation is performed on the file.
[0116] S1007: Is the file score lower than the cold backup threshold (first preset score)? If so, proceed to S1008; if not, proceed to S1009.
[0117] In the embodiment of the present application, after a file has experienced an increase and / or decrease in score, it is determined whether the score of the file is lower than a cold backup threshold.
[0118] S1008. Perform a cold backup operation on the file.
[0119] In the embodiment of the present application, if the score of the file is lower than the cold backup threshold, a cold backup operation is performed on the file, that is, the file is transferred to the cold backup space (the second space).
[0120] S1009: No operation.
[0121] In an embodiment of the present application, an initial score is set for the file, and the score is increased and / or decreased based on the initial score of the file according to the frequency of file download by the user, so as to continuously update the score of the file and judge the score of the file according to the frequency of use of the file. Files with different scores are distinguished by setting a first preset score and a second preset score. Files with scores exceeding the second preset score are subjected to CDN pre-fetch operations to facilitate faster access; files with scores lower than the first preset score are stored in a cold backup space to facilitate compression of files with low access frequencies in the cold backup space. Based on this, on the one hand, the method realizes the storage of files with low access frequencies in a cold backup space with a high compression ratio, so that more files can be stored in the standard storage space, effectively improving the utilization of the storage space and improving storage efficiency. On the other hand, the method makes it easier for files with high frequency access to trigger CDN pre-fetch operations, so that files with high frequency access are cached at the CDN edge node, avoiding the back-to-source operation when users access files, and improving the file download speed.
[0122] The present application embodiment provides a file storage device 500, such as Figure 5 As shown, the storage device 500 of the file includes:
[0123] The acquisition module 501 is used to acquire the initial scores of the files in the first space.
[0124] The determination module 502 is used to determine a first score of the file in the first space based on the access frequency of the file in the first space, where the first score is obtained by at least one of increasing or decreasing the initial score.
[0125] The storage module 503 is used to store the first file in the second space when the first file exists in the first space.
[0126] The operation module 504 is used to perform a desired operation on the second file when the second file exists in the first space.
[0127] In some embodiments, the determination module 502 is also used to: when a file in the first space is accessed, for a third file that is accessed, determine a first score by increasing the score of the third file based on the initial score of the third file according to a first preset method; and, when a file in the first space is not accessed within a first preset period, when a fourth file that is not accessed within the first preset period is accessed, determine a second score by reducing the score of the fourth file based on the initial score of the fourth file according to a second preset method.
[0128] In some embodiments, the file storage device 500 further includes a detection module 505, and the detection module 505 is used to detect the file attributes of the files in the first space.
[0129] The determination module 502 is further configured to determine an initial score of the file in the first space based on the file attribute.
[0130] In some embodiments, the detection module 505 is further used to detect the scores of files in the first space, determine files with scores lower than a first preset score as first files, and determine files with scores higher than a second preset score as second files.
[0131] In some embodiments, the storage module 503 is further configured to store the second file in the third space when the second file exists in the first space. The operation module 504 is further configured to perform a CDN pre-fetch operation on the second file based on the third space.
[0132] It is understandable that an initial score is set for the file, and the score is increased and / or decreased based on the initial score of the file according to the frequency of file download by the user, so as to continuously update the score of the file and judge the score of the file according to the frequency of use of the file. Files with different scores are distinguished by setting a first preset score and a second preset score. Files with scores exceeding the second preset score are subjected to the expected operation to facilitate faster access; files with scores below the first preset score are stored in the cold backup space to facilitate the compression of files with low access frequency in the cold backup space. Based on this, on the one hand, the method realizes the storage of the first file with low access frequency in the cold backup space with a high compression ratio, so that the standard storage space can store more files, effectively improving the utilization rate of the storage space and improving the storage efficiency. On the other hand, the method enables the second file with high frequency of access to be accessed faster, thereby improving the download speed of the second file.
[0133] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. In some embodiments, the functions or modules included in the device provided in the embodiment of the present application can be used to execute the method described in the above method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0134] It should be noted that in the embodiment of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific hardware, software or firmware, or any combination of hardware, software, and firmware.
[0135] The present application embodiment provides a file storage device, such as Figure 6 As shown, the hardware entity of the storage device 600 of the file includes: a processor 601 and a memory 603, the memory stores a computer program that can be run on the processor, and the processor implements the steps in the file storage method when executing the program.
[0136] It should be noted that the processor 601 generally controls the overall operation of the file storage device 600. The memory 603 is configured to store instructions and applications executable by the processor 601, and can also cache data to be processed or processed by each module in the processor 601 and the file storage device 600 (for example, image data, audio data, voice communication data, and video communication data), which can be implemented through flash memory (FLASH) or random access memory (Random Access Memory, RAM). The file storage device may also include: a communication interface 602; the communication interface 602 enables the file storage device to communicate with other terminals or servers through a network. Data transmission can be performed between the processor 601, the communication interface 602 and the memory 603 through a bus 604.
[0137] Based on the foregoing embodiments, the modules included in the storage device for files provided in the embodiments of the present application, as well as the units included in each module, etc., can be implemented by a processor in a computer device; of course, they can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.
[0138] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, all steps in the file storage method are implemented. The computer-readable storage medium can be transient or non-transient.
[0139] It should be noted here that the description of the various embodiments above tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. The description of the above device and storage medium embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the device and storage medium embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0140] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the serial number of each step / process mentioned above does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The serial numbers of the embodiments of the present application mentioned above are for description only and do not represent the advantages and disadvantages of the embodiments.
[0141] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0142] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. The above are only implementation methods of this application, but the protection scope of this application is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed in this application, which should be covered within the protection scope of this application.
Claims
1. A method for storing a file, characterized in that: The method comprises: Obtaining an initial score of the file in the first space; Determine, based on the access frequency of the files in the first space, a first score of the files in the first space, where the first score is a score obtained by at least one of increasing or decreasing the initial score; If a first file exists in the first space, the first file is stored in the second space; wherein the first file is a file whose first score is lower than a first preset score, and the compression ratio of the second space is higher than the compression ratio of the first space; In the case where a second file exists in the first space, an expected operation is performed on the second file; wherein the second file is a file whose first score is higher than a second preset score, and the expected operation indicates that a download speed of the second file is higher than a download speed of other files in the first space except the second file.
2. The method according to claim 1, characterized in that The determining a first score of the file in the first space based on the access frequency of the file in the first space includes: When a file in the first space is accessed, for a third file that is accessed, a score is increased based on an initial score of the third file in a first preset manner to determine a first score; and, When files in the first space have not been accessed within a first preset period, for a fourth file that has not been accessed within the first preset period, the score is reduced based on the initial score of the fourth file in a second preset manner to determine a second score, where the first score includes the first score and the second score.
3. The method according to claim 1 or 2, characterized in that: The obtaining of the initial score of the file in the first space includes: Detecting a file attribute of a file in the first space, where the file attribute includes at least one of a file type, a file size, and a file service; Based on the file attributes, an initial score of the file in the first space is determined.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Scores of files in the first space are detected, files with scores lower than the first preset score are determined as the first files, and files with scores higher than the second preset score are determined as the second files.
5. The method according to any one of claims 1 to 4, characterized in that: The performing an expected operation on the second file when the second file exists in the first space includes: If a second file exists in the first space, storing the second file in the third space; Based on the third space, a CDN pre-fetch operation is performed on the second file.
6. The method according to claim 2, characterized in that The first preset mode is related to at least one of an access period and an access count of files in the first space; and the second preset mode is related to an access period of files in the first space.
7. A file storage device, characterized in that: The device comprises: An acquisition module, used to acquire an initial score of a file in the first space; A determination module, which determines a first score of the file in the first space based on the access frequency of the file in the first space; a storage module, configured to store the first file in the second space if the first file exists in the first space; The operation module is used to perform an expected operation on the second file when the second file exists in the first space.
8. A file storage device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the steps in the method according to any one of claims 1 to 6 are implemented.
9. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps in the method according to any one of claims 1 to 6 are implemented.
