CN-121979845-A - Disk file management method, device, equipment, medium and product
Abstract
The disclosure provides a disk file management method, a device, equipment, a medium and a product, relates to the technical field of artificial intelligence, and particularly relates to the technical fields of data storage, application development and the like. The disk file management method comprises the steps of receiving an update request sent by a service module in an application program, wherein the update request is sent by the service module after the reference state of a file stored in a disk is changed, updating the reference times of the file based on the update request to obtain updated reference times, and deleting the file in the disk in response to the fact that the updated reference times are determined to be preset values. The method and the device can improve the accuracy of disk file management.
Inventors
- ZHANG MINGYUE
Assignees
- 北京百度网讯科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251215
Claims (10)
- 1. A disk file management method comprising: Receiving an update request sent by a service module in an application program, wherein the update request is sent by the service module after the reference state of a file stored in a disk is changed; Updating the reference times of the file based on the update request to obtain updated reference times; and deleting the file in the disk in response to determining that the updated reference number is a preset value.
- 2. The method of claim 1, wherein the updating the historical reference times of the target file based on the update request comprises: Increasing the number of references by 1 in response to determining that the update request is a reference request, the reference request being used to characterize the update of the reference state from a non-reference state to a reference state, or And reducing the number of references by 1 in response to determining that the update request is a release request, the release request being used to characterize the update of the reference state from the reference state to the non-reference state.
- 3. The method of claim 2, wherein the deleting the target file in the disk in response to determining that the updated number of references is a preset value comprises: and deleting the target file in the disk in response to determining that the updated reference number is 0.
- 4. The method of claim 2, wherein, The reference request is sent by the service module through calling a reference interface, the release request is sent by the service module through calling a release interface, and the reference interface and the release interface are two different preset interfaces.
- 5. The method of claim 1, wherein, The reference times and the file identifications are stored in a metadata storage layer correspondingly, and the metadata storage layer is located in the magnetic disk.
- 6. The method of any of claims 1-5, further comprising: Acquiring a first file identifier and a second file identifier in response to reaching a preset condition, wherein the first file identifier is a file identifier recorded in the metadata storage layer, the second file identifier is a file identifier recorded in a disk file list, and the disk file list is generated by an operating system of a terminal where the application program is located; determining a target file identifier in the second file identifier, wherein the second file identifier comprises the target file identifier, and the first file identifier does not comprise the target file identifier; And adding a cleaning mark for the target file corresponding to the target file identifier so that the operating system can clean the target file.
- 7. A disk file management apparatus comprising: the receiving module is used for receiving an update request sent by a service module in an application program, wherein the update request is sent by the service module after the reference state of a file stored in a disk is changed; The updating module is used for updating the reference times of the file based on the updating request so as to obtain updated reference times; and the deleting module is used for deleting the file in the disk in response to the fact that the updated reference times are determined to be a preset value.
- 8. An electronic device, comprising: at least one processor, and A memory communicatively coupled to the at least one processor, wherein, The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6.
- 9. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-6.
- 10. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-6.
Description
Disk file management method, device, equipment, medium and product Technical Field The disclosure relates to the technical field of artificial intelligence, in particular to the technical fields of data storage, application development and the like, and specifically relates to a disk file management method, device, equipment, medium and product. Background The magnetic disk storage of the mobile terminal stores data in a magnetic disk of the mobile terminal device in a file form. The disk file management is to perform operations such as creating, using and deleting files stored on the disk so as to realize efficient, safe and accurate storage and access of data. Disclosure of Invention The present disclosure provides a disk file management method, apparatus, device, medium, and product. According to one aspect of the disclosure, a disk file management method is provided, which comprises the steps of receiving an update request sent by a service module in an application program, wherein the update request is sent by the service module after a reference state of a file stored in a disk is changed, updating the reference times of the file based on the update request to obtain updated reference times, and deleting the file in the disk in response to determining that the updated reference times are preset values. According to another aspect of the disclosure, a disk file management device is provided, which comprises a receiving module, an updating module and a deleting module, wherein the receiving module is used for receiving an updating request sent by a service module in an application program, the updating request is sent after the service module changes with respect to the reference state of a file stored in a disk, the updating module is used for updating the reference times of the file based on the updating request to obtain updated reference times, and the deleting module is used for deleting the file in the disk in response to the fact that the updated reference times are determined to be preset values. According to another aspect of the present disclosure there is provided an electronic device comprising at least one processor and a memory communicatively coupled to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of the above aspects. According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method according to any one of the above aspects. According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements a method according to any of the above aspects. According to the embodiment of the disclosure, the accuracy of disk file management can be improved. It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification. Drawings The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein: FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure; FIG. 2 is a schematic diagram of an overall architecture provided in accordance with an embodiment of the present disclosure; FIG. 3 is a schematic diagram according to a second embodiment of the present disclosure; FIG. 4 is a schematic diagram of update reference times provided in accordance with an embodiment of the present disclosure; FIG. 5 is a schematic diagram according to a third embodiment of the present disclosure; FIG. 6 is a schematic diagram of an electronic device for implementing a disk file management method according to an embodiment of the present disclosure. Detailed Description Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness. Fig. 1 is a schematic diagram of a first embodiment of the present disclosure, which provides a disk file management method. As shown in fig. 1, the method includes: 101. And receiving an update request sent by a service module in an applicati